Skip to content

Commit cfc845f

Browse files
feat: add search feature in schedule page (#5823)
Co-authored-by: Areeb Jamal <jamal.areeb@gmail.com>
1 parent 11b6b36 commit cfc845f

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

app/controllers/public/sessions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import moment from 'moment';
66
@classic
77
export default class SessionsController extends Controller {
88

9-
queryParams = ['sort'];
9+
queryParams = ['sort', 'search'];
10+
search = null;
1011
sort = 'starts-at';
1112
isTrackVisible = false;
1213
timezone = null;

app/routes/public/sessions.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export default class SessionsRoute extends Route {
1616
},
1717
room: {
1818
refreshModel: true
19+
},
20+
search: {
21+
refreshModel: true
1922
}
2023
};
2124

@@ -87,6 +90,45 @@ export default class SessionsRoute extends Route {
8790
});
8891
}
8992

93+
if (params.search) {
94+
filterOptions.push({
95+
or: [
96+
{
97+
name : 'title',
98+
op : 'ilike',
99+
val : `%${params.search}%`
100+
},
101+
{
102+
name : 'track',
103+
op : 'has',
104+
val : {
105+
name : 'name',
106+
op : 'ilike',
107+
val : `%${params.search}%`
108+
}
109+
},
110+
{
111+
name : 'microlocation',
112+
op : 'has',
113+
val : {
114+
name : 'name',
115+
op : 'ilike',
116+
val : `%${params.search}%`
117+
}
118+
},
119+
{
120+
name : 'speakers',
121+
op : 'any',
122+
val : {
123+
name : 'name',
124+
op : 'ilike',
125+
val : `%${params.search}%`
126+
}
127+
}
128+
]
129+
});
130+
}
131+
90132
return {
91133
event : eventDetails,
92134
session : await this.infinity.model('sessions', {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="ui small icon input search-box">
1+
<div class="ui {{if (eq @size "large") '' 'small'}} icon input search-box">
22
<Input @type="text" @value={{readonly this.searchQuery}} @keyUp={{action 'setSearchQuery' value="target.value"}} placeholder="Search ..." />
33
<i class="search icon"></i>
44
</div>

app/templates/public/sessions.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
@eventTimezone={{this.model.event.timezone}}
1313
@timezone={{this.timezone}} />
1414

15+
<Tables::Utilities::SearchBox
16+
class="mb-2 mr-2"
17+
@searchQuery={{this.search}}
18+
@size="large"
19+
/>
20+
1521
<UiDropdown class="labeled icon button mb-2">
1622
<i class="sort amount down icon"></i>
1723
<span class="default text">{{if (eq this.sort 'title') (t 'By Title') (t 'By Time')}}</span>

0 commit comments

Comments
 (0)