morning fixes

remotes/origin/hasaccess
Sanasol 8 years ago
parent 7ebec2b114
commit 57f8f92e7e
  1. 47
      web/src/components/CourseRedactor.vue
  2. 10
      web/src/components/LessonsAdmin.vue
  3. 30
      web/src/components/directives/autosize.js
  4. 2
      web/src/js/course-redactor.js
  5. 3
      web/src/js/modules/api.js
  6. 6
      web/src/sass/_common.sass

@ -25,11 +25,11 @@
<div class="info__title"> <div class="info__title">
<div class="info__field field field_info" <div class="info__field field field_info"
v-bind:class="{ error: ($v.course.title.$dirty || showErrors) && $v.course.title.$invalid }"> v-bind:class="{ error: ($v.course.title.$dirty || showErrors) && $v.course.title.$invalid }">
<div class="field__label">НАЗВАНИЕ КУРСА</div> <div class="field__label">{{titles.courseTitle}}</div>
<div class="field__wrap"> <div class="field__wrap">
<textarea class="field__textarea field__textarea_lg" <textarea class="field__textarea"
rows="1" rows="1"
title="Название курса" :title="titles.courseTitle"
v-autosize="course.title" v-autosize="course.title"
@change="onCourseNameInput" @change="onCourseNameInput"
v-model="course.title"></textarea> v-model="course.title"></textarea>
@ -37,11 +37,9 @@
</div> </div>
<div class="info__field field field_info" <div class="info__field field field_info"
v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }"> v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }">
<div class="field__label">КРАТКО О КУРСЕ</div> <div class="field__label">{{titles.shortDescription}}</div>
<div class="field__wrap"> <div class="field__wrap">
<textarea class="field__input" <textarea class="field__textarea"
rows="1"
placeholder="Кратко о курсе"
v-autosize="course.short_description" v-autosize="course.short_description"
@input="$v.course.short_description.$touch()" @input="$v.course.short_description.$touch()"
v-model="course.short_description"></textarea> v-model="course.short_description"></textarea>
@ -291,6 +289,7 @@
props: ["authorName", "authorPicture", "accessToken", "courseId", "live"], props: ["authorName", "authorPicture", "accessToken", "courseId", "live"],
data() { data() {
return { return {
titles: {},
mounting: false, mounting: false,
viewSection: 'course', viewSection: 'course',
me: null, me: null,
@ -635,17 +634,18 @@
if(this.validate()) { if(this.validate()) {
const publishButton = $('#course-redactor__publish-button'); const publishButton = $('#course-redactor__publish-button');
publishButton.attr('disabled', 'disabled'); publishButton.attr('disabled', 'disabled');
api.publishCourse(this.course.id, this.accessToken)
.then((response) => { if(this.live) {
if(this.live) { window.location = '/school/lessons';
window.location = '/school/lessons'; } else {
} else { api.publishCourse(this.course.id, this.accessToken)
window.location = '/course/on-moderation'; .then((response) => {
} window.location = '/course/on-moderation';
}) })
.catch(() => { .catch(() => {
publishButton.removeAttr('disabled'); publishButton.removeAttr('disabled');
}); });
}
} }
}, },
validate(silent) { validate(silent) {
@ -802,6 +802,15 @@
mounted() { mounted() {
this.mounting = true; this.mounting = true;
moment.locale('ru'); moment.locale('ru');
this.titles['courseTitle'] = 'НАЗВАНИЕ КУРСА';
this.titles['shortDescription'] = 'КРАТКО О КУРСЕ';
if(this.live) {
this.titles['courseTitle'] = 'НАЗВАНИЕ УРОКА';
this.titles['shortDescription'] = 'КРАТКО ОБ УРОКЕ';
}
this.course.live = this.live; this.course.live = this.live;
// Listen for changes to the current location. // Listen for changes to the current location.
this.unlisten = history.listen(this.updateViewSection); this.unlisten = history.listen(this.updateViewSection);
@ -823,7 +832,7 @@
}); });
if(this.live) { if(this.live) {
let schedule = api.getSchedule(this.accessToken); let schedule = api.getSchedule(this.accessToken, {live_lesson_exist: false});
promises.push(schedule); promises.push(schedule);
schedule.then((response) => { schedule.then((response) => {

@ -4,11 +4,11 @@
<div class="lessons__list"> <div class="lessons__list">
<div class="lessons__item" v-for="(lesson, index) in lessons"> <div class="lessons__item" v-for="(lesson, index) in lessons">
<div class="lessons__actions lessons__actions__no-hover"> <div class="lessons__actions lessons__actions__no-hover">
<button type="button" class="lessons__action" @click="removeLesson(lesson.pk)"> <!--<button type="button" class="lessons__action" @click="removeLesson(lesson.pk)">-->
<svg class="icon icon-delete"> <!--<svg class="icon icon-delete">-->
<use xlink:href="/static/img/sprite.svg#icon-delete"></use> <!--<use xlink:href="/static/img/sprite.svg#icon-delete"></use>-->
</svg> <!--</svg>-->
</button> <!--</button>-->
<button type="button" class="lessons__action" @click="editLesson(lesson.pk)"> <button type="button" class="lessons__action" @click="editLesson(lesson.pk)">
<svg class="icon icon-edit"> <svg class="icon icon-edit">
<use xlink:href="/static/img/sprite.svg#icon-edit"></use> <use xlink:href="/static/img/sprite.svg#icon-edit"></use>

@ -0,0 +1,30 @@
var autosize = require('autosize')
var autoSizeInput = require('autosize-input')
exports.install = function(Vue) {
Vue.directive('autosize', {
bind: function(el, binding) {
Vue.nextTick(function() {
var tagName = el.tagName
if (tagName == 'TEXTAREA') {
autosize(el)
} else if (tagName == 'INPUT' && el.type == 'text') {
autoSizeInput(el)
}
})
},
componentUpdated: function(el, binding, vnode) {
Vue.nextTick(function() {
var tagName = el.tagName
if (tagName == 'TEXTAREA') {
autosize.update(el)
}
})
},
unbind: function(el) {
autosize.destroy(el)
}
})
}

@ -1,5 +1,5 @@
import Vue from 'vue' import Vue from 'vue'
import VueAutosize from 'vue-autosize' import VueAutosize from '../components/directives/autosize'
import Vuelidate from 'vuelidate' import Vuelidate from 'vuelidate'
import 'babel-polyfill' import 'babel-polyfill'
import CourseRedactor from '../components/CourseRedactor.vue' import CourseRedactor from '../components/CourseRedactor.vue'

@ -457,8 +457,9 @@ export const api = {
} }
}); });
}, },
getSchedule: (accessToken) => { getSchedule: (accessToken, params) => {
return axios.get('/api/v1/school-schedules/', { return axios.get('/api/v1/school-schedules/', {
params: params,
headers: { headers: {
'Authorization': `Token ${accessToken}`, 'Authorization': `Token ${accessToken}`,
} }

@ -1995,7 +1995,7 @@ a.grey-link
&__head &__head
position: relative position: relative
height: 36px height: 36px
border-bottom: 1px solid $border border-bottom: 1px solid rgba(82, 82, 82, 0.2)
transition: border-color .2s transition: border-color .2s
font-size: 18px font-size: 18px
line-height: 36px line-height: 36px
@ -3292,8 +3292,8 @@ a.grey-link
&__fieldset &__fieldset
&:first-child &:first-child
margin-bottom: 50px margin-bottom: 50px
&:last-child //&:last-child
margin-top: auto // margin-top: auto
&:only-child &:only-child
margin-top: 0px margin-top: 0px

Loading…
Cancel
Save