Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/components/explore/side-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default Component.extend({

customStartDate: moment().toISOString(),

customEndDate: null,
customEndDate : null,
showFilters : false,

hideClearFilters: computed('category', 'sub_category', 'event_type', 'startDate', 'endDate', 'location', function() {
return !(this.category || this.sub_category || this.event_type || this.startDate || this.endDate || this.location !== null);
Expand All @@ -19,6 +20,10 @@ export default Component.extend({
return getDateRanges.bind(this)();
}),

showFiltersOnMobile: computed('device.isMobile', 'showFilters', function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use computed.and instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually had to change the logic because the filters weren't showing up on desktop.. Please review now? @niranjan94

return ((this.device.isMobile && this.showFilters) || !this.device.isMobile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uds5501 could this logic be simplified into

!this.device.isMobile || this.showFilters

}),

actions: {
onLocationChangeHandler(lat, lng) {
this.setProperties({
Expand Down Expand Up @@ -111,6 +116,10 @@ export default Component.extend({
this.set('sub_category', null);
this.set('event_type', null);
this.set('location', null);
},

toggleFilters() {
this.set('showFilters', !this.showFilters);
}
}
});
167 changes: 86 additions & 81 deletions app/templates/components/explore/side-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#g-map lat=37.7833 lng=-122.4167 zoom=2 address=location class='google-maps' as |context|}}
{{g-map-address-marker context address=location onLocationChange=(action 'onLocationChangeHandler')}}
{{/g-map}}
</div>
</div>
<div class="item">
<div class="ui input">
{{widgets/forms/places-autocomplete
Expand All @@ -12,89 +12,94 @@
placeholder=(t 'Enter Location')}}
</div>
</div>
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="right floated dropdown icon"></i>
{{t 'Categories'}}
</span>
<div class="content menu">
{{#each model.eventTopics as |Category| }}
<a href="#"
class="link item {{if (eq category Category.name) 'active'}}" {{action 'selectCategory' Category.name}}>
<i class="caret {{if (eq category Category.name) 'down' 'right'}} icon"></i>
{{Category.name}}
</a>
{{#if (eq category Category.name)}}
{{#each Category.subTopics as |subCategory|}}
<a href="#"
class="link inner item {{if (eq sub_category subCategory.slug) 'active'}}"
{{action 'selectCategory' Category.name subCategory.slug}}>
{{subCategory.name}}
</a>
{{/each}}
{{/if}}
{{/each}}
</div>
{{/ui-accordion}}
</div>
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="dropdown icon"></i>
{{t 'Event Type' }}
</span>
<div class="content menu">
{{#each model.eventTypes as |eventType|}}
<a href="#"
class="link item {{if (eq event_type eventType.name) 'active'}}"
{{action 'selectEventType' eventType.name}}>
{{eventType.name}}
</a>
{{/each}}
</div>
{{/ui-accordion}}
</div>
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="dropdown icon"></i>
{{t 'Date'}}
</span>
<div class="content menu">
{{#each dateRanges as |dateRange|}}
<a href="#" class="link item {{if (eq dateType dateRange.key) 'active'}}" {{action 'selectDateFilter'
dateRange.key}}>
{{dateRange.name}}
{{#if (and (eq dateRange.key 'custom_dates') (eq dateType 'custom_dates'))}}
<div class="explore sub menu">
<div class="ui form">
<div class="grouped fields">
<div class="item field">
<label class="required" for="start_date">{{t 'Starts'}}</label>
{{widgets/forms/date-picker type='text'
value=customStartDate
rangePosition='start'
onChange=(action 'dateValidate')
}}
</div>
<div class="item field">
<label class="required" for="end_date">{{t 'Ends'}}</label>
{{widgets/forms/date-picker type='text'
value=customEndDate
rangePosition='end'
onChange=(action 'onDateChange')
}}
{{#if showFiltersOnMobile}}
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="right floated dropdown icon"></i>
{{t 'Categories'}}
</span>
<div class="content menu">
{{#each model.eventTopics as |Category| }}
<a href="#"
class="link item {{if (eq category Category.name) 'active'}}" {{action 'selectCategory' Category.name}}>
<i class="caret {{if (eq category Category.name) 'down' 'right'}} icon"></i>
{{Category.name}}
</a>
{{#if (eq category Category.name)}}
{{#each Category.subTopics as |subCategory|}}
<a href="#"
class="link inner item {{if (eq sub_category subCategory.slug) 'active'}}"
{{action 'selectCategory' Category.name subCategory.slug}}>
{{subCategory.name}}
</a>
{{/each}}
{{/if}}
{{/each}}
</div>
{{/ui-accordion}}
</div>
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="dropdown icon"></i>
{{t 'Event Type' }}
</span>
<div class="content menu">
{{#each model.eventTypes as |eventType|}}
<a href="#"
class="link item {{if (eq event_type eventType.name) 'active'}}"
{{action 'selectEventType' eventType.name}}>
{{eventType.name}}
</a>
{{/each}}
</div>
{{/ui-accordion}}
</div>
<div class="item">
{{#ui-accordion}}
<span class="title">
<i class="dropdown icon"></i>
{{t 'Date'}}
</span>
<div class="content menu">
{{#each dateRanges as |dateRange|}}
<a href="#" class="link item {{if (eq dateType dateRange.key) 'active'}}" {{action 'selectDateFilter'
dateRange.key}}>
{{dateRange.name}}
{{#if (and (eq dateRange.key 'custom_dates') (eq dateType 'custom_dates'))}}
<div class="explore sub menu">
<div class="ui form">
<div class="grouped fields">
<div class="item field">
<label class="required" for="start_date">{{t 'Starts'}}</label>
{{widgets/forms/date-picker type='text'
value=customStartDate
rangePosition='start'
onChange=(action 'dateValidate')
}}
</div>
<div class="item field">
<label class="required" for="end_date">{{t 'Ends'}}</label>
{{widgets/forms/date-picker type='text'
value=customEndDate
rangePosition='end'
onChange=(action 'onDateChange')
}}
</div>
</div>
</div>
</div>
</div>
{{/if}}
</a>
{{/each}}
</div>
{{/ui-accordion}}
</div>
{{/if}}
</a>
{{/each}}
</div>
{{/ui-accordion}}
</div>
{{/if}}
<div class="item">
<button class="ui red button {{if hideClearFilters 'disabled'}}" {{action 'clearFilters'}}>{{t 'Clear Filters'}}</button>
{{#if device.isMobile}}
<button class="ui blue button" {{action 'toggleFilters'}}>{{if showFiltersOnMobile 'Hide Filters' 'Show Filters'}}</button>
{{/if}}
</div>