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

@ -4,11 +4,11 @@
<div class="lessons__list">
<div class="lessons__item" v-for="(lesson, index) in lessons">
<div class="lessons__actions lessons__actions__no-hover">
<button type="button" class="lessons__action" @click="removeLesson(lesson.pk)">
<svg class="icon icon-delete">
<use xlink:href="/static/img/sprite.svg#icon-delete"></use>
</svg>
</button>
<!--<button type="button" class="lessons__action" @click="removeLesson(lesson.pk)">-->
<!--<svg class="icon icon-delete">-->
<!--<use xlink:href="/static/img/sprite.svg#icon-delete"></use>-->
<!--</svg>-->
<!--</button>-->
<button type="button" class="lessons__action" @click="editLesson(lesson.pk)">
<svg class="icon icon-edit">
<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 VueAutosize from 'vue-autosize'
import VueAutosize from '../components/directives/autosize'
import Vuelidate from 'vuelidate'
import 'babel-polyfill'
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/', {
params: params,
headers: {
'Authorization': `Token ${accessToken}`,
}

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

Loading…
Cancel
Save