From a502506f596caeecb49e5dc4dfa970b016cb1d90 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 8 Aug 2018 03:12:16 +0500 Subject: [PATCH 1/7] =?UTF-8?q?LIL-601=20=D0=A1=D1=82=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D0=B3=D0=BE=20=D1=81=D0=B0=D0=B9=D1=82=D0=B0?= =?UTF-8?q?=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D1=81=D1=81=D1=8B=D0=BB=D0=BE=D0=BA=20=D0=B2=20=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D0=BA=D0=BE=D0=B5=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D1=83=D1=80=D1=81=D0=B0,=20=D1=83?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=BE=D0=B2=20=D0=B8=20=D0=B8=D1=85=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D1=82=20=D0=92=D0=B5=D1=80=D1=82?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D1=82=D1=83=D0=BF=D1=8B=20=D1=83=D0=BC=D0=B5=D0=BD=D1=8C?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B0=2010=20=D0=BF=D0=BA?= =?UTF-8?q?=D1=81=20=D0=9D=D0=B0=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B1=D0=BB=D0=BE=D0=BA=20=D1=81=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B8=D0=B6=D0=B5=20=D0=B1=D0=BB=D0=BE=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=BF=D0=BE=D0=B4=D0=B0=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=B9=20=D0=9D=D0=B0=20=D0=B3=D0=BB=D0=B0=D0=B2?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=203?= =?UTF-8?q?=20=D0=BA=D1=83=D1=80=D1=81=D0=B0=20=D0=B8=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/course/templates/course/_items.html | 2 +- apps/course/templates/course/course.html | 8 ++--- .../templates/course/course_only_lessons.html | 14 ++++----- apps/course/templates/course/lesson.html | 2 +- project/templates/blocks/last_courses.html | 5 ++-- .../templates/blocks/popup_course_lock.html | 2 +- project/templates/lilcity/main.html | 2 +- project/views.py | 2 +- web/src/components/CourseRedactor.vue | 15 +++++----- web/src/components/LessonRedactor.vue | 5 +++- web/src/components/redactor/VueRedactor.vue | 4 +-- web/src/sass/_common.sass | 29 ++++++++++--------- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 42757ddc..d2db9c91 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -54,7 +54,7 @@ {% endif %} {{ course.title }} -
{{ course.short_description }} +
{{ course.short_description | safe | linebreaks }}
diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 53a56abc..aee06faf 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -4,14 +4,14 @@ {% load rupluralize from plural %} {% block title %}{{ course.title }} - {{ block.super }}{% endblock title %} {% comment %} seo tags {% endcomment %} -{% block description %}{{ course.short_description }}{% endblock description%} +{% block description %}{{ course.short_description | striptags }}{% endblock description%} {% block twurl %}{{ request.build_absolute_uri }}{% endblock twurl %} {% block ogtitle %}{{ course.title }} - {{ block.super }}{% endblock ogtitle %} {% block ogurl %}{{ request.build_absolute_uri }}{% endblock ogurl %} {% if course.cover and course.cover.image %} {% block ogimage %}http://{{request.META.HTTP_HOST}}{% if course.cover %}{{ course.cover.image.url }}{% else %}{% static 'img/og_courses.jpg' %}{% endif %}{% endblock ogimage %} {% endif %} -{% block ogdescription %}{{ course.short_description }}{% endblock ogdescription %} +{% block ogdescription %}{{ course.short_description | striptags }}{% endblock ogdescription %} {% block content %}
{{ course.title }}
-
{{ course.short_description | linebreaks }}
+
{{ course.short_description | safe | linebreaks }}
{{ course.title }}
-
{{ course.short_description | linebreaks }}
+
{{ course.short_description | safe | linebreaks }}
{% if course.author.photo %} diff --git a/apps/course/templates/course/course_only_lessons.html b/apps/course/templates/course/course_only_lessons.html index 74a5bf47..59f323d8 100644 --- a/apps/course/templates/course/course_only_lessons.html +++ b/apps/course/templates/course/course_only_lessons.html @@ -4,14 +4,14 @@ {% load rupluralize from plural %} {% block title %}{{ course.title }} - {{ block.super }}{% endblock title %} {% comment %} seo tags {% endcomment %} -{% block description %}{{ course.short_description }}{% endblock description%} +{% block description %}{{ course.short_description | striptags }}{% endblock description%} {% block twurl %}{{ request.build_absolute_uri }}{% endblock twurl %} {% block ogtitle %}{{ course.title }} - {{ block.super }}{% endblock ogtitle %} {% block ogurl %}{{ request.build_absolute_uri }}{% endblock ogurl %} {% if course.cover %} {% block ogimage %}http://{{request.META.HTTP_HOST}}{% if course.cover %}{{ course.cover.image.url }}{% else %}{% static 'img/og_courses.jpg' %}{% endif %}{% endblock ogimage %} {% endif %} -{% block ogdescription %}{{ course.short_description }}{% endblock ogdescription %} +{% block ogdescription %}{{ course.short_description | striptags }}{% endblock ogdescription %} {% block content %}
{{ course.title }}
-
{{ course.short_description }}
+
{{ course.short_description | safe | linebreaks }}
diff --git a/apps/course/templates/course/lesson.html b/apps/course/templates/course/lesson.html index 90e511d5..78037edc 100644 --- a/apps/course/templates/course/lesson.html +++ b/apps/course/templates/course/lesson.html @@ -28,7 +28,7 @@
{{ lesson.title }}
-
{{ lesson.short_description }}
+
{{ lesson.short_description | safe | linebreaks }}
{% comment %} {% if lesson.cover %} diff --git a/project/templates/blocks/last_courses.html b/project/templates/blocks/last_courses.html index 0b080bb8..a84fed73 100644 --- a/project/templates/blocks/last_courses.html +++ b/project/templates/blocks/last_courses.html @@ -3,9 +3,8 @@
Видео-курсы без расписания
Если вам не совсем удобно заниматься с нами в прямом эфире каждый день как в нашей онлайн-школе, специально для вас мы - делаем отдельные уроки в записи, которые вы можете проходить когда вам будем удобно.
-
-
Учите и развивайте креативное мышление когда и где угодно
+ делаем отдельные уроки в записи, которые вы можете проходить когда вам будем удобно.

