diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-01-18 14:52:19 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-02-19 00:01:03 +0100 |
commit | 3632962000311e67447f5e3c97cd33095281c7ba (patch) | |
tree | 608b599634ec42086711c79785f10b8f35c26292 /settings/js | |
parent | 88126498a0308122c178ec5336fe80b1d10079fb (diff) | |
download | nextcloud-server-3632962000311e67447f5e3c97cd33095281c7ba.tar.gz nextcloud-server-3632962000311e67447f5e3c97cd33095281c7ba.zip |
Make the search box filter apps
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/apps.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js index f844bcc08e2..6e78ce2a6e8 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -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 () { |