Merge branch 'master' of https://gitlab.com/lilcity/backend into feature/LIL-670
commit
98c3462179
25 changed files with 336 additions and 705 deletions
@ -1,9 +1,5 @@ |
|||||||
<a |
<a |
||||||
{% if not user.is_authenticated %} |
data-popup=".js-popup-buy" data-prolong="1" data-date-start="{{ prolong_date_start|date:'Y-m-d' }}" |
||||||
data-popup=".js-popup-auth" |
|
||||||
{% else %} |
|
||||||
data-popup=".js-popup-buy" |
|
||||||
{% endif %} |
|
||||||
class="casing__btn btn{% if pink %} btn_pink{% endif %}" |
class="casing__btn btn{% if pink %} btn_pink{% endif %}" |
||||||
href="#" |
href="#" |
||||||
>продлить</a> |
>продлить</a> |
||||||
|
|||||||
@ -0,0 +1,87 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<vue-draggable :list="content" @start="drag=true" @end="drag=false" :options="{ handle: '.sortable__handle' }"> |
||||||
|
<div v-for="(block, index) in content" :key="block.id ? block.id : block.uuid"> |
||||||
|
<block-text v-if="block.type === 'text'" |
||||||
|
:index="index" |
||||||
|
:title.sync="block.data.title" |
||||||
|
:text.sync="block.data.text" |
||||||
|
v-on:remove="onBlockRemoved"/> |
||||||
|
<block-image-text v-if="block.type === 'image-text'" |
||||||
|
:index="index" |
||||||
|
:title.sync="block.data.title" |
||||||
|
:text.sync="block.data.text" |
||||||
|
:image-id.sync="block.data.image_id" |
||||||
|
:image-url.sync="block.data.image_thumbnail_url" |
||||||
|
v-on:remove="onBlockRemoved" |
||||||
|
:access-token="$root.store.accessToken"/> |
||||||
|
<block-image v-if="block.type === 'image'" |
||||||
|
:index="index" |
||||||
|
:title.sync="block.data.title" |
||||||
|
:image-id.sync="block.data.image_id" |
||||||
|
:image-url.sync="block.data.image_thumbnail_url" |
||||||
|
v-on:remove="onBlockRemoved" |
||||||
|
:access-token="$root.store.accessToken"/> |
||||||
|
<block-images v-if="block.type === 'images'" |
||||||
|
:index="index" |
||||||
|
:title.sync="block.data.title" |
||||||
|
:text.sync="block.data.text" |
||||||
|
:images.sync="block.data.images" |
||||||
|
v-on:remove="onBlockRemoved" |
||||||
|
:access-token="$root.store.accessToken"/> |
||||||
|
<block-video v-if="block.type === 'video'" |
||||||
|
:index="index" |
||||||
|
:title.sync="block.data.title" |
||||||
|
v-on:remove="onBlockRemoved" |
||||||
|
:video-url.sync="block.data.video_url"/> |
||||||
|
</div> |
||||||
|
</vue-draggable> |
||||||
|
|
||||||
|
<block-add v-on:added="onBlockAdded"/> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import {api} from "../../js/modules/api"; |
||||||
|
import Draggable from 'vuedraggable'; |
||||||
|
import BlockText from './BlockText' |
||||||
|
import BlockImage from './BlockImage' |
||||||
|
import BlockImages from './BlockImages' |
||||||
|
import BlockImageText from './BlockImageText' |
||||||
|
import BlockVideo from './BlockVideo' |
||||||
|
import BlockAdd from "./BlockAdd" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: 'block-content', |
||||||
|
props: ['content'], |
||||||
|
methods: { |
||||||
|
onBlockRemoved(blockIndex) { |
||||||
|
const content = this.content; |
||||||
|
const blockToRemove = this.content[blockIndex]; |
||||||
|
// Если блок уже был записан в БД, отправляем запрос на сервер на удаление блока из БД |
||||||
|
if (blockToRemove.data.id) { |
||||||
|
api.removeContentBlock(blockToRemove, this.$root.store.accessToken).then(response => { |
||||||
|
// Удаляем блок из Vue |
||||||
|
content.splice(blockIndex, 1); |
||||||
|
this.$emit('update:content', content); |
||||||
|
}); |
||||||
|
} |
||||||
|
}, |
||||||
|
onBlockAdded(blockData) { |
||||||
|
const content = this.content; |
||||||
|
content.push(blockData); |
||||||
|
this.$emit('update:content', content); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
components: { |
||||||
|
BlockAdd, |
||||||
|
'block-text': BlockText, |
||||||
|
'block-image': BlockImage, |
||||||
|
'block-image-text': BlockImageText, |
||||||
|
'block-images': BlockImages, |
||||||
|
'block-video': BlockVideo, |
||||||
|
'vue-draggable': Draggable, |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
@ -1,59 +0,0 @@ |
|||||||
import Vue from 'vue'; |
|
||||||
import Comments from '../../components/Comments'; |
|
||||||
//import $ from 'jquery';
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') { |
|
||||||
// Enable vue-devtools
|
|
||||||
Vue.config.devtools = true; |
|
||||||
} |
|
||||||
|
|
||||||
let app = new Vue({ |
|
||||||
el: '#comments_block', |
|
||||||
data(){ |
|
||||||
return { |
|
||||||
userId: 123, |
|
||||||
accessToken: 123, |
|
||||||
comments: [{ |
|
||||||
author: { |
|
||||||
get_full_name: 'John Doe', |
|
||||||
photo: {url: ''}, |
|
||||||
}, |
|
||||||
created_at_humanize: '12 07 18', |
|
||||||
content: 'content content content content', |
|
||||||
id: 1, |
|
||||||
is_child_node: false |
|
||||||
}, { |
|
||||||
author: { |
|
||||||
get_full_name: 'Sarah Conor', |
|
||||||
photo: {url: ''}, |
|
||||||
}, |
|
||||||
created_at_humanize: '5 05 18', |
|
||||||
content: 'hasta la vista', |
|
||||||
id: 2, |
|
||||||
is_child_node: false, |
|
||||||
children: [{ |
|
||||||
author: { |
|
||||||
get_full_name: 'John Doe', |
|
||||||
photo: {url: ''}, |
|
||||||
}, |
|
||||||
created_at_humanize: '12 07 18', |
|
||||||
content: 'content content content content', |
|
||||||
id: 10, |
|
||||||
is_child_node: true |
|
||||||
}, { |
|
||||||
author: { |
|
||||||
get_full_name: 'Sarah Conor', |
|
||||||
photo: {url: ''}, |
|
||||||
}, |
|
||||||
created_at_humanize: '5 05 18', |
|
||||||
content: 'hasta la vista', |
|
||||||
id: 20, |
|
||||||
is_child_node: true, |
|
||||||
}] |
|
||||||
}] |
|
||||||
} |
|
||||||
}, |
|
||||||
components: { |
|
||||||
'comments': Comments, |
|
||||||
} |
|
||||||
}); |
|
||||||
Loading…
Reference in new issue