+ Учите и развивайте креативное мышление когда и где угодно
diff --git a/project/templates/lilcity/main.html b/project/templates/lilcity/main.html index 4227d9ec..06cc2758 100644 --- a/project/templates/lilcity/main.html +++ b/project/templates/lilcity/main.html @@ -9,7 +9,7 @@ {% include "templates/blocks/about.html" %} {% include "templates/blocks/last_courses.html" %} {% include "templates/blocks/gallery.html" %} - {% include "templates/blocks/game.html" %} {% include "templates/blocks/teachers.html" %} + {% include "templates/blocks/game.html" %} {% include "templates/blocks/partners.html" %} {% endblock content %} diff --git a/project/views.py b/project/views.py index c8400f14..37c50c82 100644 --- a/project/views.py +++ b/project/views.py @@ -74,7 +74,7 @@ class IndexView(TemplateView): 'online': online, 'online_coming_soon': online_coming_soon, 'school_schedule': school_schedule, - 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], + 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:3], 'is_purchased': school_payment_exists, 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], 'school_schedules': SchoolSchedule.objects.all(), diff --git a/web/src/components/CourseRedactor.vue b/web/src/components/CourseRedactor.vue index 28e10243..1e458f33 100644 --- a/web/src/components/CourseRedactor.vue +++ b/web/src/components/CourseRedactor.vue @@ -37,10 +37,8 @@ v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }">
{{titles.shortDescription}}
- +
@@ -236,7 +234,7 @@
{{ lesson.title }}
-
{{ lesson.short_description | linebreaks }}
+
@@ -274,6 +272,7 @@ import BlockImages from './blocks/BlockImages' import BlockImageText from './blocks/BlockImageText' import BlockVideo from './blocks/BlockVideo' + import VueRedactor from './redactor/VueRedactor'; import LilSelect from "./inputs/LilSelect"; import LessonRedactor from "./LessonRedactor"; import {api} from "../js/modules/api"; @@ -1140,6 +1139,7 @@ 'block-video': BlockVideo, 'lesson-redactor': LessonRedactor, 'vue-draggable': Draggable, + 'vue-redactor': VueRedactor, } } @@ -1240,9 +1240,10 @@ overflow: scroll; } - .field_short_description { + .field_short_description .redactor-box { + overflow-x: visible; + overflow-y: auto; max-height: 200px; - overflow: scroll; } diff --git a/web/src/components/LessonRedactor.vue b/web/src/components/LessonRedactor.vue index a0a245e2..c233d29f 100644 --- a/web/src/components/LessonRedactor.vue +++ b/web/src/components/LessonRedactor.vue @@ -27,7 +27,8 @@
- +
@@ -88,6 +89,7 @@ import BlockImageText from './blocks/BlockImageText' import BlockVideo from './blocks/BlockVideo' import LilImage from "./blocks/Image" + import VueRedactor from './redactor/VueRedactor'; import {api} from "../js/modules/api"; import Draggable from 'vuedraggable'; import _ from 'lodash' @@ -134,6 +136,7 @@ 'block-video': BlockVideo, 'vue-draggable': Draggable, 'lil-image': LilImage, + 'vue-redactor': VueRedactor, } } diff --git a/web/src/components/redactor/VueRedactor.vue b/web/src/components/redactor/VueRedactor.vue index 6f1cebac..63bc4c44 100644 --- a/web/src/components/redactor/VueRedactor.vue +++ b/web/src/components/redactor/VueRedactor.vue @@ -7,7 +7,7 @@ import './redactor-full.js'; export default { - props: ['value', 'placeholder'], + props: ['value', 'placeholder', 'air', 'buttonsHide'], name: "vue-redactor", data() { return { @@ -18,7 +18,7 @@ const me = this; $(me.$refs.input).redactor({ air: true, - buttonsHide: ['image', 'link', 'format'], + buttonsHide: this.buttonsHide || ['image', 'format'], lang: 'ru', placeholder: this.placeholder, callbacks: { diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index f9cee7ff..6db2a88e 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -893,11 +893,11 @@ a[name] font-size: 20px .section - padding: 60px 0 + padding: 50px 0 +t - padding: 40px 0 - +m padding: 30px 0 + +m + padding: 20px 0 &_review background: url(../img/bg-elephants.jpg) 0 0 / 100px 102px &_gray @@ -2437,11 +2437,11 @@ a.grey-link .go display: flex - margin-bottom: 50px + margin-bottom: 40px justify-content: space-between align-items: center +t - margin-bottom: 30px + margin-bottom: 20px &__item display: flex max-width: calc(50% - 20px) @@ -2498,11 +2498,11 @@ a.grey-link fill: white .course - margin-bottom: 60px + margin-bottom: 50px &__head display: flex min-height: 40px - margin-bottom: 30px + margin-bottom: 20px align-items: center justify-content: space-between +t @@ -2512,9 +2512,9 @@ a.grey-link +t margin-bottom: 10px &__content - margin-bottom: 40px + margin-bottom: 30px +t - margin-bottom: 25px + margin-bottom: 15px &__about position: relative margin-bottom: 40px @@ -2544,9 +2544,9 @@ a.grey-link &:active color: rgba(white,.4) &__user - margin-bottom: 40px + margin-bottom: 30px +t - margin-bottom: 30px + margin-bottom: 20px &__info display: flex align-items: center @@ -2561,17 +2561,17 @@ a.grey-link margin: 20px 0 0 &__metas display: flex - margin-bottom: 45px + margin-bottom: 35px justify-content: space-between +m display: block - margin-bottom: 25px + margin-bottom: 15px &__metas &__meta +m margin-bottom: 20px &__actions display: flex - margin: 0 -10px 50px + margin: 0 -10px 40px &__action position: relative margin: 0 10px @@ -2639,6 +2639,7 @@ a.grey-link visibility: visible &__subtitle margin-bottom: 20px + text-transform: none &__row display: flex +m From 7267dad3f5e871ff9b1898a0d10d95a837485f44 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 9 Aug 2018 03:19:07 +0500 Subject: [PATCH 2/7] =?UTF-8?q?LIL-601,=20=D0=A4=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=20=D0=BF=D0=BE=20=D0=B2=D0=BE=D0=B7=D1=80=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=20=D0=B2=20=D0=BA=D1=83=D1=80=D1=81=D0=B0?= =?UTF-8?q?=D1=85,=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=B2=D0=BE=D0=B7=D1=80=D0=B0=D1=81=D1=82,=20=D1=80=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BD=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/serializers/course.py | 2 + apps/course/filters.py | 3 +- apps/course/models.py | 18 ++++ apps/course/templates/course/courses.html | 29 +++-- .../course/inclusion/category_items.html | 3 +- apps/course/views.py | 9 ++ project/templates/lilcity/index.html | 7 ++ web/src/components/CourseRedactor.vue | 79 ++++++++------ web/src/components/inputs/LilSelect.vue | 28 +++-- web/src/js/modules/api.js | 2 + web/src/js/modules/courses.js | 101 +++++++++++------- 11 files changed, 191 insertions(+), 90 deletions(-) diff --git a/api/v1/serializers/course.py b/api/v1/serializers/course.py index bdb1a289..4e558f3a 100644 --- a/api/v1/serializers/course.py +++ b/api/v1/serializers/course.py @@ -110,6 +110,7 @@ class CourseCreateSerializer(DispatchContentMixin, 'from_author', 'cover', 'price', + 'age', 'is_infinite', 'deferred_start_at', 'category', @@ -261,6 +262,7 @@ class CourseSerializer(serializers.ModelSerializer): 'from_author', 'cover', 'price', + 'age', 'is_infinite', 'deferred_start_at', 'category', diff --git a/apps/course/filters.py b/apps/course/filters.py index 827079e6..64596057 100644 --- a/apps/course/filters.py +++ b/apps/course/filters.py @@ -5,7 +5,8 @@ from .models import Course class CourseFilter(django_filters.FilterSet): category = django_filters.CharFilter(field_name='category__title', lookup_expr='iexact') + age = django_filters.ChoiceFilter(field_name='age', choices=Course.AGE_CHOICES) class Meta: model = Course - fields = ['category'] + fields = ['category', 'age'] diff --git a/apps/course/models.py b/apps/course/models.py index 72cfad97..03fd9ed3 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -50,6 +50,23 @@ class Course(BaseModel, DeactivatedMixin): (ARCHIVED, 'Archived'), (DENIED, 'Denied') ) + AGE_LT5 = 1 + AGE_57 = 2 + AGE_79 = 3 + AGE_912 = 4 + AGE_1215 = 5 + AGE_1518 = 6 + AGE_GT18 = 7 + AGE_CHOICES = ( + (0, 'Любой возраст'), + (AGE_LT5, 'до 5'), + (AGE_57, '5-7'), + (AGE_79, '7-9'), + (AGE_912, '9-12'), + (AGE_1215, '12-15'), + (AGE_1518, '15-18'), + (AGE_GT18, 'от 18'), + ) slug = models.SlugField( allow_unicode=True, null=True, blank=True, max_length=100, unique=True, db_index=True, @@ -73,6 +90,7 @@ class Course(BaseModel, DeactivatedMixin): 'Цена курса', help_text='Если цена не выставлена, то курс бесплатный', max_digits=10, decimal_places=2, null=True, blank=True ) + age = models.SmallIntegerField(choices=AGE_CHOICES, default=0) is_infinite = models.BooleanField(default=False) deferred_start_at = models.DateTimeField( 'Отложенный запуск курса', help_text='Заполнить если курс отложенный', diff --git a/apps/course/templates/course/courses.html b/apps/course/templates/course/courses.html index a3277174..2f47675a 100644 --- a/apps/course/templates/course/courses.html +++ b/apps/course/templates/course/courses.html @@ -20,18 +20,35 @@
-
-
{% if category %}{{ category.0 }}{% else %}Категории{% endif %}
+
+
{% if category.0 %}{{ category.0 }}{% else %}Категории{% endif %}
-
-
Все курсы
+
+
Все категории
{% category_items category %}
+
+
+
+
{% if age_name %}{{ age_name }}{% else %}Возраст{% endif %}
+
+
+
Любой возраст
+
+ {% for a in ages %} +
+
{{ a.1 }}
+
+ {% endfor %} +
+
+
+
@@ -40,7 +57,7 @@
{% if page_obj.has_next %} - + {% endif %}
diff --git a/apps/course/templates/course/inclusion/category_items.html b/apps/course/templates/course/inclusion/category_items.html index 5e6aeef5..66fb771b 100644 --- a/apps/course/templates/course/inclusion/category_items.html +++ b/apps/course/templates/course/inclusion/category_items.html @@ -1,5 +1,6 @@ {% for cat in category_items %} -
+
{{ cat.title }}
{% endfor %} \ No newline at end of file diff --git a/apps/course/views.py b/apps/course/views.py index 3ecd6bd0..ffbbee66 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -283,6 +283,15 @@ class CoursesView(ListView): context = super().get_context_data() filtered = CourseFilter(self.request.GET) context.update(filtered.data) + context['ages'] = Course.AGE_CHOICES[1:] + # context['age'] = list(map(int, context.get('age', []))) + age = context.get('age') + if age and age[0]: + age = int(age[0]) + context['age'] = [age] + context['age_name'] = dict(Course.AGE_CHOICES).get(age, '') + else: + context['age_name'] = '' return context def get_template_names(self): diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index 5d7b9d2d..c7b9d5b7 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -130,6 +130,13 @@ {% include "templates/blocks/popup_course_lock.html" %} {% include "templates/blocks/popup_subscribe.html" %}
+