Skip to content

Commit

Permalink
code refactor and datatype fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anupam-dagar committed Jun 21, 2019
1 parent 476ed51 commit ee91f3a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
8 changes: 6 additions & 2 deletions app/components/explore/side-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default Component.extend({
customEndDate : null,
showFilters : false,

hideClearFilters: computed('category', 'sub_category', 'event_type', 'startDate', 'endDate', 'location', 'ticket_type', function() {
hideClearFilters: computed('category', 'sub_category', 'event_type', 'startDate', 'endDate', 'location', 'ticket_type', 'cfs', function() {
return !(this.category || this.sub_category || this.event_type || this.startDate || this.endDate || this.location || this.ticket_type || this.cfs !== null);
}),

Expand Down Expand Up @@ -54,7 +54,11 @@ export default Component.extend({
},

selectEventCfs(cfs) {
this.set('cfs', cfs === this.cfs ? null : (cfs === 'open' ? true : false));
console.log('incoming param cfs and current this.cfs', cfs, this.cfs);
console.log('typeof cfs and typeof this.cfs', typeof(cfs), typeof(this.cfs));
this.set('cfs', cfs === this.cfs ? null : cfs);
console.log('value of param cfs are this.set and value of this.cfs are this.set', cfs, this.cfs);
console.log('typeof cfs and typeof this.cfs after this.set', typeof(cfs), typeof(this.cfs));
},

selectDateFilter(dateType) {
Expand Down
3 changes: 1 addition & 2 deletions app/routes/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ export default Route.extend({
}

if (params.cfs) {
let cfsVal = (params.cfs === 'open' ? true : false);
filterOptions.push({
name : 'is_sessions_speakers_enabled',
op : 'eq',
val : cfsVal
val : params.cfs
});
}

Expand Down
8 changes: 4 additions & 4 deletions app/templates/components/explore/side-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@
</span>
<div class="content menu">
<a href="#"
class="link item {{if (eq cfs 'open') 'active'}}"
{{action 'selectEventCfs' 'open'}}>
class="link item {{if cfs 'active'}}"
{{action 'selectEventCfs' true}}>
{{t 'Open'}}
</a>
<a href="#"
class="link item {{if (eq cfs 'closed') 'active'}}"
{{action 'selectEventCfs' 'closed'}}>
class="link item {{unless cfs 'active'}}"
{{action 'selectEventCfs' false}}>
{{t 'Closed'}}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/explore.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{{/if}}
{{#if filters.cfs}}
<div class="ui mini label">
{{if (eq filters.cfs 'true') 'Open' 'Closed'}}
{{if filters.cfs 'Open' 'Closed'}}
<a role="button" {{action 'clearFilter' 'cfs'}}><i class="icon close"></i></a>
</div>
{{/if}}
Expand Down

0 comments on commit ee91f3a

Please sign in to comment.