diff --git a/apps/school/templates/blocks/schedule.html b/apps/school/templates/blocks/schedule.html index 15b129fb..1a021d31 100644 --- a/apps/school/templates/blocks/schedule.html +++ b/apps/school/templates/blocks/schedule.html @@ -10,7 +10,9 @@ {% endfor %}
- {# include './pay_btn.html' #} + {% if not is_purchased and not is_purchased_future %} + Получить доступ на месяц + {% endif %} Распечатать расписание чтобы не забыть diff --git a/apps/school/templates/school/livelessons_list.html b/apps/school/templates/school/livelessons_list.html index 1c0a1778..237072b0 100644 --- a/apps/school/templates/school/livelessons_list.html +++ b/apps/school/templates/school/livelessons_list.html @@ -1,4 +1,4 @@ -{% extends "templates/lilcity/index.html" %} {% load jsonify from jsonify_queryset %} {% load static %} {% block content %} +{% extends "templates/lilcity/index.html" %}{% load static %} {% block content %}
Уроки онлайн-школы LilCity
diff --git a/apps/school/templates/summer/schedule_purchased.html b/apps/school/templates/summer/schedule_purchased.html index e153fbab..4acc2f49 100644 --- a/apps/school/templates/summer/schedule_purchased.html +++ b/apps/school/templates/summer/schedule_purchased.html @@ -22,11 +22,12 @@
+
Новые уроки
{% for school_schedule in school_schedules_sorted %} {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson %} {% endfor %} {% if prev_live_lessons_exists %} -
+
Прошедшие уроки
{% for live_lesson in prev_live_lessons %} {% if live_lesson.school_schedule and live_lesson.title %} {% include 'blocks/schedule_item.html' with school_schedule=live_lesson.school_schedule live_lesson=live_lesson %} diff --git a/apps/user/migrations/0027_user_gallery.py b/apps/user/migrations/0027_user_gallery.py new file mode 100644 index 00000000..eb33301a --- /dev/null +++ b/apps/user/migrations/0027_user_gallery.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0.6 on 2018-11-16 16:36 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0022_auto_20180815_2129'), + ('user', '0026_user_site'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='gallery', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='content.Gallery', verbose_name='Галерея'), + ), + ] diff --git a/apps/user/models.py b/apps/user/models.py index 8d49b7ae..9178718f 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -83,6 +83,10 @@ class User(AbstractUser): allow_unicode=True, null=True, blank=True, max_length=100, unique=True, db_index=True, ) + gallery = models.ForeignKey( + 'content.Gallery', on_delete=models.CASCADE, + verbose_name='Галерея', null=True, blank=True, + ) objects = UserManager() diff --git a/apps/user/templates/user/edit_gallery.html b/apps/user/templates/user/edit_gallery.html new file mode 100644 index 00000000..87c33f0c --- /dev/null +++ b/apps/user/templates/user/edit_gallery.html @@ -0,0 +1,8 @@ + +{% block pre_app_js %} +window.LIL_STORE.components['block-images'] = '../components/BlockImages'; +{% endblock pre_app_js %} + +{% block content %} + +{% endblock %} diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index b8e19a19..4db6efe9 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -73,6 +73,7 @@ КУРСЫ {% endif %} +
@@ -138,6 +139,12 @@
{% endif %} +
+ Редактировать +
+ {% include 'content/blocks/gallery.html' with content=user.gallery %} +
+
diff --git a/apps/user/views.py b/apps/user/views.py index e456af1c..cb420521 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -314,3 +314,8 @@ class BonusHistoryView(TemplateView): 'Перейдите по ссылке и получите скидку %d%% на первую покупку' \ % (request.user.get_full_name(), config.REFERRAL_BONUS) return self.render_to_response(context) + + +@method_decorator(login_required, name='dispatch') +class UserGalleryEditView(TemplateView): + template_name = 'user/edit_gallery.html' diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index fb789f50..48c85a01 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -154,7 +154,7 @@ {% include "templates/blocks/popup_capture_email.html" %}
{% include 'templates/blocks/lil_store_js.html' %} - + {% block pre_app_js %}{% endblock pre_app_js %} {% block foot %}{% endblock foot %} - {% block body_js %}{% endblock body_js %} + {% block foot_js %}{% endblock foot_js %} diff --git a/project/urls.py b/project/urls.py index 4946c577..e122aace 100644 --- a/project/urls.py +++ b/project/urls.py @@ -30,7 +30,7 @@ from apps.user.views import ( ProfileEditView, NotificationEditView, PaymentHistoryView, resend_email_verify, SubscribeView, ProfileView, - BonusHistoryView) + BonusHistoryView, UserGalleryEditView) from apps.payment.views import ( CourseBuySuccessView, CourseBuyView, PaymentwallCallbackView, SchoolBuySuccessView, @@ -75,6 +75,7 @@ urlpatterns = [ path('user/notifications', NotificationEditView.as_view(), name='user-edit-notifications'), path('user/payments', PaymentHistoryView.as_view(), name='user-edit-payments'), path('user/bonuses', BonusHistoryView.as_view(), name='user-bonuses'), + path('user/gallery-edit', UserGalleryEditView.as_view(), name='user-gallery-edit'), path('user/resend-email-verify', resend_email_verify, name='resend-email-verify'), path('subscribe', SubscribeView.as_view(), name='subscribe'), path('subscribe/success', TemplateView.as_view(template_name='templates/lilcity/subscribe_success.html'), name='subscribe-success'), diff --git a/web/src/components/blocks/BlockImages.vue b/web/src/components/blocks/BlockImages.vue index ee1c9534..06a40200 100644 --- a/web/src/components/blocks/BlockImages.vue +++ b/web/src/components/blocks/BlockImages.vue @@ -33,36 +33,41 @@ export default { name: "block-images", - props: ["index", "title", "images", "accessToken", "readOnly"], + props: ["index", "title", "images", "accessToken", "readOnly", "longSide"], methods: { onTitleChange(event) { this.$emit('update:title', event.target.value); }, onImageAdded(event) { + const longSide = +this.longSide || 1600; Array.from(event.target.files).forEach((file) => { let reader = new FileReader(); reader.onload = () => { let images = this.images; - console.log('images before before', JSON.stringify(images)); images.push({ src: reader.result, loading: true, }); this.$emit('update:images', images); + const index = images.length - 1; api.uploadImage(reader.result, this.accessToken) .then((response) => { let images = this.images; - images.forEach((image, index) => { + images[index].image_id = response.data.id; + images[index].loading = false; + images[index].image_url = response.data.image; + images[index].image_thumbnail_url = response.data.image_thumbnail; + + /* images.forEach((image, index) => { if (image.src === reader.result) { images[index].image_id = response.data.id; images[index].loading = false; images[index].image_url = response.data.image; images[index].image_thumbnail_url = response.data.image_thumbnail; } - }); - console.log('images after', JSON.stringify(images)); + }); */ this.$emit('update:images', images); }) .catch((error) => { diff --git a/web/src/js/app.js b/web/src/js/app.js index 7a24f77a..ab87020c 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -46,6 +46,12 @@ const components = { Object.assign(components, window.LIL_STORE.components); +for(let k in components){ + if(typeof components[k] === 'string'){ + components[k] = await import(components[k]); + } +} + const app = new Vue({ el: '#lilcity-vue-app', data() { diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 8b3f9365..b80d6fdb 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -4075,6 +4075,11 @@ a.grey-link letter-spacing: 1px +m margin-right: 0 + &__item a.timing__btn + opacity: 0; + transition: 0.5s ease; + &__item:hover a.timing__btn + opacity: 1; &__pic display: block width: 100%