проблема с сохранением содержимого курсов

remotes/origin/hotfix/course_save_error_27-01-19
gzbender 7 years ago
parent 3c8bf468d6
commit 9576c3cd25
  1. 9
      apps/course/templates/course/course_edit.html
  2. 7
      project/templates/lilcity/edit_index.html
  3. 7
      web/src/components/CourseRedactor.vue
  4. 5
      web/src/js/modules/api.js

@ -7,6 +7,15 @@
Создание {% if live == 'true' %}стрима{% else %}курса{% endif %}
{% endif %}
{% endblock title%}
{% block header_buttons %}
{% if live == 'true' %}
<button id="course-redactor__publish-button" class="header__btn btn" disabled>Сохранить</button>
{% else %}
<button id="course-redactor__publish-button" class="header__btn btn" disabled>На модерацию</button>
{% endif %}
{% endblock header_buttons %}
{% block content %}
<course-redactor :live="{{ live }}" author-picture="{% if request.user.photo %}{{ request.user.photo.url }}{% else %}{% static 'img/user_default.jpg' %}{% endif %}"
author-name="{{ request.user.first_name }} {{ request.user.last_name }}"

@ -53,11 +53,8 @@
<use xlink:href="{% static 'img/sprite.svg' %}#icon-eye"></use>
</svg>
</button>
{% if live == 'true' %}
<button id="course-redactor__publish-button" class="header__btn btn" disabled>Сохранить</button>
{% else %}
<button id="course-redactor__publish-button" class="header__btn btn" disabled>На модерацию</button>
{% endif %}
{% block header_buttons %}
{% endblock header_buttons %}
</div>
{% include 'templates/blocks/user_menu.html' %}
</div>

@ -34,7 +34,8 @@
v-model="course.title"
placeholder="Добавить заголовок"></textarea>
</div>
<div class="courses__content field" v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }">
<div class="courses__content field" style="width: 300px;"
v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }">
<vue-redactor :value.sync="course.short_description" placeholder="Добавить краткое описание"/>
</div>
</div>
@ -663,7 +664,7 @@
if(this.live) {
window.location = '/school/lessons';
} else {
api.publishCourse(this.course.id, this.accessToken)
api.publishCourse(this.course, this.accessToken)
.then((response) => {
window.location = '/course/on-moderation';
})
@ -1006,7 +1007,7 @@
},
courseFullUrl() {
let suffix = this.course.slug || this.course.id || 'ваша_ссылка';
return `https://lil.city/course/${suffix}`;
return `https://lil.school/course/${suffix}`;
},
},
beforeDestroy() {

@ -437,8 +437,9 @@ export const api = {
}
});
},
publishCourse: (courseId, accessToken) => {
return api.patch(`/api/v1/courses/${courseId}/`, {status: 1}, {
publishCourse: (course, accessToken) => {
course.status = 1;
return api.patch(`/api/v1/courses/${course.id}/`, course, {
headers: {
'Authorization': `Token ${accessToken}`,
}

Loading…
Cancel
Save