Tabs, working 'my spells'
This commit is contained in:
parent
640cadac63
commit
2d8253b493
2 changed files with 66 additions and 8 deletions
|
@ -11,7 +11,7 @@
|
||||||
anchor="bottom right"
|
anchor="bottom right"
|
||||||
self="top right"
|
self="top right"
|
||||||
>
|
>
|
||||||
Export Chosen Spells
|
Export Selected Spells
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
anchor="bottom right"
|
anchor="bottom right"
|
||||||
self="top right"
|
self="top right"
|
||||||
>
|
>
|
||||||
Import Chosen Spells
|
Import Selected Spells
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,12 +33,38 @@
|
||||||
></q-search>
|
></q-search>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div slot="header" class="toolbar primary">
|
||||||
|
<q-tabs
|
||||||
|
:refs="$refs"
|
||||||
|
default-tab="tab-all"
|
||||||
|
>
|
||||||
|
<q-tab name="tab-all" icon="local_library">
|
||||||
|
All Spells
|
||||||
|
</q-tab>
|
||||||
|
<q-tab name="tab-my" icon="bookmark">
|
||||||
|
My Spells
|
||||||
|
</q-tab>
|
||||||
|
</q-tabs>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="layout-view">
|
<div class="layout-view">
|
||||||
|
<section ref="tab-all">
|
||||||
<spell-list
|
<spell-list
|
||||||
:spells="state.spells.data"
|
:spells="state.spells.data"
|
||||||
:search="search"
|
:search="search"
|
||||||
></spell-list>
|
></spell-list>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section ref="tab-my">
|
||||||
|
<spell-list
|
||||||
|
v-if="mySpells.length"
|
||||||
|
:spells="mySpells"
|
||||||
|
:search="search"
|
||||||
|
></spell-list>
|
||||||
|
<div v-else>None :D</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</q-layout>
|
</q-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -78,6 +104,19 @@ export default {
|
||||||
search: ''
|
search: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
mySpells () {
|
||||||
|
if (!this.state.spells.loaded || this.state.chosen.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.state.chosen.map(chosen => {
|
||||||
|
return this.state.spells.data.find(spell => {
|
||||||
|
return spell.name === chosen
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
if (!this.state.spells.loaded) {
|
if (!this.state.spells.loaded) {
|
||||||
Loading.show()
|
Loading.show()
|
||||||
|
|
|
@ -12,7 +12,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-secondary">
|
<div class="item-secondary">
|
||||||
|
<i
|
||||||
|
class="float-left"
|
||||||
|
v-if="checked"
|
||||||
|
v-on:click="checked = false"
|
||||||
|
>bookmark</i>
|
||||||
|
<i
|
||||||
|
class="float-left"
|
||||||
|
v-else
|
||||||
|
v-on:click="checked = true"
|
||||||
|
>bookmark_border</i>
|
||||||
<q-checkbox
|
<q-checkbox
|
||||||
|
class="float-right"
|
||||||
v-model="checked"
|
v-model="checked"
|
||||||
@input="toggle"
|
@input="toggle"
|
||||||
></q-checkbox>
|
></q-checkbox>
|
||||||
|
@ -35,11 +46,14 @@ export default {
|
||||||
},
|
},
|
||||||
classes () {
|
classes () {
|
||||||
return this.spell.classes.map(cla => capitalize(cla)).join(', ')
|
return this.spell.classes.map(cla => capitalize(cla)).join(', ')
|
||||||
|
},
|
||||||
|
checked () {
|
||||||
|
return this.state.chosen.indexOf(this.spell.name) >= 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
checked: false
|
state
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
|
@ -62,3 +76,8 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="stylus">
|
||||||
|
.item-secondary
|
||||||
|
width: 50px
|
||||||
|
</style>
|
||||||
|
|
Loading…
Add table
Reference in a new issue