a new search page
This commit is contained in:
parent
d3c0235330
commit
9b22892466
2 changed files with 47 additions and 16 deletions
|
@ -5,9 +5,6 @@ v-container#home(fluid)
|
||||||
#announcements.mx-1.mt-1(v-if='announcements.length')
|
#announcements.mx-1.mt-1(v-if='announcements.length')
|
||||||
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
|
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
|
||||||
|
|
||||||
.mb-1.mt-3.ml-2
|
|
||||||
v-btn(v-for='cohort in cohorts' text color='primary' :key='cohort.id' :to='`g/${cohort.name}`') {{cohort.name}}
|
|
||||||
|
|
||||||
//- Calendar and search bar
|
//- Calendar and search bar
|
||||||
v-row.ma-2
|
v-row.ma-2
|
||||||
#calh.col-xl-5.col-lg-5.col-md-7.col-sm-12.col-xs-12.pa-0.ma-0
|
#calh.col-xl-5.col-lg-5.col-md-7.col-sm-12.col-xs-12.pa-0.ma-0
|
||||||
|
@ -16,13 +13,10 @@ v-container#home(fluid)
|
||||||
client-only(placeholder='Loading...')
|
client-only(placeholder='Loading...')
|
||||||
Calendar(@dayclick='dayChange' @monthchange='monthChange' :events='events')
|
Calendar(@dayclick='dayChange' @monthchange='monthChange' :events='events')
|
||||||
|
|
||||||
.col.pt-0.pt-md-2
|
.col.pt-0.pt-md-2.mt-4.pb-0
|
||||||
//- v-btn(to='/search' color='primary' ) {{$t('common.search')}}
|
//- v-btn(to='/search' color='primary' ) {{$t('common.search')}}
|
||||||
v-form(to='/search' action='/search' method='GET')
|
v-form(to='/search' action='/search' method='GET')
|
||||||
v-text-field(:label='$t("common.search")')
|
v-text-field(name='search' :label='$t("common.search")' outlined rounded hide-details :append-icon='mdiMagnify')
|
||||||
v-btn(type='submit')
|
|
||||||
//- Search(@tag:selected="tag => $router.push(`/tag/${tag.tag}`)")
|
|
||||||
//- v-chip(v-if='selectedDay' close :close-icon='mdiCloseCircle' @click:close='dayChange()') {{selectedDay}}
|
|
||||||
|
|
||||||
//- Events
|
//- Events
|
||||||
#events.mb-2.mt-1.pl-1.pl-sm-2
|
#events.mb-2.mt-1.pl-1.pl-sm-2
|
||||||
|
@ -34,13 +28,12 @@ import { mapState } from 'vuex'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import Event from '@/components/Event'
|
import Event from '@/components/Event'
|
||||||
import Announcement from '@/components/Announcement'
|
import Announcement from '@/components/Announcement'
|
||||||
import Search from '@/components/Search'
|
|
||||||
import Calendar from '@/components/Calendar'
|
import Calendar from '@/components/Calendar'
|
||||||
import { mdiCloseCircle } from '@mdi/js'
|
import { mdiMagnify } from '@mdi/js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
components: { Event, Search, Announcement, Calendar },
|
components: { Event, Announcement, Calendar },
|
||||||
middleware: 'setup',
|
middleware: 'setup',
|
||||||
async asyncData ({ $api }) {
|
async asyncData ({ $api }) {
|
||||||
const events = await $api.getEvents({
|
const events = await $api.getEvents({
|
||||||
|
@ -52,9 +45,8 @@ export default {
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
mdiCloseCircle,
|
mdiMagnify,
|
||||||
first: true,
|
first: true,
|
||||||
cohorts: [],
|
|
||||||
isCurrentMonth: true,
|
isCurrentMonth: true,
|
||||||
now: dayjs().unix(),
|
now: dayjs().unix(),
|
||||||
date: dayjs.tz().format('YYYY-MM-DD'),
|
date: dayjs.tz().format('YYYY-MM-DD'),
|
||||||
|
@ -64,9 +56,6 @@ export default {
|
||||||
selectedDay: null
|
selectedDay: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetch () {
|
|
||||||
this.cohorts = await this.$axios.$get('cohorts')
|
|
||||||
},
|
|
||||||
head () {
|
head () {
|
||||||
return {
|
return {
|
||||||
title: this.settings.title,
|
title: this.settings.title,
|
||||||
|
|
42
pages/search.vue
Normal file
42
pages/search.vue
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<template lang="pug">
|
||||||
|
v-container#home(fluid)
|
||||||
|
|
||||||
|
v-form.ma-5(to='/search' action='/search' method='GET')
|
||||||
|
v-text-field(name='search' :label='$t("common.search")' :value='$route.query.search' hide-details outlined rounded :append-icon='mdiMagnify')
|
||||||
|
|
||||||
|
//- Events
|
||||||
|
#events.mb-2.mt-1.pl-1.pl-sm-2
|
||||||
|
Event(:event='event' @destroy='destroy' v-for='(event, idx) in events' :lazy='idx>2' :key='event.id')
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import Event from '@/components/Event'
|
||||||
|
import Announcement from '@/components/Announcement'
|
||||||
|
import Calendar from '@/components/Calendar'
|
||||||
|
import { mdiMagnify } from '@mdi/js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Index',
|
||||||
|
components: { Event, Announcement, Calendar },
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
mdiMagnify,
|
||||||
|
events: [],
|
||||||
|
start: dayjs().startOf('month').unix(),
|
||||||
|
end: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async fetch () {
|
||||||
|
const search = this.$route.query.search
|
||||||
|
this.events = await this.$axios.$get(`/event/search?search=${search}`)
|
||||||
|
},
|
||||||
|
computed: mapState(['settings']),
|
||||||
|
methods: {
|
||||||
|
destroy (id) {
|
||||||
|
this.events = this.events.filter(e => e.id !== id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in a new issue