Skip to content
1 change: 1 addition & 0 deletions app/components/explore/side-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default class SideBar extends Component {
break;

case 'all_dates':
newStartDate = 'all_date';
break;

case 'today':
Expand Down
47 changes: 32 additions & 15 deletions app/routes/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,37 @@ export default class ExploreRoute extends Route {
]
});
} else if (params.start_date) {
filterOptions.push({
or: [
{
name : 'starts-at',
op : 'ge',
val : params.start_date
},
{
name : 'ends-at',
op : 'ge',
val : params.start_date
}
]
});
if (params.start_date === 'all_date') {
filterOptions.push({
or: [
{
name : 'starts-at',
op : 'le',
val : moment().toISOString()
},
{
name : 'ends-at',
op : 'ge',
val : moment().toISOString()
}
]
});
} else {
filterOptions.push({
or: [
{
name : 'starts-at',
op : 'ge',
val : params.start_date
},
{
name : 'ends-at',
op : 'ge',
val : params.start_date
}
]
});
}
} else if (params.is_past) {
filterOptions.push({
and: [
Expand Down Expand Up @@ -272,7 +289,7 @@ export default class ExploreRoute extends Route {
return this.infinity.model('event', {
include : 'event-topic,event-sub-topic,event-type',
filter : filterOptions,
sort : params.is_past ? '-starts-at' : 'starts-at',
sort : params.is_past || (params.start_date === 'all_date') ? '-starts-at' : 'starts-at',
perPage : 6,
startingPage : 1,
perPageParam : 'page[size]',
Expand Down
2 changes: 1 addition & 1 deletion app/templates/explore.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<a href="#" role="button" {{action 'clearFilter' 'event_type'}}><i class="icon close"></i></a>
</div>
{{/if}}
{{#if this.filters.start_date}}
{{#if (and this.filters.start_date (not-eq this.filters.start_date "all_date"))}}
<div class="ui mini label">
{{general-date this.filters.start_date 'date-short'}}
<a href="#" role="button" {{action 'clearFilter' 'start_date'}}><i class="icon close"></i></a>
Expand Down