diff --git a/apps/course/templates/course/content/imagetext.html b/apps/course/templates/course/content/imagetext.html index 62ec511b..6385391e 100644 --- a/apps/course/templates/course/content/imagetext.html +++ b/apps/course/templates/course/content/imagetext.html @@ -4,7 +4,11 @@
-
+
+
+ +
+
{{ content.txt | safe }}
diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 630aeb61..f5ba90af 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -9,7 +9,7 @@ {% 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}}{{ course.cover.image.url }}{% endblock ogimage %} +{% 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 %} @@ -141,37 +141,45 @@
Описание курса {% if request.user.is_authenticated %} - {% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %} - УРОКИ - - {% elif request.user.role == request.user.ADMIN_ROLE %} - УРОКИ - + {% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %} + УРОКИ + + {% elif request.user.role == request.user.ADMIN_ROLE %} + УРОКИ + + {% else %} + УРОКИ + {% if not paid %} + + + + {% endif %} + + {% endif %} {% else %} УРОКИ - {% if not paid %} + data-popup=".js-popup-auth">УРОКИ - {% endif %} {% endif %} - {% endif %}
{% if course.cover %} diff --git a/apps/course/templates/course/course_only_lessons.html b/apps/course/templates/course/course_only_lessons.html index 3ea64dba..a919e08f 100644 --- a/apps/course/templates/course/course_only_lessons.html +++ b/apps/course/templates/course/course_only_lessons.html @@ -9,7 +9,7 @@ {% block ogtitle %}{{ course.title }} - {{ block.super }}{% endblock ogtitle %} {% block ogurl %}{{ request.build_absolute_uri }}{% endblock ogurl %} {% if course.cover %} -{% block ogimage %}{{ request.build_absolute_uri }}{{ course.cover.url }}{% endblock ogimage %} +{% 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 %} @@ -184,10 +184,15 @@
{% if lesson.cover %}
- +
+ +
{% endif %} -
{{ lesson.short_description | safe }}
+
{{ lesson.short_description | truncatechars_html:800 | safe }}
+
+
+ Перейти к уроку
diff --git a/apps/course/templates/course/courses.html b/apps/course/templates/course/courses.html index 44ee9436..a3277174 100644 --- a/apps/course/templates/course/courses.html +++ b/apps/course/templates/course/courses.html @@ -2,6 +2,7 @@ {% load static %} {% load category_items from lilcity_category %} +{% block ogimage %}http://{{request.META.HTTP_HOST}}{% static 'img/og_courses.jpg' %}{% endblock ogimage %} {% block content %}
diff --git a/apps/course/templates/course/lesson.html b/apps/course/templates/course/lesson.html index 6c9511ae..c1e0bd20 100644 --- a/apps/course/templates/course/lesson.html +++ b/apps/course/templates/course/lesson.html @@ -2,6 +2,7 @@ {% load static %} {% block title %}{{ lesson.title }} - {{ block.super }}{% endblock title %} +{% block ogimage %}http://{{request.META.HTTP_HOST}}{% if lesson.course.cover %}{{ lesson.course.cover.image.url }}{% else %}{% static 'img/og_courses.jpg' %}{% endif %}{% endblock ogimage %} {% block content %}
@@ -14,8 +15,8 @@
Вернуться к списку уроков
- {% comment %} {% if next_lesson %} - + {% if next_lesson %} +
Перейти к следующему уроку
@@ -23,7 +24,7 @@
- {% endif %} {% endcomment %} + {% endif %}
{{ lesson.title }}
@@ -32,7 +33,7 @@ {% if lesson.cover %} {% else %} - + {% endif %} diff --git a/apps/course/views.py b/apps/course/views.py index 90957d68..60b7e308 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -299,7 +299,9 @@ class LessonView(DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['next'] = self.request.GET.get('next', None) - context['next_lesson'] = self.request.GET.get('next_lesson', None) + lessons = list(self.object.course.lessons.values_list('id', flat=True)) + index = lessons.index(self.object.id) + context['next_lesson'] = lessons[index + 1] if index < len(lessons) - 1 else None return context diff --git a/apps/school/templates/school/summer_school.html b/apps/school/templates/school/summer_school.html index 133f8d8b..00da0bf8 100644 --- a/apps/school/templates/school/summer_school.html +++ b/apps/school/templates/school/summer_school.html @@ -1,5 +1,6 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% block title %}Онлайн-школа LilCity{% endblock title%} +{% block ogimage %}http://{{request.META.HTTP_HOST}}{% static 'img/og_summer_school.jpg' %}{% endblock %} {% block content %} {% if not is_purchased %} {% include "../summer/promo.html" %} diff --git a/project/settings.py b/project/settings.py index 24ee180e..ed1785a4 100644 --- a/project/settings.py +++ b/project/settings.py @@ -54,6 +54,7 @@ INSTALLED_APPS = [ 'corsheaders', 'sorl.thumbnail', 'raven.contrib.django.raven_compat', + 'django_user_agents', ] + [ 'apps.auth.apps', 'apps.user', @@ -67,6 +68,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', + 'django_user_agents.middleware.UserAgentMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/project/templates/blocks/user_menu.html b/project/templates/blocks/user_menu.html index 54ebf6b6..13f4fbdf 100644 --- a/project/templates/blocks/user_menu.html +++ b/project/templates/blocks/user_menu.html @@ -1,7 +1,7 @@ {% load static %} {% load thumbnail %} {% if request.user.is_authenticated %}
-
ДАТА
-
+
-->
ДОСТУП
@@ -656,11 +656,11 @@ this.course = api.convertCourseJson(response.data); this.course.live = this.live; - if (this.live && this.course.date) { + /* if (this.live && this.course.date) { this.course.date = _.find(this.scheduleOptions, (item) => { return item.value == this.course.date; }) - } + } */ this.$nextTick(() => { this.courseLoading = false; @@ -841,11 +841,11 @@ this.course.id = courseData.id; } - if(this.live && courseData.date) { + /*if(this.live && courseData.date) { this.course.date = _.find(this.scheduleOptions, function(item){ return item.value == courseData.date; }); - } + }*/ this.$nextTick(() => { this.courseSyncHook = false; }); diff --git a/web/src/components/LessonRedactor.vue b/web/src/components/LessonRedactor.vue index 82faaadb..a0a245e2 100644 --- a/web/src/components/LessonRedactor.vue +++ b/web/src/components/LessonRedactor.vue @@ -14,16 +14,22 @@
{{ title }}
-
-
- -
-
-
-
- +
+ +
+
+
+ +
+
+
+
+ +
+
@@ -81,6 +87,7 @@ import BlockImages from './blocks/BlockImages' import BlockImageText from './blocks/BlockImageText' import BlockVideo from './blocks/BlockVideo' + import LilImage from "./blocks/Image" import {api} from "../js/modules/api"; import Draggable from 'vuedraggable'; import _ from 'lodash' @@ -105,7 +112,13 @@ if (blockToRemove.data.id) { api.removeContentBlock(blockToRemove, this.accessToken); } - } + }, + onUpdateCoverUrl(newValue) { + this.lesson.coverImage = newValue; + }, + onUpdateCoverId(newValue) { + this.lesson.coverImageId = newValue; + }, }, computed: { title() { @@ -120,10 +133,11 @@ 'block-images': BlockImages, 'block-video': BlockVideo, 'vue-draggable': Draggable, + 'lil-image': LilImage, } } \ No newline at end of file + diff --git a/web/src/img/og_blog.jpg b/web/src/img/og_blog.jpg new file mode 100644 index 00000000..cabead92 Binary files /dev/null and b/web/src/img/og_blog.jpg differ diff --git a/web/src/img/og_courses.jpg b/web/src/img/og_courses.jpg new file mode 100644 index 00000000..918718fe Binary files /dev/null and b/web/src/img/og_courses.jpg differ diff --git a/web/src/img/og_main.jpg b/web/src/img/og_main.jpg new file mode 100644 index 00000000..d9c04f59 Binary files /dev/null and b/web/src/img/og_main.jpg differ diff --git a/web/src/img/og_summer_school.jpg b/web/src/img/og_summer_school.jpg new file mode 100644 index 00000000..2adc8a7a Binary files /dev/null and b/web/src/img/og_summer_school.jpg differ diff --git a/web/src/js/modules/api.js b/web/src/js/modules/api.js index 59c98939..36dc5f99 100644 --- a/web/src/js/modules/api.js +++ b/web/src/js/modules/api.js @@ -204,6 +204,7 @@ export const api = { const isAdding = (!lessonObject.hasOwnProperty('id') || !lessonObject.hasOwnProperty('id')); const lessonJson = { + cover: lessonObject.coverImageId ? lessonObject.coverImageId : null, title: lessonObject.title, short_description: lessonObject.short_description, course: lessonObject.course_id, @@ -284,6 +285,8 @@ export const api = { id: lessonJSON.id, title: lessonJSON.title, short_description: lessonJSON.short_description, + coverImageId: lessonJSON.cover && lessonJSON.cover.id ? lessonJSON.cover.id : null, + coverImage: lessonJSON.cover && lessonJSON.cover.image ? lessonJSON.cover.image : null, content: api.convertContentResponse(lessonJSON.content) } }, diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 096e0b1b..0f732fa5 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -2648,8 +2648,15 @@ a.grey-link flex: 0 0 140px +m display: none + &__pic-wrapper + width: 130px; + height: 130px; + border-radius: 50%; + overflow: hidden; &__pic - display: block + top: 50%; + position: relative; + transform: translateY(-50%); width: 100% &__content flex: 0 0 calc(100% - 165px)