From 2c1c3ed0619549169d134433c9368e1467631c64 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 29 May 2019 13:38:18 +0300 Subject: [PATCH 01/28] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D0=B0=D0=BF=20=D0=B2?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B5=20=D0=B2=D0=B8=D0=B4=D0=B5?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/content/models.py | 10 +++++++++- apps/content/templates/content/blocks/video.html | 12 ++++++------ .../templates/school/livelesson_detail.html | 12 ++++++++++-- .../blocks/popup_school_lesson_ended.html | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 project/templates/blocks/popup_school_lesson_ended.html diff --git a/apps/content/models.py b/apps/content/models.py index d4135f12..872d8044 100644 --- a/apps/content/models.py +++ b/apps/content/models.py @@ -99,7 +99,7 @@ class Video(Content): url = models.URLField('Ссылка') def video_index(self): - if 'youtu.be' in self.url or 'youtube.com' in self.url and 'watch' in self.url: + if self.is_youtube_video: url = urlparse(self.url) query = url.query.split('&') for q in query: @@ -107,6 +107,14 @@ class Video(Content): return q.split('=')[-1] return self.url.split('/')[-1] + @property + def is_youtube_video(self): + return 'youtu.be' in self.url or 'youtube.com' in self.url and 'watch' in self.url + + @property + def is_vimeo_video(self): + return 'vimeo.com' in self.url + class Gallery(Content): pass diff --git a/apps/content/templates/content/blocks/video.html b/apps/content/templates/content/blocks/video.html index 8c707388..fc4bd60c 100644 --- a/apps/content/templates/content/blocks/video.html +++ b/apps/content/templates/content/blocks/video.html @@ -4,12 +4,12 @@ {{ content.title }}
- {% if 'youtube.com' in content.url or 'youtu.be' in content.url %} - - {% elif 'vimeo.com' in content.url %} - + {% elif content.is_vimeo_video %} + {% endif %}
diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html index 9ee47ad8..d7a8dcdb 100644 --- a/apps/school/templates/school/livelesson_detail.html +++ b/apps/school/templates/school/livelesson_detail.html @@ -33,6 +33,10 @@ width="720" height="400" webkitallowfullscreen mozallowfullscreen allowfullscreen> + + {% include 'templates/blocks/popup_school_lesson_ended.html' %} Если видео не загрузилось, - уменьшите качество видео или обновите страницу @@ -60,12 +64,13 @@ {% endblock content %} {% block foot %} + {% if livelesson.stream_index %} diff --git a/project/templates/blocks/popup_school_lesson_ended.html b/project/templates/blocks/popup_school_lesson_ended.html new file mode 100644 index 00000000..12404388 --- /dev/null +++ b/project/templates/blocks/popup_school_lesson_ended.html @@ -0,0 +1,15 @@ +{% load static %} + From 95083e82f76fd483ed20858d5ad0c6ae16ec5102 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 29 May 2019 19:46:55 +0300 Subject: [PATCH 02/28] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=D0=BE=D1=81=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BE?= =?UTF-8?q?=20=D1=81=20=D1=8E=D1=82=D1=83=D0=B1=D0=B0=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D0=B0=D0=BF=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/js/modules/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js index 1894241e..f1960d57 100644 --- a/web/src/js/modules/popup.js +++ b/web/src/js/modules/popup.js @@ -81,7 +81,7 @@ $(document).ready(function () { channel = 'youtube'; } if(url.indexOf('youtube.com') > -1 && url.indexOf('watch') > -1){ - const m = /[?&]v=([a-zA-Z]+)(&.)?/.exec(url); + const m = /[?&]v=([a-zA-Z\d]+)(&.)?/.exec(url); channel = 'youtube'; videoId = m && m[1]; } From 3c9bf7ff46a052ea1d84bc5aa40162b2da168d98 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 29 May 2019 20:22:08 +0300 Subject: [PATCH 03/28] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=D0=BE=D1=81=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BE?= =?UTF-8?q?=20=D1=81=20=D1=8E=D1=82=D1=83=D0=B1=D0=B0=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D0=B0=D0=BF=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/js/modules/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js index f1960d57..c774c6ef 100644 --- a/web/src/js/modules/popup.js +++ b/web/src/js/modules/popup.js @@ -81,7 +81,7 @@ $(document).ready(function () { channel = 'youtube'; } if(url.indexOf('youtube.com') > -1 && url.indexOf('watch') > -1){ - const m = /[?&]v=([a-zA-Z\d]+)(&.)?/.exec(url); + const m = /[?&]v=([^&]+)(&.+)?$/.exec(url); channel = 'youtube'; videoId = m && m[1]; } From 19faba4162da2700b7e493dfde8b88836970e900 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 29 May 2019 20:25:14 +0300 Subject: [PATCH 04/28] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=D0=BE=D1=81=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BE?= =?UTF-8?q?=20=D1=81=20=D1=8E=D1=82=D1=83=D0=B1=D0=B0=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D0=B0=D0=BF=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/templates/blocks/schedule_item.html | 4 ++-- project/templates/blocks/video.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/school/templates/blocks/schedule_item.html b/apps/school/templates/blocks/schedule_item.html index 593d0426..4de76462 100644 --- a/apps/school/templates/blocks/schedule_item.html +++ b/apps/school/templates/blocks/schedule_item.html @@ -7,7 +7,7 @@
{{ school_schedule }} {% if not is_purchased and request.user_agent.is_mobile and school_schedule.trial_lesson %} - Пробный урок + Пробный урок {% endif %}
{% if is_purchased and live_lesson %} @@ -25,7 +25,7 @@ {% endif %} {% endif %} {% if not is_purchased and not request.user_agent.is_mobile and school_schedule.trial_lesson and not is_drawing_camp %} - Пробный урок + Пробный урок {% endif %} diff --git a/project/templates/blocks/video.html b/project/templates/blocks/video.html index c0eebf5a..2d1fcada 100644 --- a/project/templates/blocks/video.html +++ b/project/templates/blocks/video.html @@ -1,10 +1,10 @@
Пробный урок
- Смотреть бесплатно -
Много развивающих видео на нашем YouTube канале
+ data-video-url="{{ config.MAIN_PAGE_VIDEO_URL|safe }}" data-trial-lesson="1">Смотреть бесплатно +
Много развивающих видео на нашем YouTube канале
From 46066fda9ca37ff20a3cfeabc783443a51eff5a3 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 30 May 2019 16:59:43 +0300 Subject: [PATCH 05/28] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D0=B0=D0=BF=20=D0=B2?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B5=20=D0=B2=D0=B8=D0=B4=D0=B5?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/school/livelesson_detail.html | 22 +++++------ .../blocks/popup_school_lesson_ended.html | 15 ++----- web/src/js/app.js | 1 - web/src/js/modules/content.js | 39 +++++++++++++++++++ web/src/js/pages/live-lesson.js | 1 + web/src/js/utils.js | 13 +++++-- web/src/sass/_common.sass | 12 ++++++ web/webpack.config.js | 1 + 8 files changed, 77 insertions(+), 27 deletions(-) create mode 100644 web/src/js/modules/content.js create mode 100644 web/src/js/pages/live-lesson.js diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html index d7a8dcdb..555cb6ef 100644 --- a/apps/school/templates/school/livelesson_detail.html +++ b/apps/school/templates/school/livelesson_detail.html @@ -17,11 +17,12 @@ {% block head %} {% if livelesson.stream_index %} - + {% endif %} {% endblock head %} {% block content %} +{% include 'templates/blocks/popup_school_lesson_ended.html' %}
@@ -33,10 +34,6 @@ width="720" height="400" webkitallowfullscreen mozallowfullscreen allowfullscreen> - - {% include 'templates/blocks/popup_school_lesson_ended.html' %} Если видео не загрузилось, - уменьшите качество видео или обновите страницу @@ -64,9 +61,11 @@ {% endblock content %} {% block foot %} - + + {% if livelesson.stream_index %} {% endif %} {% endblock foot %} diff --git a/project/templates/blocks/popup_school_lesson_ended.html b/project/templates/blocks/popup_school_lesson_ended.html index 12404388..65e901de 100644 --- a/project/templates/blocks/popup_school_lesson_ended.html +++ b/project/templates/blocks/popup_school_lesson_ended.html @@ -1,15 +1,6 @@ {% load static %} -