frontend: pick corpus

This commit is contained in:
2019-03-24 19:55:32 +01:00
parent e363cc3fd6
commit d84ad9e163
5 changed files with 28 additions and 10 deletions

View File

@@ -9,8 +9,9 @@
<Nav></Nav>
<div class="my-home container-fluid">
<div class="row">
<div id="serach" class="col-sm-2 border-right fill">
<LWords v-if="this.$root.store.selIndex === 'words'"></LWords>
<div id="serach" class="col-sm-2 border-right fill" :key=this.$root.store.indexReloader>
<LWords
v-if="this.$root.store.selIndex.val === 'words'"></LWords>
<LFunctors v-else></LFunctors>
</div>
<div class="col-sm-10">

View File

@@ -32,7 +32,7 @@
<tr>
<label class="radio-inline"><input value="one" v-model="$root.store.radio" v-on:change="reload()" checked="" type="radio" name="optradio">posamezne povedi</label>&nbsp;&nbsp;
<label class="radio-inline"><input value="two" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">skupne udeleženske vloge</label>&nbsp;&nbsp;
<label v-if="this.$root.store.selIndex === 'words'" class="radio-inline"><input value="three" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">po meri</label>
<label v-if="this.$root.store.selIndex.val === 'words'" class="radio-inline"><input value="three" v-model="$root.store.radio" v-on:change="reload()" type="radio" name="optradio">po meri</label>
</tr>
</table>
</div>
@@ -209,7 +209,7 @@ export default {
reload: function () {
this.state = "loading"
this.sentences = {}
if (this.$root.store.selIndex === "functors") this.getFFrames(this.hw)
if (this.$root.store.selIndex.val === "functors") this.getFFrames(this.hw)
else {
this.getFrames(this.hw)
if (this.$root.store.radio === "three") {

View File

@@ -6,7 +6,7 @@
<b-collapse is-nav id="nav_collapse">
<b-navbar-nav>
<b-nav-item-dropdown text="korpus" right>
<b-nav-item-dropdown :text=corpText right>
<b-dropdown-item v-for="option in optCorpora"
:value="option"
:key="option"
@@ -18,11 +18,11 @@
</b-navbar-nav>
<b-navbar-nav>
<b-nav-item-dropdown text="prikaz" right>
<b-nav-item-dropdown :text=indexText right>
<b-dropdown-item v-for="option in optIndexes"
:value="option.val"
:key="option.val"
v-on:click="updateIndex(option.val)"
v-on:click="updateIndex(option)"
>
{{ option.key }}
</b-dropdown-item>
@@ -59,24 +59,35 @@ export default {
name: "Nav",
props: ["appState"],
data() {return {
optCorpora: ["kres", "ssj"],
optIndexes: [
{key: "besede", val: "words"},
{key: "udeleženske vloge", val: "functors"},
],
optCorpora: ["kres", "ssj"],
indexText: "pregled: " + this.$root.store.selIndex.key,
corpText: "korpus: " + this.$root.store.selCorpus,
}},
methods: {
updateAll() {
this.$root.store.indexReloader += 1
this.$root.store.radio = "one"
this.$router.push({
name: "Home"
})
},
setCorpText(val) {
this.corpText = "kropus: " + val
},
updateCorpus(val) {
this.setCorpText(val)
this.$root.store.selCorpus = val
this.updateAll()
},
setIndexText(val) {
this.indexText = "index: " + val
},
updateIndex(val) {
this.setIndexText(val.key)
this.$root.store.selIndex = val
this.updateAll()
},

View File

@@ -38,8 +38,9 @@ const store = {
// api_addr: "http://193.2.76.103:5004", // production
token: null,
username: null,
selIndex: "words",
selIndex: {key: "besede", val: "words"},
selCorpus: "kres",
indexReloader: 0,
radio: "one",
has_se: [], // used for appending (se) to certain verbs
}