mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Make the search box filter apps
This commit is contained in:
parent
88126498a0
commit
3632962000
1 changed files with 28 additions and 1 deletions
|
|
@ -330,11 +330,38 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
$('div#app-'+appId+' .warning')
|
||||
.hide()
|
||||
.text('');
|
||||
}
|
||||
},
|
||||
|
||||
filter: function(query) {
|
||||
query = query.toLowerCase();
|
||||
$('#apps-list').find('.section').hide();
|
||||
|
||||
var apps = _.filter(OC.Settings.Apps.State.apps, function (app) {
|
||||
return app.name.toLowerCase().indexOf(query) !== -1;
|
||||
});
|
||||
|
||||
apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) {
|
||||
return app.description.toLowerCase().indexOf(query) !== -1;
|
||||
}));
|
||||
|
||||
apps = _.uniq(apps, function(app){return app.id;});
|
||||
|
||||
_.each(apps, function (app) {
|
||||
$('#app-' + app.id).show();
|
||||
});
|
||||
|
||||
$('#searchresults').hide();
|
||||
}
|
||||
};
|
||||
|
||||
OC.Settings.Apps.Search = {
|
||||
attach: function (search) {
|
||||
search.setFilter('settings', OC.Settings.Apps.filter);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
OC.Plugins.register('OCA.Search', OC.Settings.Apps.Search);
|
||||
OC.Settings.Apps.loadCategories();
|
||||
|
||||
$(document).on('click', 'ul#apps-categories li', function () {
|
||||
|
|
|
|||
Loading…
Reference in a new issue