From 73d7254fc500bfa7140aa1c2f5d1529d07afbf31 Mon Sep 17 00:00:00 2001 From: booblegum Date: Fri, 30 Dec 2016 12:00:00 +0300 Subject: [PATCH] =?UTF-8?q?PR-36=20=D0=98=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=20=D0=B7=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Исправлено отображение иконки заполненности профиля В расчет заполненности профиля включены новые параметры --- templates/partials/header.html | 6 ------ templates/partials/sass/header.sass | 9 ++++++--- users/templates/contractor_profile.html | 1 - .../templatetags/contractor_indicator.html | 4 +++- users/templatetags/user_tags.py | 17 ++++++++++++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/templates/partials/header.html b/templates/partials/header.html index b0f5a82..e48fb27 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -119,12 +119,6 @@ {% contractor_indicator request.user %} {% endif %} - - - {% if request.user.is_contractor %} - - {% endif %} - {% else %} Регистрация diff --git a/templates/partials/sass/header.sass b/templates/partials/sass/header.sass index 7fc4ff5..052941a 100644 --- a/templates/partials/sass/header.sass +++ b/templates/partials/sass/header.sass @@ -169,14 +169,17 @@ header position: relative cursor: pointer margin-left: 10px - - .ratingInset + .ratingInset-wrapper + position: relative width: 46px height: 46px + .ratingInset + width: 100% + height: 100% border-radius: 100% background-color: #FF0027 display: inline-block - /* position: absolute; */ + position: absolute /* left: -1.859px; */ /* bottom: 3px; */ clip: rect(0, 22px, 50px, 0) diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html index 996e553..392c6ce 100644 --- a/users/templates/contractor_profile.html +++ b/users/templates/contractor_profile.html @@ -803,7 +803,6 @@ data: dataSerializer, dataType: 'json', success: function (data) { - consoCoole.log(data); if (data.status == 'ok') { $("#resume-text-out").html(data.text); $("#resume-text-edit").modal('hide'); diff --git a/users/templates/templatetags/contractor_indicator.html b/users/templates/templatetags/contractor_indicator.html index 838e613..b90d774 100644 --- a/users/templates/templatetags/contractor_indicator.html +++ b/users/templates/templatetags/contractor_indicator.html @@ -1,5 +1,7 @@
-
+
+
+

{{ current_indicator }}%

diff --git a/users/templatetags/user_tags.py b/users/templatetags/user_tags.py index 55e312b..2bbf2af 100644 --- a/users/templatetags/user_tags.py +++ b/users/templatetags/user_tags.py @@ -15,16 +15,27 @@ register = template.Library() @register.inclusion_tag('templatetags/contractor_indicator.html', takes_context=True) def contractor_indicator(context, contractor): - fields = ['avatar', 'cro', 'first_name', 'gender', + fields = ['avatar', 'first_name', 'gender', 'last_name', 'patronym', 'phone', - 'skype', 'website', 'location'] + 'skype', 'website', 'location', + 'contractor_specializations', 'contractor_building_classifications', 'contractor_construction_types', + 'contractor_resume__text'] indicator_sum = 0 for f in fields: if hasattr(contractor, f) and getattr(contractor, f): + try: + if not getattr(contractor, f).all(): + continue + except AttributeError: + pass indicator_sum += 1 - current_indicator = math.ceil(math.ceil(100 / len(fields)) * indicator_sum) + # Если в резюме > 100 символов - считаем его заполненным + if len(getattr(contractor, 'contractor_resume').text) > 100: + indicator_sum += 1 + + current_indicator = math.ceil(math.ceil(100 / len(fields) * indicator_sum)) current_indicator_px = math.ceil(current_indicator / 2) return { 'current_indicator': current_indicator,