filteredEventsWithPast, check db connection

This commit is contained in:
lesion
2019-06-26 15:44:26 +02:00
parent 665939a883
commit 491fc11d78
8 changed files with 50 additions and 37 deletions

View File

@@ -39,8 +39,8 @@ export default {
},
},
computed: {
...mapGetters(['filteredEvents']),
...mapState(['tags']),
...mapGetters(['filteredEventsWithPast']),
...mapState(['tags', 'filters']),
attributes () {
const colors = ['indigo', 'orange', 'yellow', 'green', 'teal', 'blue', 'red', 'purple', 'pink', 'grey']
const tags = take(this.tags, 10).map(t=>t.tag)
@@ -48,8 +48,9 @@ export default {
let attributes = []
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'green' }})
const that = this
function getColor(event) {
const color = { class: event.past ? 'past-event vc-rounded-full' : 'vc-rounded-full', color: 'blue' }
const color = { class: event.past && !that.filters.show_past_events ? 'past-event vc-rounded-full' : 'vc-rounded-full', color: 'blue' }
const tag = get(event, 'tags[0].tag')
if (!tag) return color
const idx = tags.indexOf(tag)
@@ -58,14 +59,14 @@ export default {
return color
}
attributes = attributes.concat(this.filteredEvents
attributes = attributes.concat(this.filteredEventsWithPast
.filter(e => !e.multidate)
.map(e => ({
key: e.id,
dot: getColor(e),
dates: new Date(e.start_datetime*1000)})))
attributes = attributes.concat(this.filteredEvents
attributes = attributes.concat(this.filteredEventsWithPast
.filter(e => e.multidate)
.map( e => ({ key: e.id, highlight: getColor(e), dates: {
start: new Date(e.start_datetime*1000), end: new Date(e.end_datetime*1000) }})))