1
0
Fork 0

Header of collapsible matches table

This commit is contained in:
Joe Wroten 2017-05-10 15:42:35 -05:00
parent 531d24f2e6
commit b7ba325a60
3 changed files with 42 additions and 13 deletions

View file

@ -1,11 +1,12 @@
<template> <template>
<tr> <tr>
<td colspan="3"> <td colspan="3" class="spell">
<q-collapsible <q-collapsible
:label="spell.name"
group="spells" group="spells"
:label="label"
> >
{{spell.description}}
<p>{{spell.description}}</p>
</q-collapsible> </q-collapsible>
</td> </td>
</tr> </tr>
@ -13,11 +14,34 @@
<script> <script>
export default { export default {
computed: {
level () {
return this.spell.level.toLowerCase() === 'cantrip' ? '0' : this.spell.level.charAt(0)
},
label () {
return this.level + this.schoolCapitalized + '\n' + this.spell.name
},
schoolCapitalized () {
debugger
return this.spell.school.charAt(0).toUpperCase() + this.spell.school.slice(1)
}
},
props: [ props: [
'spell' 'spell'
] ]
} }
</script> </script>
<style scoped lang="stylus"> <style lang="stylus">
.spell .item-content
position: relative
.spell .item-content > *
white-space: pre-line !important
overflow: visible !important
line-height: 0
padding-top: .5em
text-indent: 33.333%
&::first-letter
margin-right: 2em
float: right
</style> </style>

View file

@ -10,18 +10,18 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="text-left"> <th class="text-left no-padding">
<a <a class="sort-name"
v-on:click="sortBy = 'name'" v-on:click="sortBy = 'name'"
>Name</a> >Name</a>
</th> </th>
<th class="text-left"> <th class="text-left no-padding">
<a <a class="sort-school"
v-on:click="sortBy = 'school'" v-on:click="sortBy = 'school'"
>School</a> >School</a>
</th> </th>
<th class="text-right"> <th class="text-right no-padding">
<a <a class="sort-level"
v-on:click="sortBy = 'level'" v-on:click="sortBy = 'level'"
>Level</a> >Level</a>
</th> </th>
@ -97,6 +97,12 @@ export default {
.spell-list .spell-list
width: 100% width: 100%
th a th a
padding: 1em display: inline-block
display: block padding: 1em 0
&.sort-name
margin-left: 1em
margin-right: -1em
&.sort-level
margin-left: -5em
margin-right: 5em
</style> </style>

View file

@ -23,7 +23,6 @@ export default class Query {
} }
sort (key = 'sortScore') { sort (key = 'sortScore') {
debugger
this.data = this.data.sort((a, b) => { this.data = this.data.sort((a, b) => {
if (a[key] < b[key]) return -1 if (a[key] < b[key]) return -1
if (a[key] > b[key]) return 1 if (a[key] > b[key]) return 1