diff --git a/api/v1/serializers/school.py b/api/v1/serializers/school.py index a84c745e..4f8cd318 100644 --- a/api/v1/serializers/school.py +++ b/api/v1/serializers/school.py @@ -55,6 +55,7 @@ class SchoolScheduleSerializer(serializers.ModelSerializer): 'start_at', 'schoolschedule_images', 'cover', + 'trial_lesson', ) read_only_fields = ( @@ -114,6 +115,7 @@ class SchoolScheduleSerializerImg(serializers.ModelSerializer): 'start_at', 'schoolschedule_images', 'cover', + 'trial_lesson', ) read_only_fields = ( diff --git a/api/v1/serializers/user.py b/api/v1/serializers/user.py index 888806d0..bbb5e6b5 100644 --- a/api/v1/serializers/user.py +++ b/api/v1/serializers/user.py @@ -42,6 +42,7 @@ class UserSerializer(serializers.ModelSerializer): 'photo', 'balance', 'show_in_mainpage', + 'trial_lesson', ) read_only_fields = ( diff --git a/apps/school/migrations/0021_schoolschedule_trial_lesson.py b/apps/school/migrations/0021_schoolschedule_trial_lesson.py new file mode 100644 index 00000000..293101a3 --- /dev/null +++ b/apps/school/migrations/0021_schoolschedule_trial_lesson.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.6 on 2018-08-27 21:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('school', '0020_auto_20180824_2132'), + ] + + operations = [ + migrations.AddField( + model_name='schoolschedule', + name='trial_lesson', + field=models.URLField(blank=True, default=''), + ), + ] diff --git a/apps/school/models.py b/apps/school/models.py index d1f70e68..a059172f 100644 --- a/apps/school/models.py +++ b/apps/school/models.py @@ -46,6 +46,7 @@ class SchoolSchedule(models.Model): null=True, blank=True, ) + trial_lesson = models.URLField(default='', blank=True) class Meta: ordering = ('weekday',) diff --git a/apps/school/templates/blocks/schedule_item.html b/apps/school/templates/blocks/schedule_item.html index c6be7c14..e4774339 100644 --- a/apps/school/templates/blocks/schedule_item.html +++ b/apps/school/templates/blocks/schedule_item.html @@ -17,6 +17,9 @@ {% else %} {% include './day_pay_btn.html' %} {% endif %} + {% if school_schedule.trial_lesson %} + Пробный урок + {% endif %} {% comment %} diff --git a/project/templates/blocks/popup_buy.html b/project/templates/blocks/popup_buy.html index d3080ec9..8f625f90 100644 --- a/project/templates/blocks/popup_buy.html +++ b/project/templates/blocks/popup_buy.html @@ -37,6 +37,11 @@ {% comment %} dont delete {% endcomment %} {{ school_schedule.title }} + + {% if school_schedule.trial_lesson %} + Пробный урок + {% endif %} + {{school_schedule.month_price}}р в мес. @@ -58,6 +63,11 @@ {% comment %} dont delete {% endcomment %} {{ school_schedule.title }} + + {% if school_schedule.trial_lesson %} + Пробный урок + {% endif %} + {{school_schedule.month_price}}р в мес. diff --git a/project/templates/blocks/teachers.html b/project/templates/blocks/teachers.html index 4cea46f3..492ca66d 100644 --- a/project/templates/blocks/teachers.html +++ b/project/templates/blocks/teachers.html @@ -25,7 +25,7 @@ {% endif %} {% if teacher.trial_lesson %} - ПРОБНЫЙ УРОК + ПРОБНЫЙ УРОК {% endif %}
diff --git a/web/package.json b/web/package.json index 7a93432c..abca665a 100755 --- a/web/package.json +++ b/web/package.json @@ -46,6 +46,7 @@ "inputmask": "^3.3.11", "jquery": "^3.3.1", "lodash.debounce": "^4.0.8", + "modal-video": "^2.4.2", "moment": "^2.20.1", "owl.carousel": "^2.2.0", "slugify": "^1.2.9", diff --git a/web/src/js/app.js b/web/src/js/app.js index ff6f5609..69f737c7 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -3,6 +3,8 @@ */ import 'ilyabirman-likely/release/likely.js'; import 'ilyabirman-likely/release/likely.css'; +import "modal-video/js/jquery-modal-video.min.js"; +import "modal-video/css/modal-video.min.css"; import "./modules/common"; import "./modules/header"; import "./modules/search"; diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js index 425f81cd..ba714c68 100644 --- a/web/src/js/modules/popup.js +++ b/web/src/js/modules/popup.js @@ -2,6 +2,30 @@ import $ from 'jquery'; var selectedWeekdays = {}; $(document).ready(function () { + $(".js-video-modal").each(function(){ + const $this = $(this); + const url = $this.data('video-url'); + let data; + let videoId; + let channel; + if(url.indexOf('youtu.be') > -1){ + videoId = url.split('youtu.be/')[1]; + channel = 'youtube'; + } + if(url.indexOf('youtube.com') > -1 && url.indexOf('watch') > -1){ + const m = /[?&]v=([a-zA-Z]+)(&.)?/.exec(url); + channel = 'youtube'; + videoId = m && m[1]; + } + if(url.indexOf('vimeo.com') > -1){ + const split = url.split('/'); + channel = 'vimeo'; + videoId = split[split.length - 1]; + } + $this.data('videoId', videoId); + $this.modalVideo({ channel }); + }); + let body = $('body'), popup; @@ -152,4 +176,4 @@ $(document).ready(function () { } updateCart(); -}); \ No newline at end of file +}); diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 5ccc6d83..21931e4c 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -1850,7 +1850,7 @@ a.grey-link &:nth-child(2) flex: 0 0 60px &:nth-child(3) - flex: 0 0 calc(100% - 290px) + flex: 1 +t padding: 0 flex: 0 0 calc(100% - 120px) @@ -2959,6 +2959,12 @@ a.grey-link width: 275px +m width: 100% + &__trial-lesson + +m + position: absolute; + right: 0; + padding: 0; + top: 9px; .order padding: 2px @@ -3862,6 +3868,12 @@ a.grey-link +m flex: 1 0 0 text-align: right + &__trial-lesson + display: inline-block + margin-top: 10px + +m + display: block + margin-bottom: -31px &__time margin: 15px 0 opacity: .5 @@ -4167,3 +4179,7 @@ a border-left: 3px solid transparent border-radius: 50% animation: loading .6s infinite linear + +.modal-video-close-btn + +m + right: 0