From 2d9ab2cd0d1f10b4dc888392d6eb493f21d51acd Mon Sep 17 00:00:00 2001 From: Maxime Moraine Date: Sun, 17 Jan 2021 14:11:12 +0100 Subject: [PATCH] =?UTF-8?q?choix=20des=20colonnes=20=C3=A0=20afficher=20da?= =?UTF-8?q?ns=20le=20grimoire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/theme/layouts/SpellsLayout.vue | 133 ++++++++++++++++-- 1 file changed, 118 insertions(+), 15 deletions(-) diff --git a/docs/.vuepress/theme/layouts/SpellsLayout.vue b/docs/.vuepress/theme/layouts/SpellsLayout.vue index 6ba7069..0e95248 100644 --- a/docs/.vuepress/theme/layouts/SpellsLayout.vue +++ b/docs/.vuepress/theme/layouts/SpellsLayout.vue @@ -11,6 +11,59 @@

Grimoire

+
Colonnes affichées :
+
+ + + + + + + +
+
Classes : {{ c }} @@ -96,9 +149,9 @@ - + @@ -120,6 +173,7 @@ import { setUrlParams, getUrlParameter } from '@theme/util/filterHelpers' import { isResourceInLibrary } from '@theme/util' import Spell from '@theme/components/Spell' import MySpellsButton from '@theme/global-components/MySpellsButton' +import Cookies from 'js-cookie' export default { components: { Breadcrumb, Spell, MySpellsButton }, @@ -137,18 +191,27 @@ export default { ], page: 1, pageCount: 0, - headers: [ - { text: "", align: 'center', sortable: false, value: 'isInSpellBook' }, - { text: "Nom", align: 'start', sortable: true, value: 'title' }, - { text: "Niveau", align: 'center', sortable: true, value: 'frontmatter.level' }, - { text: "École", align: 'start', sortable: false, value: 'frontmatter.school' }, - { text: "Temps d'incantation", align: 'start', sortable: false, value: 'frontmatter.casting_time' }, - { text: "Durée", align: 'start', sortable: false, value: 'frontmatter.duration' }, - { text: "Concentration", align: 'center', sortable: false, value: 'frontmatter.concentration' }, - { text: "Rituel", align: 'center', sortable: false, value: 'frontmatter.ritual' }, - { text: "Composantes", align: 'center', sortable: false, value: 'frontmatter.components' }, - // { text: "Classes", align: 'start', sortable: false, value: 'frontmatter.classes' } - ], + // headers: [ + // { text: "", align: 'center', sortable: false, value: 'isInSpellBook' }, + // { text: "Nom", align: 'start', sortable: true, value: 'title' }, + // { text: "Niveau", align: 'center', sortable: true, value: 'frontmatter.level' }, + // { text: "École", align: 'start', sortable: false, value: 'frontmatter.school' }, + // { text: "Temps d'incantation", align: 'start', sortable: false, value: 'frontmatter.casting_time' }, + // { text: "Durée", align: 'start', sortable: false, value: 'frontmatter.duration' }, + // { text: "Concentration", align: 'center', sortable: false, value: 'frontmatter.concentration' }, + // { text: "Rituel", align: 'center', sortable: false, value: 'frontmatter.ritual' }, + // { text: "Composantes", align: 'center', sortable: false, value: 'frontmatter.components' }, + // { text: "Description", align: 'start', sortable: false, value: 'frontmatter.description' }, + // ], + showColumn: { + school: true, + castingTime: true, + duration: true, + concentration: true, + ritual: true, + components: true, + description: false, + } } }, @@ -165,6 +228,36 @@ export default { componentMaterial: state => state.spellFilters.componentMaterial, }), + headers() { + let headers = [ + { text: "", align: 'center', sortable: false, value: 'isInSpellBook' }, + { text: "Nom", align: 'start', sortable: true, value: 'title' }, + { text: "Niveau", align: 'center', sortable: true, value: 'frontmatter.level' } + ] + if (this.showColumn.school) { + headers.push({ text: "École", align: 'start', sortable: false, value: 'frontmatter.school' }) + } + if (this.showColumn.castingTime) { + headers.push({ text: "Temps d'incantation", align: 'start', sortable: false, value: 'frontmatter.casting_time' }) + } + if (this.showColumn.duration) { + headers.push({ text: "Durée", align: 'start', sortable: false, value: 'frontmatter.duration' }) + } + if (this.showColumn.concentration) { + headers.push({ text: "Concentration", align: 'center', sortable: false, value: 'frontmatter.concentration' }) + } + if (this.showColumn.ritual) { + headers.push({ text: "Rituel", align: 'center', sortable: false, value: 'frontmatter.ritual' }) + } + if (this.showColumn.components) { + headers.push({ text: "Composantes", align: 'center', sortable: false, value: 'frontmatter.components' }) + } + if (this.showColumn.description) { + headers.push({ text: "Description", align: 'start', sortable: false, value: 'frontmatter.description' }) + } + return headers + }, + selectedClasses() { let result = [] for (let c of this.classes) { @@ -341,6 +434,10 @@ export default { } return level.level.toString() + 'ème' }, + + setShowColumn () { + Cookies.set('heros-et-dragons-grimoire-colonnes', this.showColumn) + }, }, mounted () { @@ -357,6 +454,12 @@ export default { if (page) { this.page = page } + + // Choix des colonnes à afficher + const showColumn = Cookies.get('heros-et-dragons-grimoire-colonnes') + if (showColumn) { + this.showColumn = JSON.parse(showColumn) + } } }