diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 07634b1a..62ad1a2c 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -158,16 +158,35 @@ {% endif %} -
+ +
-
@@ -392,14 +411,32 @@
diff --git a/web/src/components/CourseRedactor.vue b/web/src/components/CourseRedactor.vue index dfdb2678..2f2fd7fb 100644 --- a/web/src/components/CourseRedactor.vue +++ b/web/src/components/CourseRedactor.vue @@ -334,6 +334,7 @@ ], showErrors: false, savingTimeout: null, + savingDebounceTimeout: null, categoryOptions: [], courseSyncHook: false, // Если true, то watch не будет отправлять курс на обновление } @@ -519,30 +520,35 @@ let newTab = window.open(`/course/${this.course.id}`, '_blank'); newTab.focus(); }, - saveCourseDraft: debounce(function (newValue, oldValue) { + saveCourseDraft: function (newValue, oldValue) { if (!oldValue.id) { return; } - this.courseSaving = true; - clearTimeout(this.savingTimeout); - document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНИЕ'; - api.saveCourse(this.course, this.accessToken) - .then((response) => { - this.courseSaving = false; - document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНО'; - this.savingTimeout = setTimeout(() => { - document.getElementById('course-redactor__saving-status').innerText = ''; - }, 2000); - this.courseSyncHook = true; - this.course = api.convertCourseJson(response.data); - this.$nextTick(() => { - this.courseSyncHook = false; + if (this.savingDebounceTimeout) { + clearTimeout(this.savingDebounceTimeout); + } + this.savingDebounceTimeout = setTimeout(() => { + this.courseSaving = true; + clearTimeout(this.savingTimeout); + document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНИЕ'; + api.saveCourse(this.course, this.accessToken) + .then((response) => { + this.courseSaving = false; + document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНО'; + this.savingTimeout = setTimeout(() => { + document.getElementById('course-redactor__saving-status').innerText = ''; + }, 2000); + this.courseSyncHook = true; + this.course = api.convertCourseJson(response.data); + this.$nextTick(() => { + this.courseSyncHook = false; + }) }) - }) - .catch((err) => { - this.courseSaving = false; - }); - }, 2000) + .catch((err) => { + this.courseSaving = false; + }); + }, 2000); + } }, mounted() { api.getCategories(this.accessToken) diff --git a/web/src/js/modules/api.js b/web/src/js/modules/api.js index 0dbff28e..22ec85d8 100644 --- a/web/src/js/modules/api.js +++ b/web/src/js/modules/api.js @@ -64,6 +64,7 @@ export const api = { const courseJson = { title: courseObject.title, + author: courseObject.author ? courseObject.author : null, short_description: courseObject.short_description, category: courseObject.category, price: courseObject.is_paid ? courseObject.price : 0, @@ -237,9 +238,10 @@ export const api = { return { id: courseJSON.id, title: courseJSON.title, + author: courseJSON.author, short_description: courseJSON.short_description, - category: courseJSON.category.id ? courseJSON.category.id : courseJSON.category, - author: courseJSON.author.id ? courseJSON.author.id : courseJSON.author, + category: courseJSON.category && courseJSON.category.id ? courseJSON.category.id : courseJSON.category, + author: courseJSON.author && courseJSON.author.id ? courseJSON.author.id : courseJSON.author, price: parseFloat(courseJSON.price), is_paid: parseFloat(courseJSON.price) > 0, is_deferred: isDeferred, diff --git a/web/src/js/modules/courses.js b/web/src/js/modules/courses.js index 8463c4c3..90ffeb97 100644 --- a/web/src/js/modules/courses.js +++ b/web/src/js/modules/courses.js @@ -3,7 +3,7 @@ import moment from 'moment'; import createHistory from 'history/createBrowserHistory'; // Likely -import 'ilyabirman-likely/release/likely.css'; +// import 'ilyabirman-likely/release/likely.css'; import 'ilyabirman-likely/release/likely.js'; moment.locale('ru'); diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 0f733bc1..003754f4 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -2575,6 +2575,8 @@ a.grey-link margin-right: 20px .icon font-size: 40px + span:first-child + display: none; &_sm &__title margin-bottom: 15px &_sm &__item