1
0
Fork 0
This commit is contained in:
Joe Wroten 2017-05-12 23:12:25 -05:00
parent 16ca3af64b
commit 2fba3427cc
3 changed files with 42 additions and 81 deletions

View file

@ -5,6 +5,7 @@
My Spells v2.0
<q-search
class="primary"
v-model="search"
></q-search>
</q-toolbar-title>

View file

@ -1,49 +1,49 @@
<template>
<tr class="spell">
<td class="spell-level">
<div>
<div class="item-primary">
{{level}}
</td>
<td colspan="2" class="spell-label">
<q-collapsible
group="spells"
:label="label"
>
<p>{{spell.description}}</p>
</q-collapsible>
</td>
</tr>
</div>
<div class="item-content has-secondary" v-on:click="openSpell">
<div>
{{spell.name}}
</div>
<div>
{{classes}}
</div>
</div>
<div class="item-secondary">
<q-checkbox v-model="checked" disable></q-checkbox>
</div>
</div>
</template>
<script>
let capitalize = str => str.charAt(0).toUpperCase() + str.slice(1)
export default {
computed: {
level () {
return this.spell.level.toLowerCase() === 'cantrip' ? '0' : this.spell.level.charAt(0)
},
label () {
return this.schoolCapitalized + '\n' + this.spell.name
school () {
return capitalize(this.spell.school)
},
schoolCapitalized () {
return this.spell.school.charAt(0).toUpperCase() + this.spell.school.slice(1)
classes () {
return this.spell.classes.map(cla => capitalize(cla)).join(', ')
}
},
data () {
return {
checked: false
}
},
props: [
'spell'
]
],
methods: {
openSpell (event) {
console.log(this.spell.name)
}
}
}
</script>
<style lang="stylus">
.spell
.item-content
position: relative
& > *
white-space: pre-line !important
overflow: visible !important
line-height: 0
padding-top: .5em
text-indent: 55%
.spell-level
padding-left: 1em !important
</style>

View file

@ -1,53 +1,13 @@
<template>
<table class="spell-list q-table compact striped-odd">
<thead>
<tr>
<td colspan="3">
<q-pagination
class="text-center"
v-model="page"
:max="pageMax"
></q-pagination>
</td>
</tr>
<tr>
<th class="sort-level">
<a
v-on:click="sortBy = 'level'"
>Level</a>
</th>
<th class="sort-name">
<a
v-on:click="sortBy = 'name'"
>Name</a>
</th>
<th class="sort-school">
<a
v-on:click="sortBy = 'school'"
>School</a>
</th>
</tr>
</thead>
<tbody>
<tr
is="spell-item"
v-for="spell in pagedSpells"
:spell="spell"
>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<q-pagination
class="text-center"
v-model="page"
:max="pageMax"
></q-pagination>
</td>
</tr>
</tfoot>
</table>
<div class="list striped no-border">
<label
is="spell-item"
class="item two-line item-link"
v-for="spell in pagedSpells"
:spell="spell"
>
</label>
</div>
</template>
<script>