Merge branch 'dev' into 'master'

updated at field, lesson save before preview, moderation status to edit

See merge request lilcity/backend!36
remotes/origin/hasaccess
cfwme 8 years ago
commit 01f1278e1b
  1. 2
      apps/course/templates/course/_items.html
  2. 35
      web/src/components/CourseRedactor.vue

@ -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 %}
>
<a class="courses__preview" href="{% if course.status == 0 %}{% url 'course_edit' course.id %}{% else %}{% url 'course' course.id %}?next={{ request.get_full_path }}{% endif %}">
<a class="courses__preview" href="{% if course.status <= 1 %}{% url 'course_edit' course.id %}{% else %}{% url 'course' course.id %}?next={{ request.get_full_path }}{% endif %}">
{% thumbnail course.cover.image "300x200" crop="center" as im %}
<img class="courses__pic" src="{{ im.url }}" width="{{ im.width }}" />
{% empty %}

@ -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", "Пока еще нечего посмотреть, давайте что-нибудь напишем");
}

Loading…
Cancel
Save