Skip to content

Commit 1415ddb

Browse files
Anupam-dagarniranjan94
authored andcommitted
feat: Add CFS filter to sidebar filters in explore route. (#3144)
* feat: Add CFS filter to sidebar filters in explore route. Reference: #3098 * Optimize code block in routes. * fix build. * code refactor and datatype fix. * Fix bool and string type conversion in if condition. * Reimplement the code with string datatype and boolean only for query param. * refine if condition in explore for cfs filter. * refactor code statement for cfsVal and lowercase cfs options. * code refactor * remove comparision with null
1 parent 997ff74 commit 1415ddb

File tree

5 files changed

+47
-9
lines changed

5 files changed

+47
-9
lines changed

app/components/explore/side-bar.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export default Component.extend({
1313
customEndDate : null,
1414
showFilters : false,
1515

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

2020
showAllCategories: computed('category', 'sub_category', function() {
@@ -61,6 +61,10 @@ export default Component.extend({
6161
this.send('selectDateFilter', 'custom_dates');
6262
},
6363

64+
selectEventCfs(cfs) {
65+
this.set('cfs', cfs === this.cfs ? null : cfs);
66+
},
67+
6468
selectDateFilter(dateType) {
6569
let newStartDate = null;
6670
let newEndDate = null;
@@ -128,7 +132,6 @@ export default Component.extend({
128132
},
129133
clearFilterTypes() {
130134
this.set('event_type', null);
131-
132135
},
133136

134137
clearFilters() {
@@ -140,15 +143,13 @@ export default Component.extend({
140143
sub_category : null,
141144
event_type : null,
142145
location : null,
143-
ticket_type : null
146+
ticket_type : null,
147+
cfs : null
144148
});
145-
146-
147149
},
148150

149151
toggleFilters() {
150152
this.set('showFilters', !this.showFilters);
151-
152153
}
153154
}
154155
});

app/controllers/explore.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import Controller from '@ember/controller';
22

33
export default Controller.extend({
4-
queryParams : ['category', 'sub_category', 'event_type', 'start_date', 'end_date', 'location', 'ticket_type'],
4+
queryParams : ['category', 'sub_category', 'event_type', 'start_date', 'end_date', 'location', 'ticket_type', 'cfs'],
55
category : null,
66
sub_category : null,
77
event_type : null,
88
start_date : null,
99
end_date : null,
1010
location : null,
1111
ticket_type : null,
12+
cfs : null,
1213

1314
actions: {
1415
shareEvent(event) {
@@ -37,6 +38,9 @@ export default Controller.extend({
3738
if (filterType === 'ticket_type') {
3839
this.set('ticket_type', null);
3940
}
41+
if (filterType === 'cfs') {
42+
this.set('cfs', null);
43+
}
4044
}
4145
}
4246
});

app/routes/explore.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ export default Route.extend({
7676
val : `%${params.location}%`
7777
});
7878
}
79+
if (params.cfs) {
80+
filterOptions.push({
81+
name : 'is_sessions_speakers_enabled',
82+
op : 'eq',
83+
val : params.cfs === 'open'
84+
});
85+
}
7986

8087
if (params.start_date && params.end_date) {
8188
filterOptions.push({

app/templates/components/explore/side-bar.hbs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@
124124
{{/ui-accordion}}
125125
</div>
126126
{{/if}}
127+
<div class="item">
128+
{{#ui-accordion}}
129+
<span class="title">
130+
<i class="dropdown icon"></i>
131+
{{t 'Event Call For Speakers' }}
132+
</span>
133+
<div class="content menu">
134+
<a href="#"
135+
class="link item {{if (eq cfs 'open') 'active'}}"
136+
{{action 'selectEventCfs' 'open'}}>
137+
{{t 'Open'}}
138+
</a>
139+
<a href="#"
140+
class="link item {{if (eq cfs 'closed') 'active'}}"
141+
{{action 'selectEventCfs' 'closed'}}>
142+
{{t 'Closed'}}
143+
</a>
144+
</div>
145+
{{/ui-accordion}}
146+
</div>
127147
<div class="item">
128148
<button class="ui red button {{if hideClearFilters 'disabled'}}" {{action 'clearFilters'}}>{{t 'Clear Filters'}}</button>
129149
{{#if device.isMobile}}

app/templates/explore.hbs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="ui stackable grid">
22
<div class="four wide column">
3-
{{explore/side-bar model=model category=category sub_category=sub_category event_type=event_type startDate=start_date endDate=end_date location=location ticket_type=ticket_type}}
3+
{{explore/side-bar model=model category=category sub_category=sub_category event_type=event_type startDate=start_date endDate=end_date location=location ticket_type=ticket_type cfs=cfs}}
44
</div>
55
<div class="twelve wide column">
66
<h1 class="ui header">{{t 'Events'}}</h1>
@@ -41,6 +41,12 @@
4141
<a role="button" {{action 'clearFilter' 'ticket_type'}}><i class="icon close"></i></a>
4242
</div>
4343
{{/if}}
44+
{{#if filters.cfs}}
45+
<div class="ui mini label">
46+
{{filters.cfs}}
47+
<a role="button" {{action 'clearFilter' 'cfs'}}><i class="icon close"></i></a>
48+
</div>
49+
{{/if}}
4450
</div>
4551
{{#each filteredEvents as |event|}}
4652
{{event-card event=event isWide=true filterByTags=true category=category subCategory=sub_category eventType=event_type shareEvent=(action 'shareEvent')}}

0 commit comments

Comments
 (0)