Skip to content

feat: add search feature in schedule page #5823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion app/controllers/public/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import moment from 'moment';
@classic
export default class SessionsController extends Controller {

queryParams = ['sort'];
queryParams = ['sort', 'search'];
search = null;
sort = 'starts-at';
isTrackVisible = false;
timezone = null;
Expand Down
42 changes: 42 additions & 0 deletions app/routes/public/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export default class SessionsRoute extends Route {
},
room: {
refreshModel: true
},
search: {
refreshModel: true
}
};

Expand Down Expand Up @@ -87,6 +90,45 @@ export default class SessionsRoute extends Route {
});
}

if (params.search) {
filterOptions.push({
or: [
{
name : 'title',
op : 'ilike',
val : `%${params.search}%`
},
{
name : 'track',
op : 'has',
val : {
name : 'name',
op : 'ilike',
val : `%${params.search}%`
}
},
{
name : 'microlocation',
op : 'has',
val : {
name : 'name',
op : 'ilike',
val : `%${params.search}%`
}
},
{
name : 'speakers',
op : 'any',
val : {
name : 'name',
op : 'ilike',
val : `%${params.search}%`
}
}
]
});
}

return {
event : eventDetails,
session : await this.infinity.model('sessions', {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/tables/utilities/search-box.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="ui small icon input search-box">
<div class="ui {{if (eq @size "large") '' 'small'}} icon input search-box">
<Input @type="text" @value={{readonly this.searchQuery}} @keyUp={{action 'setSearchQuery' value="target.value"}} placeholder="Search ..." />
<i class="search icon"></i>
</div>
6 changes: 6 additions & 0 deletions app/templates/public/sessions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
@eventTimezone={{this.model.event.timezone}}
@timezone={{this.timezone}} />

<Tables::Utilities::SearchBox
class="mb-2 mr-2"
@searchQuery={{this.search}}
@size="large"
/>

<UiDropdown class="labeled icon button mb-2">
<i class="sort amount down icon"></i>
<span class="default text">{{if (eq this.sort 'title') (t 'By Title') (t 'By Time')}}</span>
Expand Down