diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html
index 05360776..42757ddc 100644
--- a/apps/course/templates/course/_items.html
+++ b/apps/course/templates/course/_items.html
@@ -7,7 +7,7 @@
data-course data-course-id={{ course.id }}
{% if course.is_deferred_start and course.status == 2 %}data-future-course data-future-course-time={{ course.deferred_start_at.timestamp }}{% endif %}
>
-
+
{% thumbnail course.cover.image "300x200" crop="center" as im %}
{% empty %}
diff --git a/web/src/components/CourseRedactor.vue b/web/src/components/CourseRedactor.vue
index 2483dc01..2004e0aa 100644
--- a/web/src/components/CourseRedactor.vue
+++ b/web/src/components/CourseRedactor.vue
@@ -552,17 +552,21 @@
},
onLessonSubmit() {
if(!this.validateLesson()) {
- return;
+ return new Promise(function(resolve, reject) {
+ reject('validation reject');
+ });
}
+ showNotification("success", "Момент, вносим последние правки!");
- this.saveLesson();
+ return this.saveLesson();
},
saveLesson() {
this.lessonSaving = true;
const currentLessonId = this.currentLesson.id;
this.currentLesson.course_id = this.course.id;
- api.saveLesson(this.currentLesson, this.accessToken)
- .then((response) => {
+ let req = api.saveLesson(this.currentLesson, this.accessToken);
+
+ req.then((response) => {
const newLesson = api.convertLessonJson(response.data);
newLesson.course_id = this.course.id;
this.currentLesson = newLesson;
@@ -583,7 +587,7 @@
}, 2000);
showNotification("success", 'Урок сохранён');
- this.goToLessons();
+ // this.goToLessons();
this.lessonSaving = false;
})
@@ -604,6 +608,8 @@
}
}
});
+
+ return req;
},
goToLessons() {
history.push("/course/create/lessons");
@@ -729,8 +735,17 @@
if(this.course.id) {
let url;
- if(this.currentLesson && this.currentLesson.id) {
- url = `/lesson/${this.currentLesson.id}`;
+ if(this.viewSection === 'lessons-edit') {
+ this.onLessonSubmit().then(()=>{
+ url = `/lesson/${this.currentLesson.id}`;
+
+ let newTab = window.open(url, '_blank');
+ newTab.focus();
+ }).catch((e)=>{
+ // showNotification("error", "Пока еще нечего посмотреть, давайте что-нибудь напишем");
+
+ console.log(e);
+ });
} else {
if(this.live) {
url = `/school/lessons/${this.course.id}`;
@@ -740,10 +755,10 @@
}
url = `/course/${this.course.id}`;
}
- }
- let newTab = window.open(url, '_blank');
- newTab.focus();
+ let newTab = window.open(url, '_blank');
+ newTab.focus();
+ }
} else {
showNotification("error", "Пока еще нечего посмотреть, давайте что-нибудь напишем");
}