mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
fix #3
This commit is contained in:
parent
b50a9a250c
commit
f3dab2d315
7 changed files with 44 additions and 31 deletions
|
@ -19,7 +19,6 @@ const exportController = {
|
||||||
if (places) {
|
if (places) {
|
||||||
wherePlace.name = places.split(',')
|
wherePlace.name = places.split(',')
|
||||||
}
|
}
|
||||||
console.log(wherePlace.name)
|
|
||||||
const events = await Event.findAll({
|
const events = await Event.findAll({
|
||||||
order: [['start_datetime', 'ASC']],
|
order: [['start_datetime', 'ASC']],
|
||||||
where: { start_datetime: { [Sequelize.Op.gte]: yesterday } },
|
where: { start_datetime: { [Sequelize.Op.gte]: yesterday } },
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
b-collapse#nav_collapse(is-nav)
|
b-collapse#nav_collapse(is-nav)
|
||||||
b-navbar-nav.ml-auto(v-if='logged')
|
b-navbar-nav.ml-auto(v-if='logged')
|
||||||
b-nav-item(to='/new_event') <v-icon color='lightgreen' name='plus'/> {{$t('Add Event')}}
|
b-nav-item(to='/new_event') <v-icon color='lightgreen' name='plus'/> {{$t('Add Event')}}
|
||||||
b-nav-item(@click='search=!search') <v-icon color='lightgreen' name='search'/> {{$t('Search')}}
|
|
||||||
b-nav-item(to='/settings') <v-icon color='orange' name='cog'/> {{$t('Settings')}}
|
b-nav-item(to='/settings') <v-icon color='orange' name='cog'/> {{$t('Settings')}}
|
||||||
b-nav-item(v-if='user.is_admin' to='/admin') <v-icon color='lightblue' name='tools'/> {{$t('Admin')}}
|
b-nav-item(v-if='user.is_admin' to='/admin') <v-icon color='lightblue' name='tools'/> {{$t('Admin')}}
|
||||||
b-nav-item(variant='danger' @click='logout') <v-icon color='red' name='sign-out-alt'/> {{$t('Logout')}}
|
b-nav-item(variant='danger' @click='logout') <v-icon color='red' name='sign-out-alt'/> {{$t('Logout')}}
|
||||||
|
@ -15,15 +14,20 @@
|
||||||
b-nav-item(to='/register') {{$t('Register')}}
|
b-nav-item(to='/register') {{$t('Register')}}
|
||||||
b-nav-item(to='/login') {{$t('Login')}}
|
b-nav-item(to='/login') {{$t('Login')}}
|
||||||
transition(name='toggle')
|
transition(name='toggle')
|
||||||
b-navbar#search(v-if='search' type='dark' variant="dark" toggleable='lg')
|
b-navbar#search(type='dark' variant="dark" toggleable='lg')
|
||||||
|
b-navbar-toggle(target='nav_search')
|
||||||
|
v-icon(name='search')
|
||||||
|
b-collapse#nav_search(is-nav)
|
||||||
|
<template slot="button-content"><em>User</em></template>
|
||||||
|
|
||||||
b-navbar-nav
|
b-navbar-nav
|
||||||
b-nav-form
|
b-nav-form
|
||||||
typeahead.ml-1(v-model='filters_places'
|
typeahead.ml-1.mt-1(v-model='filters_places'
|
||||||
textField='name' valueField='name'
|
textField='name' valueField='name'
|
||||||
updateOnMatchOnly
|
updateOnMatchOnly
|
||||||
:data='places' multiple placeholder='Luogo')
|
:data='places' multiple placeholder='Luogo')
|
||||||
b-nav-form
|
b-nav-form
|
||||||
typeahead.ml-1(v-model='filters_tags'
|
typeahead.ml-1.mt-1(v-model='filters_tags'
|
||||||
updateOnMatchOnly
|
updateOnMatchOnly
|
||||||
textField='tag' valueField='tag'
|
textField='tag' valueField='tag'
|
||||||
:data='tags' multiple placeholder='Tags')
|
:data='tags' multiple placeholder='Tags')
|
||||||
|
@ -54,20 +58,14 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
this.updateMeta()
|
this.updateMeta()
|
||||||
},
|
},
|
||||||
data () {
|
|
||||||
return {search: false}
|
|
||||||
},
|
|
||||||
components: { Register, Login, Home, Settings, newEvent, eventDetail },
|
components: { Register, Login, Home, Settings, newEvent, eventDetail },
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['logged', 'user', 'filters', 'tags', 'places']),
|
...mapState(['logged', 'user', 'filters', 'tags', 'places']),
|
||||||
filters_tags: {
|
filters_tags: {
|
||||||
set (value) {
|
set (value) {
|
||||||
console.log('dentro set ', value)
|
|
||||||
this.setSearchTags(value)
|
this.setSearchTags(value)
|
||||||
},
|
},
|
||||||
get () {
|
get () {
|
||||||
console.log('dentro get')
|
|
||||||
console.log(this.filters)
|
|
||||||
return this.filters.tags
|
return this.filters.tags
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
import { mapState, mapActions } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
import filters from '@/filters'
|
import filters from '@/filters'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import { intersection } from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Calendar',
|
name: 'Calendar',
|
||||||
|
@ -58,7 +59,21 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['events', 'tags']),
|
filteredEvents () {
|
||||||
|
if (!this.filters.tags.length && !this.filters.places.length) return this.events
|
||||||
|
return this.events.filter(e => {
|
||||||
|
if (this.filters.tags.length) {
|
||||||
|
const m = intersection(e.tags.map(t => t.tag), this.filters.tags)
|
||||||
|
if (m.length>0) return true
|
||||||
|
}
|
||||||
|
if (this.filters.places.length) {
|
||||||
|
if (this.filters.places.find(p => p === e.place.name))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
})
|
||||||
|
},
|
||||||
|
...mapState(['events', 'tags', 'filters']),
|
||||||
attributes () {
|
attributes () {
|
||||||
return [
|
return [
|
||||||
{ key: 'todaly', dates: new Date(),
|
{ key: 'todaly', dates: new Date(),
|
||||||
|
@ -67,7 +82,7 @@ export default {
|
||||||
},
|
},
|
||||||
popover: {label: this.$t('Today')}
|
popover: {label: this.$t('Today')}
|
||||||
},
|
},
|
||||||
...this.events.map(this.eventToAttribute)
|
...this.filteredEvents.map(this.eventToAttribute)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
b-card(bg-variant='dark' text-variant='white'
|
b-card(bg-variant='dark' text-variant='white'
|
||||||
@click='$router.push("/event/" + event.id)'
|
@click='$router.push("/event/" + event.id)'
|
||||||
:img-src='imgPath')
|
:img-src='imgPath')
|
||||||
h4 {{event.title}}
|
h5 {{event.title}}
|
||||||
div <v-icon name='clock'/> {{event.start_datetime|datetime}}
|
div <v-icon name='clock'/> {{event.start_datetime|datetime}}
|
||||||
span(v-b-popover.hover="event.place && event.place.address || ''") <v-icon name='map-marker-alt'/> {{event.place.name}}
|
span(v-b-popover.hover="event.place && event.place.address || ''") <v-icon name='map-marker-alt'/> {{event.place.name}}
|
||||||
br
|
br
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
img(v-if='event.image_path' slot="aside" :src="imgPath(event)" alt="Media Aside" style='max-height: 60px')
|
img(v-if='event.image_path' slot="aside" :src="imgPath(event)" alt="Media Aside" style='max-height: 60px')
|
||||||
small.float-right {{event.start_datetime|short_datetime}}
|
small.float-right {{event.start_datetime|short_datetime}}
|
||||||
h5.mb-1 {{event.title}}
|
h5.mb-1 {{event.title}}
|
||||||
small.mb-1 {{event.description}}
|
|
||||||
b-badge.float-right.ml-1(v-for='tag in event.tags') {{tag.tag}}
|
b-badge.float-right.ml-1(v-for='tag in event.tags') {{tag.tag}}
|
||||||
small.float-right(v-b-popover.hover='event.place.address') {{event.place.name}}
|
small.float-right(v-b-popover.hover='event.place.address') {{event.place.name}}
|
||||||
Calendar(v-else)
|
Calendar(v-else)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
div
|
div
|
||||||
b-badge.mr-1(@click="removeSelected(sel)"
|
b-badge.mr-1(@click="removeSelected(sel)"
|
||||||
v-for="sel in selectedLabel"
|
v-for="sel in selectedLabel"
|
||||||
:key="sel") {{sel}}
|
:key="sel") <v-icon color='orange' name='times' /> {{sel}}
|
||||||
|
|
||||||
b-list-group.groupMenu(v-show='showDropdown')
|
b-list-group.groupMenu(v-show='showDropdown')
|
||||||
b-list-group-item(:key="$index" v-for="(item, $index) in matched"
|
b-list-group-item(:key="$index" v-for="(item, $index) in matched"
|
||||||
|
|
|
@ -62,6 +62,8 @@ export default new Vuex.Store({
|
||||||
addSearchTag (state, tag) {
|
addSearchTag (state, tag) {
|
||||||
if (!state.filters.tags.find(t => t === tag.tag)) {
|
if (!state.filters.tags.find(t => t === tag.tag)) {
|
||||||
state.filters.tags.push(tag.tag)
|
state.filters.tags.push(tag.tag)
|
||||||
|
} else {
|
||||||
|
state.filters.tags = state.filters.tags.filter(t => t !== tag.tag)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setSearchTags (state, tags) {
|
setSearchTags (state, tags) {
|
||||||
|
|
Loading…
Reference in a new issue