Browse Source

Merge branch 'treenode_editor' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into treenode_editor

export_seznamu_prednasek
parent
commit
9726dca10a
  1. 2
      vue_frontend/src/components/CastNode.vue
  2. 25
      vue_frontend/src/components/TreeNode.vue
  3. 2
      vue_frontend/src/components/UlohaVzorakNode.vue

2
vue_frontend/src/components/CastNode.vue

@ -7,7 +7,7 @@
<button v-on:click="currentText = originalText;editorShow=!editorShow;">Zahodit úpravy</button> <button v-on:click="currentText = originalText;editorShow=!editorShow;">Zahodit úpravy</button>
</div> </div>
<div v-else> <div v-else>
<h4>{{ currentText }} </h4> <button v-on:click="editorShow=!editorShow">Upravit</button> <h4>{{ currentText }} </h4> <button v-if="editorMode" v-on:click="editorShow=!editorShow">Upravit</button>
</div> </div>
</div> </div>
</template> </template>

25
vue_frontend/src/components/TreeNode.vue

@ -16,14 +16,14 @@
</div> </div>
<div v-if="item.children.length === 0"> <div v-if="item.children.length === 0">
<div v-if="item.appendable_children.length > 0" :class="editorMode ? 'org' : 'schovat'"> <div v-if="item.appendable_children.length > 0 && editorMode">
<b>Vložit jako syna: </b> <b>Vložit jako syna: </b>
<addnewnode :types="item.appendable_children" :refnode="item.node" where="syn" /> <addnewnode :types="item.appendable_children" :refnode="item.node" where="syn" />
</div> </div>
</div> </div>
<div v-else :class="editorMode ? 'children-org' : 'children'"> <!-- bude tu nějaký if na class="children" --> <div v-else :class="editorMode ? 'children-org' : 'children'"> <!-- bude tu nějaký if na class="children" -->
<div v-if="item.children.length > 0 && item.children[0].appendable_siblings.length > 0" :class="editorMode ? 'org' : 'schovat'"> <div v-if="item.children.length > 0 && item.children[0].appendable_siblings.length > 0 && editorMode">
<b>Vložit před: </b> <b>Vložit před: </b>
<addnewnode :types="item.children[0].appendable_siblings" :refnode="item.children[0].node" where="pred" /> <addnewnode :types="item.children[0].appendable_siblings" :refnode="item.children[0].node" where="pred" />
</div> </div>
@ -33,7 +33,8 @@
<!--Hide: {{hideNode(chld)}}, v tematu: {{v_tematu}}, force_visible: {{force_visible}}--> <!--Hide: {{hideNode(chld)}}, v tematu: {{v_tematu}}, force_visible: {{force_visible}}-->
<div v-if="!hideNode(chld)"> <div v-if="!hideNode(chld)">
<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-if="showChildren" v-on:click="showChildren=!showChildren"> Schovat </button>
<button v-else v-on:click="showChildren=!showChildren"> Rozbalit </button>
<TreeNode :item="chld" :v_tematu="true" <TreeNode :item="chld" :v_tematu="true"
:force_visible="showChildren" :force_visible="showChildren"
:editorMode="editorMode" :editorMode="editorMode"
@ -47,14 +48,15 @@
:debugMode="debugMode"> :debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-if="chld.appendable_siblings.length > 0" :class="editorMode ? 'org' : 'schovat'" > <div v-if="chld.appendable_siblings.length > 0 && editorMode" >
<b v-if="index < (item.children.length - 1)">Vložit mezi: </b> <b v-if="index < (item.children.length - 1)">Vložit mezi: </b>
<b v-else>Vložit za: </b> <b v-else>Vložit za: </b>
<addnewnode :types="chld.appendable_siblings" :refnode="chld.node" where="za" /> <addnewnode :types="chld.appendable_siblings" :refnode="chld.node" where="za" />
</div> </div>
</div> </div>
</div> </div>
<button v-on:click="showChildren=!showChildren"> Tady možná něco je </button> <button v-if="showChildren" v-on:click="showChildren=!showChildren"> Schovat </button>
<button v-else v-on:click="showChildren=!showChildren"> Rozbalit </button>
</div> </div>
<div v-else> <div v-else>
<div v-for="(chld, index) in item.children" v-bind:key="chld.nazev" > <div v-for="(chld, index) in item.children" v-bind:key="chld.nazev" >
@ -73,7 +75,7 @@
:debugMode="debugMode"> :debugMode="debugMode">
</TreeNode> </TreeNode>
</div> </div>
<div v-if="chld.appendable_siblings.length > 0" :class="editorMode ? 'org' : 'schovat'" > <div v-if="chld.appendable_siblings.length > 0 && editorMode" >
<b v-if="index < (item.children.length - 1)">Vložit mezi: </b> <b v-if="index < (item.children.length - 1)">Vložit mezi: </b>
<b v-else>Vložit za: </b> <b v-else>Vložit za: </b>
<addnewnode :types="chld.appendable_siblings" :refnode="chld.node" where="za" /> <addnewnode :types="chld.appendable_siblings" :refnode="chld.node" where="za" />
@ -110,8 +112,7 @@ export default {
}, },
data: () => ({ data: () => ({
debugShow: false, debugShow: false,
showChildren: false, showChildren: false
editorMode: false
}), }),
computed: { computed: {
}, },
@ -153,16 +154,8 @@ export default {
border: #6a0043 2px dashed; border: #6a0043 2px dashed;
} }
.mam-org-only {
margin: 4px;
}
.nodebug { .nodebug {
/* display: none; */ /* display: none; */
} }
.schovat {
display: none
}
</style> </style>

2
vue_frontend/src/components/UlohaVzorakNode.vue

@ -2,7 +2,7 @@
<div class="ulohavzoraknode"> <div class="ulohavzoraknode">
<!--pre>UlohaVzorakNode {{item}} {{typeof(item)}}</pre--> <!--pre>UlohaVzorakNode {{item}} {{typeof(item)}}</pre-->
<h5>Řešení {{item.node.uloha.cislo_zadani.poradi}}.{{ item.node.uloha.kod }}: {{ item.node.uloha.nazev }}</h5> <h5>Řešení {{item.node.uloha.cislo_zadani.poradi}}.{{ item.node.uloha.kod }}: {{ item.node.uloha.nazev }}</h5>
<button v-on:click="showSelect=!showSelect" class="upravit">Upravit</button> <button v-if="editorMode" v-on:click="showSelect=!showSelect" class="upravit">Upravit</button>
<div v-if="showSelect"> <div v-if="showSelect">
<form class="searchForm" v-on:submit.prevent="submitSearch"> <form class="searchForm" v-on:submit.prevent="submitSearch">
<input type="text" v-model="searchQuery" placeholder="Napište název" @keyup="submitSearch"> <input type="text" v-model="searchQuery" placeholder="Napište název" @keyup="submitSearch">

Loading…
Cancel
Save