diff --git a/apps/user/forms.py b/apps/user/forms.py index 6066c132..b56bf133 100644 --- a/apps/user/forms.py +++ b/apps/user/forms.py @@ -31,6 +31,11 @@ class UserEditForm(forms.ModelForm): site = forms.URLField(required=False) photo = forms.ImageField(required=False) + child_gender = forms.CharField(required=False) + child_birthday = forms.DateField(input_formats=['%d.%m.%Y'], required=False) + child_first_name = forms.CharField(required=False) + child_last_name = forms.CharField(required=False) + class Meta: model = User fields = ( @@ -56,6 +61,10 @@ class UserEditForm(forms.ModelForm): 'vkontakte', 'site', 'photo', + 'child_gender', + 'child_birthday', + 'child_first_name', + 'child_last_name', ) diff --git a/apps/user/migrations/0030_auto_20190318_1320.py b/apps/user/migrations/0030_auto_20190318_1320.py new file mode 100644 index 00000000..7f926b45 --- /dev/null +++ b/apps/user/migrations/0030_auto_20190318_1320.py @@ -0,0 +1,33 @@ +# Generated by Django 2.0.7 on 2019-03-18 13:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('user', '0029_emaillog'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='child_birthday', + field=models.DateField(blank=True, null=True, verbose_name='День рождения ребенка'), + ), + migrations.AddField( + model_name='user', + name='child_first_name', + field=models.CharField(blank=True, max_length=30, verbose_name='Имя ребенка'), + ), + migrations.AddField( + model_name='user', + name='child_gender', + field=models.CharField(choices=[('n', 'не указан'), ('m', 'Мужчина'), ('f', 'Женщина')], default='n', max_length=1, verbose_name='Пол ребенка'), + ), + migrations.AddField( + model_name='user', + name='child_last_name', + field=models.CharField(blank=True, max_length=150, verbose_name='Фамилия ребенка'), + ), + ] diff --git a/apps/user/models.py b/apps/user/models.py index 37da804e..2f4bb9fb 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -89,6 +89,12 @@ class User(AbstractUser): verbose_name='Галерея', null=True, blank=True, ) + child_first_name = models.CharField('Имя ребенка', max_length=30, blank=True) + child_last_name = models.CharField('Фамилия ребенка', max_length=150, blank=True) + child_gender = models.CharField( + 'Пол ребенка', max_length=1, default='n', choices=GENDER_CHOICES) + child_birthday = models.DateField('День рождения ребенка', null=True, blank=True) + objects = UserManager() USERNAME_FIELD = 'email' diff --git a/apps/user/templates/user/profile-settings.html b/apps/user/templates/user/profile-settings.html index 7de0e74c..2f3a4b66 100644 --- a/apps/user/templates/user/profile-settings.html +++ b/apps/user/templates/user/profile-settings.html @@ -76,15 +76,6 @@
{{ error }}
{% endfor %} -
-
Телефон
-
- -
- {% for error in form.phone.errors %} -
{{ error }}
- {% endfor %} -
Ссылка
@@ -96,6 +87,82 @@
{{ error }}
{% endfor %}
+
+ +
+
Карточка ребёнка
+
+ Вся информация конфиденциальна и не передается третьим лицам. Необходима только для персонализации наград, + поздравлений с Днем Рождения и других персонализированных акций. +
+
+
+
ИМЯ РЕБЕНКА
+
+ +
+ {% for error in form.child_first_name.errors %} +
{{ error }}
+ {% endfor %} +
+
+
ФАМИЛИЯ РЕБЕНКА
+
+ +
+ {% for error in form.child_last_name.errors %} +
{{ error }}
+ {% endfor %} +
+
+
+
+
ДАТА РОЖДЕНИЯ
+
+ +
+ {% for error in form.child_birthday.errors %} +
{{ error }}
+ {% endfor %} +
+
+
ПОЛ
+
+
+
+ {% if user.child_gender == 'f' %}Ж{% elif user.child_gender == 'm' %}M{% else %}М / Ж{% endif %} +
+
+
+
М
+
+
+
Ж
+
+
+ +
+
+ {% for error in form.child_gender.errors %} +
{{ error }}
+ {% endfor %} +
+
+
+
Телефон
+
+ +
+ {% for error in form.phone.errors %} +
{{ error }}
+ {% endfor %} +
+
+ +
ГОРОД
@@ -133,7 +200,7 @@
{% if user.gender == 'f' %}Ж{% elif user.gender == 'm' %}M{% else %}М / Ж{% endif %}
-
+
М
@@ -180,7 +247,7 @@ {% for error in form.old_password.errors %}
{{ error }}
{% endfor %} -
+
НОВЫЙ ПАРОЛЬ
@@ -189,7 +256,7 @@ {% for error in form.new_password1.errors %}
{{ error }}
{% endfor %} -
+
ПОДТВЕРДИТЬ НОВЫЙ ПАРОЛЬ
@@ -198,7 +265,7 @@ {% for error in form.new_password2.errors %}
{{ error }}
{% endfor %} -
+
Соцсети
diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index bb3b909a..55739737 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -1,4 +1,26 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% load thumbnail %} {% block content %} + +{% if not user.child_first_name and not user.child_last_name %} +
+
+
+
Хотите получать грамоты Lil School
по окончании месяца обучения?
+
+ + +
+
+
+{% endif %} +
diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index acb8efc4..1e406194 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -1,40 +1,18 @@ +{% extends "templates/lilcity/layer.html" %} + {% load static %} {% load setting from settings %} {% load compress %} - - - - - - {% block title %}Онлайн-курсы Lil School{% endblock title%} - - - - - - - - - {% comment %} {% endcomment %} - - - - - - - - {% comment %} {% endcomment %} - - - - - - {% compress css %} - - {% endcompress %} - - +{% block layer_head %} + + - - - - - - - - - - - - - - - {% include "templates/blocks/mixpanel.html" %} {% block head %}{% endblock head %} - - +{% endblock layer_head %} + +{% block layer_body %} {% include "templates/blocks/social.html" %} {% include "templates/blocks/baner.html" %}
@@ -160,5 +62,4 @@ {% block foot %}{% endblock foot %} {% block foot_js %}{% endblock foot_js %} - - +{% endblock layer_body %} diff --git a/project/templates/lilcity/layer.html b/project/templates/lilcity/layer.html new file mode 100644 index 00000000..a94ffab0 --- /dev/null +++ b/project/templates/lilcity/layer.html @@ -0,0 +1,114 @@ + +{% load static %} +{% load setting from settings %} +{% load compress %} + + + + + {% block title %}Онлайн-курсы Lil School{% endblock title%} + + + + + + + + + {% comment %} {% endcomment %} + + + + + + + + {% comment %} {% endcomment %} + + + + + + {% compress css %} + + {% endcompress %} + + + + + + + + + + + + + + + + + {% include "templates/blocks/mixpanel.html" %} + {% block layer_head %}{% endblock layer_head %} + + + {% block layer_body %} + {% endblock layer_body %} + + diff --git a/project/templates/lilcity/links.html b/project/templates/lilcity/links.html new file mode 100644 index 00000000..54445428 --- /dev/null +++ b/project/templates/lilcity/links.html @@ -0,0 +1,84 @@ +{% extends "templates/lilcity/layer.html" %} {% load static %} + +{% block title %}School LIL.CITY{% endblock title %} + +{% block layer_head %} + +{% endblock layer_head %} + +{% block layer_body %} +
+
+ +
+
+
+ Lil School — первая образовательная онлайн-платформа креативного мышления для детей! 5+ +
+
+
+ + +
+
+
Подписывайтесь на наши социальные сети
+
+
+ +{% endblock layer_body %} diff --git a/project/urls.py b/project/urls.py index 4054af90..6502237b 100644 --- a/project/urls.py +++ b/project/urls.py @@ -37,7 +37,7 @@ from apps.payment.views import ( SchoolBuyView, GiftCertificatesView, GiftCertificateBuyView, GiftCertificateBuySuccessView, GiftCertificateGetView, CloudPaymentsTestView, PaymentSuccessView) -from .views import AboutView, IndexView, SchoolSchedulesView +from .views import AboutView, IndexView, SchoolSchedulesView, LinksView # TODO trim slash in the end urlpatterns = [ @@ -100,6 +100,7 @@ urlpatterns = [ name='gift-certificate-payment-success'), path('gift-certificate//get', GiftCertificateGetView.as_view(), name='gift-certificate-get'), path('faq', FAQView.as_view(), name='faq'), + path('links', LinksView.as_view(), name='links'), ] diff --git a/project/views.py b/project/views.py index 4b8dcaee..0625d97a 100644 --- a/project/views.py +++ b/project/views.py @@ -117,3 +117,7 @@ class SchoolSchedulesView(TemplateView): context = super().get_context_data() context['school_schedules'] = SchoolSchedule.objects.all() return context + + +class LinksView(TemplateView): + template_name = 'templates/lilcity/links.html' diff --git a/web/src/components/CourseRedactor.vue b/web/src/components/CourseRedactor.vue index 5bc06549..76ab9d93 100644 --- a/web/src/components/CourseRedactor.vue +++ b/web/src/components/CourseRedactor.vue @@ -528,8 +528,7 @@ api.saveCourse(this.course, this.accessToken) .then((response) => { this.courseSaving = false; - this.course = api.convertCourseJson(response.data); - this.course.live = this.live; + this.processCourseJson(response.data); }) .catch((err) => { this.courseSaving = false; @@ -804,10 +803,7 @@ .catch((err) => { this.courseSyncHook = false; this.courseSaving = false; - //console.error(err); this.changeSavingStatus(true, true); - // alert('Произошло что-то страшное: '+err.toString()); - //console.log(err.response.data); if(err.response) { for(let i in err.response.data) { if(typeof err.response.data[i] === "array") { @@ -959,19 +955,7 @@ } }); - // if (this.courseId) { - // this.loadCourse().then(()=>{this.updateViewSection(window.location, 'load')}).catch(()=>{ - // this.updateViewSection(window.location, 'load err') - // }) - // } else { - // this.loadCourseDraft().then(()=>{this.updateViewSection(window.location, 'load draft')}).catch(()=>{ - // this.updateViewSection(window.location, 'load draft err') - // }); - // } - - //console.log('wait promises'); Promise.all(promises.map(p => p.catch(e => e))).then(()=>{ - //console.log('promises end'); this.mounting = false; let load; if (this.courseId) { @@ -987,9 +971,6 @@ this.updateViewSection(window.location, 'load err '+this.courseId) }) }); - - //console.log('mounted end'); - // this.updateViewSection(window.location); }, computed: { displayPrice: { @@ -1019,17 +1000,12 @@ watch: { 'course': { handler: function (newValue, oldValue) { - // //console.log('watch', JSON.stringify(newValue), JSON.stringify(oldValue)); // Если курс загрузился и есть ID - делаем кнопки превью и публикации активными - //console.log('newValue.id', newValue.id); if (newValue.id) { - // //console.log('newValue.id disabled remove', newValue.id); $('#course-redactor__preview-button').removeAttr('disabled'); $('#course-redactor__publish-button').removeAttr('disabled'); } - // //console.log('courseSyncHook', this.courseSyncHook); if (this.courseSyncHook || this.courseLoading) { - //console.log('abort save draft', this.courseSyncHook, this.courseLoading); return; } this.saveCourseDraft(newValue, oldValue); diff --git a/web/src/img/fill-profile-gramota.png b/web/src/img/fill-profile-gramota.png new file mode 100644 index 00000000..ceab2aae Binary files /dev/null and b/web/src/img/fill-profile-gramota.png differ diff --git a/web/src/img/profile-edit-child-form.png b/web/src/img/profile-edit-child-form.png new file mode 100644 index 00000000..80da21e4 Binary files /dev/null and b/web/src/img/profile-edit-child-form.png differ diff --git a/web/src/js/modules/api.js b/web/src/js/modules/api.js index 086b932b..8acb7de1 100644 --- a/web/src/js/modules/api.js +++ b/web/src/js/modules/api.js @@ -90,7 +90,7 @@ export const api = { }); }, saveCourse: (courseObject, accessToken) => { - const isAdding = (!courseObject.hasOwnProperty('id') || !courseObject.hasOwnProperty('id')); + const isAdding = !courseObject.id; let deferredStart = null; if (courseObject.is_deferred) { @@ -114,7 +114,7 @@ export const api = { access_duration: courseObject.is_paid && courseObject.access_duration || 0, is_featured: courseObject.is_featured, slug: (courseObject.slug || '').toLowerCase(), - date: (courseObject.date) ? courseObject.date.value:null, + date: (courseObject.date) ? courseObject.date.value : null, stream: courseObject.stream, cover: courseObject.coverImageId ? courseObject.coverImageId : null, gallery: { @@ -212,14 +212,14 @@ export const api = { }, convertContentJson: (contentJson, forSaving) => { if(forSaving){ - return contentJson.map((block, index) => { + let content = contentJson.map((block, index) => { if (block.type === 'text') { return { 'type': 'text', 'data': { 'id': block.data.id ? block.data.id : null, 'uuid': block.uuid, - 'position': ++index, + 'position': index + 1, 'title': block.data.title, 'txt': block.data.text, } @@ -230,7 +230,7 @@ export const api = { 'data': { 'id': block.data.id ? block.data.id : null, 'uuid': block.uuid, - 'position': ++index, + 'position': index + 1, 'title': block.data.title, 'img': block.data.image_id, } @@ -241,7 +241,7 @@ export const api = { 'data': { 'id': block.data.id ? block.data.id : null, 'uuid': block.uuid, - 'position': ++index, + 'position': index + 1, 'title': block.data.title, 'img': block.data.image_id, 'txt': block.data.text, @@ -253,7 +253,7 @@ export const api = { 'data': { 'id': block.data.id ? block.data.id : null, 'uuid': block.uuid, - 'position': ++index, + 'position': index + 1, 'title': block.data.title, 'images': api.convertGalleryImagesJson(block.data.images), } @@ -271,6 +271,7 @@ export const api = { } } }); + return content; } return contentJson.sort((a, b) => { if (a.position < b.position) { diff --git a/web/src/js/pages/profile.js b/web/src/js/pages/profile.js index 9ac8120a..3156c84b 100644 --- a/web/src/js/pages/profile.js +++ b/web/src/js/pages/profile.js @@ -14,16 +14,19 @@ $(document).ready(function () { }); return; } - // Обработчик выбора пола - let genderInput = $('#gender') - $('div.js-select-option[data-gender-option]').on('click', function (e) { - e.preventDefault(); - const currentGender = $(this).attr('data-gender'); - $('[data-gender]').removeClass('active'); - $(`[data-gender=${currentGender}]`).addClass('active'); - genderInput.val(currentGender) - }); + $('.js-select-drop[data-gender-select]').each((i, el) => { + var $el = $(el); + var $input = $($el.data('input')); + $el.find('div.js-select-option[data-gender-option]').on('click', function (e) { + e.preventDefault(); + const currentGender = $(this).attr('data-gender'); + $('[data-gender]').removeClass('active'); + $(`[data-gender=${currentGender}]`).addClass('active'); + $input.val(currentGender) + }); + }) + $('#user-photo-upload').change(file => { const input = file.target; diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 05759516..70e754e6 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -3266,6 +3266,40 @@ a.grey-link +m display: block +.fill-profile + width: 100% + display: flex + align-items: center + position: relative + padding: 40px 35px + background: url(../img/fill-profile-gramota.png) center bottom no-repeat + + &:before + content: '' + position: absolute + top: 0 + left: 0 + right: 0 + bottom: 0 + opacity: .8 + z-index: -2 + background-image: linear-gradient(-225deg, #FFE2EB 0%, #D8F5F5 100%) + + &__text + flex: 0 0 300px + font-size: 18px + + &__img + flex: 1 + + &__btn + flex: 0 0 205px + text-align: right + + &__arrow + flex: 0 0 50px + text-align: right + .tabs &__nav display: flex @@ -4510,3 +4544,16 @@ a background: $cyan &__preview.theme_violet2 background: $viol2 + +.user-child-form + padding: 30px 80px 40px 160px + margin: 30px -80px 30px -160px + background: url(../img/profile-edit-child-form.png) no-repeat 7px bottom white + border-radius: 20px + box-shadow: 0 10px 24px 0 rgba(0, 0, 0, 0.05) + + &__description + margin-bottom: 40px + margin-top: -20px + color: #333333 + font-size: 12px