mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
add cohorts and back to home in default template
This commit is contained in:
parent
fb4279a108
commit
0d6ee8dc4f
4 changed files with 23 additions and 29 deletions
|
@ -4,9 +4,12 @@
|
||||||
<Confirm/>
|
<Confirm/>
|
||||||
<Nav/>
|
<Nav/>
|
||||||
<v-main app>
|
<v-main app>
|
||||||
|
<div class="ml-1 mb-1 mt-1" v-if='showCohorts || showBack'>
|
||||||
|
<v-btn v-show='showBack' text color='primary' to='/'><v-icon v-text='mdiChevronLeft'/></v-btn>
|
||||||
|
<v-btn v-for='cohort in cohorts' text color='primary' :key='cohort.id' :to='`/g/${cohort.name}`'>{{cohort.name}}</v-btn>
|
||||||
|
</div>
|
||||||
<v-fade-transition hide-on-leave>
|
<v-fade-transition hide-on-leave>
|
||||||
<nuxt keep-alive :keep-alive-props="{ max: 10, include: ['Index'] }"/>
|
<nuxt />
|
||||||
<!-- <nuxt /> -->
|
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
</v-main>
|
</v-main>
|
||||||
<Footer/>
|
<Footer/>
|
||||||
|
@ -21,6 +24,7 @@ import Snackbar from '../components/Snackbar'
|
||||||
import Footer from '../components/Footer'
|
import Footer from '../components/Footer'
|
||||||
import Confirm from '../components/Confirm'
|
import Confirm from '../components/Confirm'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
import { mdiChevronLeft } from '@mdi/js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
head () {
|
head () {
|
||||||
|
@ -30,9 +34,24 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return { cohorts: [], mdiChevronLeft }
|
||||||
|
},
|
||||||
|
async fetch () {
|
||||||
|
this.cohorts = await this.$axios.$get('cohorts')
|
||||||
|
},
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
components: { Nav, Snackbar, Footer, Confirm },
|
components: { Nav, Snackbar, Footer, Confirm },
|
||||||
computed: mapState(['settings', 'locale']),
|
computed: {
|
||||||
|
...mapState(['settings', 'locale']),
|
||||||
|
showBack () {
|
||||||
|
return ['tag-tag', 'g-cohort', 'p-place', 'search', 'announcement-id'].includes(this.$route.name)
|
||||||
|
},
|
||||||
|
showCohorts () {
|
||||||
|
if (!this.cohorts || this.cohorts.length === 0) return false
|
||||||
|
return ['tag-tag', 'index', 'g-cohort', 'p-place'].includes(this.$route.name)
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
this.$vuetify.theme.dark = this.settings['theme.is_dark']
|
this.$vuetify.theme.dark = this.settings['theme.is_dark']
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container id='home' fluid>
|
<v-container id='home' fluid>
|
||||||
<div class="mt-3 mb-1 ml-1">
|
|
||||||
<v-btn text color='primary' to='/'><v-icon v-text='mdiChevronLeft'/></v-btn>
|
|
||||||
<v-btn v-for='cohort in cohorts' text color='primary' :key='cohort.id' :to='`/g/${cohort.name}`' v-text='cohort.name' />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class='d-block text-h3 font-weight-black text-center align-center text-uppercase mt-10 mb-12 mx-auto w-100 text-underline'><u>{{cohort}}</u></h1>
|
<h1 class='d-block text-h3 font-weight-black text-center align-center text-uppercase mt-10 mb-12 mx-auto w-100 text-underline'><u>{{cohort}}</u></h1>
|
||||||
|
|
||||||
|
@ -15,23 +11,16 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { mdiChevronLeft } from '@mdi/js'
|
|
||||||
import Event from '@/components/Event'
|
import Event from '@/components/Event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Tag',
|
name: 'Tag',
|
||||||
components: { Event },
|
components: { Event },
|
||||||
data ({ $route }) {
|
|
||||||
return { mdiChevronLeft, cohort: $route.params.cohort, cohorts: [] }
|
|
||||||
},
|
|
||||||
async fetch () {
|
|
||||||
this.cohorts = await this.$axios.$get('/cohorts')
|
|
||||||
},
|
|
||||||
async asyncData ({ $axios, params, error }) {
|
async asyncData ({ $axios, params, error }) {
|
||||||
try {
|
try {
|
||||||
const cohort = params.cohort
|
const cohort = params.cohort
|
||||||
const events = await $axios.$get(`/cohorts/${cohort}`)
|
const events = await $axios.$get(`/cohorts/${cohort}`)
|
||||||
return { events }
|
return { events, cohort }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
error({ statusCode: 400, message: 'Error!' })
|
error({ statusCode: 400, message: 'Error!' })
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container id='home' fluid>
|
<v-container id='home' fluid>
|
||||||
<div class="mt-3 mb-1 ml-1">
|
|
||||||
<v-btn text color='primary' to='/'><v-icon v-text='mdiChevronLeft'/></v-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-5 mx-auto w-100 text-underline'><u>{{place.name}}</u></h1>
|
<h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-5 mx-auto w-100 text-underline'><u>{{place.name}}</u></h1>
|
||||||
<span class="d-block text-subtitle text-center w-100 mb-14">{{place.address}}</span>
|
<span class="d-block text-subtitle text-center w-100 mb-14">{{place.address}}</span>
|
||||||
|
@ -15,15 +12,11 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { mdiChevronLeft } from '@mdi/js'
|
|
||||||
import Event from '@/components/Event'
|
import Event from '@/components/Event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Tag',
|
name: 'Tag',
|
||||||
components: { Event },
|
components: { Event },
|
||||||
data () {
|
|
||||||
return { mdiChevronLeft }
|
|
||||||
},
|
|
||||||
asyncData ({ $axios, params, error }) {
|
asyncData ({ $axios, params, error }) {
|
||||||
try {
|
try {
|
||||||
const place = params.place
|
const place = params.place
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container id='home' fluid>
|
<v-container id='home' fluid>
|
||||||
<div class="mt-3 mb-1 ml-1">
|
|
||||||
<v-btn text color='primary' to='/'><v-icon v-text='mdiChevronLeft'/></v-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class='d-block text-h3 font-weight-black text-center align-center text-uppercase mt-5 mb-16 mx-auto w-100 text-underline'><u>{{tag}}</u></h1>
|
<h1 class='d-block text-h3 font-weight-black text-center align-center text-uppercase mt-5 mb-16 mx-auto w-100 text-underline'><u>{{tag}}</u></h1>
|
||||||
|
|
||||||
|
@ -14,15 +11,11 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { mdiChevronLeft } from '@mdi/js'
|
|
||||||
import Event from '@/components/Event'
|
import Event from '@/components/Event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Tag',
|
name: 'Tag',
|
||||||
components: { Event },
|
components: { Event },
|
||||||
data () {
|
|
||||||
return { mdiChevronLeft }
|
|
||||||
},
|
|
||||||
async asyncData ({ $axios, params, error }) {
|
async asyncData ({ $axios, params, error }) {
|
||||||
try {
|
try {
|
||||||
const tag = params.tag
|
const tag = params.tag
|
||||||
|
|
Loading…
Reference in a new issue