Browse Source

treenode | Added editMode and debugMode properties.

export_seznamu_prednasek
parent
commit
1ba52cb397
  1. 11
      vue_frontend/src/components/TextNode.vue
  2. 26
      vue_frontend/src/components/TreeNode.vue
  3. 14
      vue_frontend/src/components/TreeNodeRoot.vue

11
vue_frontend/src/components/TextNode.vue

@ -10,22 +10,20 @@
<textarea id="textarea" v-model="currentText" rows="8" cols="50"></textarea> <textarea id="textarea" v-model="currentText" rows="8" cols="50"></textarea>
<br> <br>
<button v-on:click="plainEditShow=!plainEditShow">Editovat v editoru</button> <button v-on:click="plainEditShow=!plainEditShow">Editovat v editoru</button>
<button v-on:click="saveText">Uložit</button>
<button v-on:click="currentText = originalText;editorShow=!editorShow;">Zahodit úpravy</button>
</div> </div>
<div v-else> <div v-else>
<component v-bind:is="editorComponent" :editor="editor" v-model="currentText" :config="editorConfig"></component> <component v-bind:is="editorComponent" :editor="editor" v-model="currentText" :config="editorConfig"></component>
<button v-on:click="plainEditShow=!plainEditShow">Editovat HTML</button> <button v-on:click="plainEditShow=!plainEditShow">Editovat HTML</button>
</div>
<button v-on:click="saveText">Uložit</button> <button v-on:click="saveText">Uložit</button>
<button v-on:click="currentText = originalText;editorShow=!editorShow;">Zahodit úpravy</button> <button v-on:click="currentText = originalText;editorShow=!editorShow;">Zahodit úpravy</button>
<div>
</template> </template>
<template v-else v-bind:class="changedObject"> <template v-else v-bind:class="changedObject">
<p v-html="currentText"></p> <p v-html="currentText"></p>
<button v-on:click="editorShow=!editorShow">Upravit</button> <button v-if="editorMode" v-on:click="editorShow=!editorShow">Upravit</button>
</template> </template>
</div> </div>
</template> </template>
@ -47,9 +45,7 @@ export default {
extraPlugins: ['SimpleUploadAdapter'], extraPlugins: ['SimpleUploadAdapter'],
simpleUpload: { simpleUpload: {
uploadUrl: "/temp/image_upload/", uploadUrl: "/temp/image_upload/",
headers: { headers: {},
"test":"testh"
},
withCredentials: true withCredentials: true
} }
// The configuration of the editor. // The configuration of the editor.
@ -81,6 +77,7 @@ export default {
props: { props: {
item: Object, item: Object,
editorShow: Boolean, editorShow: Boolean,
editorMode: Boolean,
create: Boolean, create: Boolean,
where: String, where: String,
refnode: Object refnode: Object

26
vue_frontend/src/components/TreeNode.vue

@ -4,10 +4,12 @@
<!--b v-if="v_tematu">v tematu</b> <!--b v-if="v_tematu">v tematu</b>
<b v-if="visible">visible</b> <b v-if="visible">visible</b>
Force visible: {{String(force_visible)}}--> Force visible: {{String(force_visible)}}-->
<component :is='item.node.polymorphic_ctype.model' :item='item' :key='item.node.id'></component> <component :is='item.node.polymorphic_ctype.model' :item='item' :key='item.node.id'
:editorMode="editorMode"
:debugMode="debugMode"></component>
<button v-on:click="debugShow = !debugShow" class="nodebug">Ladící data</button> <!-- bude tu nějaký if na class="nodebug", v debug módu bude tlačítko vidět, jinak ne --> <button v-if="debugMode" v-on:click="debugShow = !debugShow" class="nodebug">Ladící data</button> <!-- bude tu nějaký if na class="nodebug", v debug módu bude tlačítko vidět, jinak ne -->
<div v-if="debugShow"> <div v-if="debugShow">
<pre>{{ item.node.polymorphic_ctype.model }}</pre> <pre>{{ item.node.polymorphic_ctype.model }}</pre>
<pre>{{ item }}</pre> <pre>{{ item }}</pre>
@ -33,12 +35,16 @@
<div v-if="chld.node.polymorphic_ctype.model==='ulohazadaninode'"> <div v-if="chld.node.polymorphic_ctype.model==='ulohazadaninode'">
<button v-on:click="showChildren=!showChildren"> Tady možná něco je </button> <button v-on:click="showChildren=!showChildren"> Tady možná něco je </button>
<TreeNode :item="chld" :v_tematu="true" <TreeNode :item="chld" :v_tematu="true"
:force_visible="showChildren"> :force_visible="showChildren"
:editorMode="editorMode"
:debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-else> <div v-else>
<TreeNode :item="chld" :v_tematu="true" <TreeNode :item="chld" :v_tematu="true"
:force_visible="showChildren"> :force_visible="showChildren"
:editorMode="editorMode"
:debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-if="chld.appendable_siblings.length > 0" class="mam-org-only" > <div v-if="chld.appendable_siblings.length > 0" class="mam-org-only" >
@ -55,12 +61,16 @@
<div v-if="v_tematu && chld.node.polymorphic_ctype.model==='ulohazadaninode'"> <div v-if="v_tematu && chld.node.polymorphic_ctype.model==='ulohazadaninode'">
<div> Tady možná něco je </div> <div> Tady možná něco je </div>
<TreeNode :item="chld" :v_tematu="v_tematu" <TreeNode :item="chld" :v_tematu="v_tematu"
:force_visible="force_visible"> :force_visible="force_visible"
:editorMode="editorMode"
:debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-else> <div v-else>
<TreeNode :item="chld" :v_tematu="v_tematu" <TreeNode :item="chld" :v_tematu="v_tematu"
:force_visible="force_visible"> :force_visible="force_visible"
:editorMode="editorMode"
:debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-if="chld.appendable_siblings.length > 0" class="mam-org-only" > <div v-if="chld.appendable_siblings.length > 0" class="mam-org-only" >
@ -107,7 +117,9 @@ export default {
props: { props: {
item: Object, item: Object,
force_visible: Boolean, force_visible: Boolean,
v_tematu: Boolean v_tematu: Boolean,
editorMode: Boolean,
debugMode: Boolean,
}, },
methods: { methods: {
hideNode: function(chld){ hideNode: function(chld){

14
vue_frontend/src/components/TreeNodeRoot.vue

@ -6,7 +6,11 @@
<!--pre> <!--pre>
{{item}} {{item}}
</pre--> </pre-->
<TreeNode :item="item"/> <button v-show="editorMode" v-on:click="editorMode = false">Vypnout editační mód</button>
<button v-show="!editorMode" v-on:click="editorMode = true">Zapnout editační mód</button>
<button v-show="debugMode" v-on:click="debugMode = false">Vypnout ladicí mód</button>
<button v-show="!debugMode" v-on:click="debugMode = true">Zapnout ladicí mód</button>
<TreeNode :item="item" :editorMode="editorMode" :debugMode="debugMode"/>
</div> </div>
</template> </template>
@ -21,10 +25,14 @@ export default {
data: () => ({ data: () => ({
loading: true, loading: true,
item: null, item: null,
tnid: 1 tnid: 1,
editorMode: false,
debugMode: false,
}), }),
props:{ props:{
tnid: Number tnid: Number,
editorMode: Boolean,
debugMode: Boolean,
}, },
mounted: function() { mounted: function() {
this.getArticles(); this.getArticles();

Loading…
Cancel
Save