Skip to content
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

[IMPROVE] Displays Nothing found on admin sidebar when search returns nothing #16255

Merged
merged 1 commit into from
Mar 11, 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
6 changes: 6 additions & 0 deletions app/ui-admin/client/adminFlex.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ <h3 class="rooms-list__type">{{_ "Settings"}}</h3>
<ul class="rooms-list__list">
{{#each groups}}
{{> sidebarItem menuItem label false "admin" _id }}
{{else}}
<div class="rc-input sidebar-flex__search">
<div class="rc-input__wrapper">
<p>{{_ "Nothing_found"}}.</p>
</div>
</div>
{{/each}}
</ul>
{{/if}}
Expand Down
5 changes: 4 additions & 1 deletion app/ui-admin/client/adminFlex.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Template.adminFlex.helpers({
const query = {
type: 'group',
};
let groups = [];
if (filter) {
const filterRegex = new RegExp(s.escapeRegExp(filter), 'i');
const records = settings.collectionPrivate.find().fetch();
let groups = [];
records.forEach(function(record) {
if (filterRegex.test(TAPi18n.__(record.i18nLabel || record._id))) {
groups.push(record.group || record._id);
Expand All @@ -50,6 +50,9 @@ Template.adminFlex.helpers({
};
}
}
if (filter && groups.length === 0) {
return 0;
}
return settings.collectionPrivate.find(query).fetch().map(function(el) {
el.label = label.apply(el);
return el;
Expand Down