Merge branch 'dev' of gitlab.com:lilcity/backend into dev

remotes/origin/hasaccess
Ivlev Denis 8 years ago
commit b86435ff71
  1. 71
      apps/course/templates/course/course.html
  2. 46
      web/src/components/CourseRedactor.vue
  3. 6
      web/src/js/modules/api.js
  4. 2
      web/src/js/modules/courses.js
  5. 2
      web/src/sass/_common.sass

@ -158,16 +158,35 @@
</svg> </svg>
{% endif %} {% endif %}
</a> </a>
<div class="course__share share share_sm">
<div class="share">
<div class="share__title">Поделиться курсом</div> <div class="share__title">Поделиться курсом</div>
<div class="share__list"> <div class="share__list likely">
<div class="likely"> <!--<a class="share__item vkontakte" href="#">-->
<div class="facebook">Facebook</div> <!--<svg class="icon icon-share-facebook">-->
<div class="twitter">Twitter</div> <!--<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-vkontakte"></use>-->
<div class="gplus">Google+</div> <!--</svg>-->
<div class="vkontakte">VK</div> <!--</a>-->
<div class="pinterest">Pinterest</div> <a class="share__item facebook" href="#">
</div> <svg class="icon icon-share-facebook">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-facebook"></use>
</svg>
</a>
<a class="share__item twitter" href="#">
<svg class="icon icon-share-twitter">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-twitter"></use>
</svg>
</a>
<a class="share__item gplus" href="#">
<svg class="icon icon-share-google">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-google"></use>
</svg>
</a>
<a class="share__item pinterest" href="#">
<svg class="icon icon-share-pinterest">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-pinterest"></use>
</svg>
</a>
</div> </div>
</div> </div>
</div> </div>
@ -392,14 +411,32 @@
<div class="section__center center center_sm"> <div class="section__center center center_sm">
<div class="share"> <div class="share">
<div class="share__title">Поделиться курсом</div> <div class="share__title">Поделиться курсом</div>
<div class="share__list"> <div class="share__list likely">
<div class="likely"> <!--<a class="share__item vkontakte" href="#">-->
<div class="facebook">Facebook</div> <!--<svg class="icon icon-share-facebook">-->
<div class="twitter">Twitter</div> <!--<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-vkontakte"></use>-->
<div class="gplus">Google+</div> <!--</svg>-->
<div class="vkontakte">VK</div> <!--</a>-->
<div class="pinterest">Pinterest</div> <a class="share__item facebook" href="#">
</div> <svg class="icon icon-share-facebook">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-facebook"></use>
</svg>
</a>
<a class="share__item twitter" href="#">
<svg class="icon icon-share-twitter">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-twitter"></use>
</svg>
</a>
<a class="share__item gplus" href="#">
<svg class="icon icon-share-google">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-google"></use>
</svg>
</a>
<a class="share__item pinterest" href="#">
<svg class="icon icon-share-pinterest">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-pinterest"></use>
</svg>
</a>
</div> </div>
</div> </div>
</div> </div>

@ -334,6 +334,7 @@
], ],
showErrors: false, showErrors: false,
savingTimeout: null, savingTimeout: null,
savingDebounceTimeout: null,
categoryOptions: [], categoryOptions: [],
courseSyncHook: false, // Если true, то watch не будет отправлять курс на обновление courseSyncHook: false, // Если true, то watch не будет отправлять курс на обновление
} }
@ -519,30 +520,35 @@
let newTab = window.open(`/course/${this.course.id}`, '_blank'); let newTab = window.open(`/course/${this.course.id}`, '_blank');
newTab.focus(); newTab.focus();
}, },
saveCourseDraft: debounce(function (newValue, oldValue) { saveCourseDraft: function (newValue, oldValue) {
if (!oldValue.id) { if (!oldValue.id) {
return; return;
} }
this.courseSaving = true; if (this.savingDebounceTimeout) {
clearTimeout(this.savingTimeout); clearTimeout(this.savingDebounceTimeout);
document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНИЕ'; }
api.saveCourse(this.course, this.accessToken) this.savingDebounceTimeout = setTimeout(() => {
.then((response) => { this.courseSaving = true;
this.courseSaving = false; clearTimeout(this.savingTimeout);
document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНО'; document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНИЕ';
this.savingTimeout = setTimeout(() => { api.saveCourse(this.course, this.accessToken)
document.getElementById('course-redactor__saving-status').innerText = ''; .then((response) => {
}, 2000); this.courseSaving = false;
this.courseSyncHook = true; document.getElementById('course-redactor__saving-status').innerText = 'СОХРАНЕНО';
this.course = api.convertCourseJson(response.data); this.savingTimeout = setTimeout(() => {
this.$nextTick(() => { document.getElementById('course-redactor__saving-status').innerText = '';
this.courseSyncHook = false; }, 2000);
this.courseSyncHook = true;
this.course = api.convertCourseJson(response.data);
this.$nextTick(() => {
this.courseSyncHook = false;
})
}) })
}) .catch((err) => {
.catch((err) => { this.courseSaving = false;
this.courseSaving = false; });
}); }, 2000);
}, 2000) }
}, },
mounted() { mounted() {
api.getCategories(this.accessToken) api.getCategories(this.accessToken)

@ -64,6 +64,7 @@ export const api = {
const courseJson = { const courseJson = {
title: courseObject.title, title: courseObject.title,
author: courseObject.author ? courseObject.author : null,
short_description: courseObject.short_description, short_description: courseObject.short_description,
category: courseObject.category, category: courseObject.category,
price: courseObject.is_paid ? courseObject.price : 0, price: courseObject.is_paid ? courseObject.price : 0,
@ -237,9 +238,10 @@ export const api = {
return { return {
id: courseJSON.id, id: courseJSON.id,
title: courseJSON.title, title: courseJSON.title,
author: courseJSON.author,
short_description: courseJSON.short_description, short_description: courseJSON.short_description,
category: courseJSON.category.id ? courseJSON.category.id : courseJSON.category, category: courseJSON.category && courseJSON.category.id ? courseJSON.category.id : courseJSON.category,
author: courseJSON.author.id ? courseJSON.author.id : courseJSON.author, author: courseJSON.author && courseJSON.author.id ? courseJSON.author.id : courseJSON.author,
price: parseFloat(courseJSON.price), price: parseFloat(courseJSON.price),
is_paid: parseFloat(courseJSON.price) > 0, is_paid: parseFloat(courseJSON.price) > 0,
is_deferred: isDeferred, is_deferred: isDeferred,

@ -3,7 +3,7 @@ import moment from 'moment';
import createHistory from 'history/createBrowserHistory'; import createHistory from 'history/createBrowserHistory';
// Likely // Likely
import 'ilyabirman-likely/release/likely.css'; // import 'ilyabirman-likely/release/likely.css';
import 'ilyabirman-likely/release/likely.js'; import 'ilyabirman-likely/release/likely.js';
moment.locale('ru'); moment.locale('ru');

@ -2575,6 +2575,8 @@ a.grey-link
margin-right: 20px margin-right: 20px
.icon .icon
font-size: 40px font-size: 40px
span:first-child
display: none;
&_sm &__title &_sm &__title
margin-bottom: 15px margin-bottom: 15px
&_sm &__item &_sm &__item

Loading…
Cancel
Save