diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-15 16:31:28 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-26 16:15:14 +0100 |
commit | 6532fe8e246e87dffb5a9768e8ed0f3d691c0036 (patch) | |
tree | 607da40835c26671364ee1161df12ec142923323 /settings/js | |
parent | a9a6d4c1826c7d1c1d11af9af349b67ba5af4923 (diff) | |
download | nextcloud-server-6532fe8e246e87dffb5a9768e8ed0f3d691c0036.tar.gz nextcloud-server-6532fe8e246e87dffb5a9768e8ed0f3d691c0036.zip |
Allow searching by author name and app level as well
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/apps.js | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js index bb3b1b85c3b..89169837b85 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -414,17 +414,46 @@ OC.Settings.Apps = OC.Settings.Apps || { }, filter: function(query) { + var $appList = $('#apps-list'); + if (query === '') { + $appList.find('.section').removeClass('hidden'); + return; + } query = query.toLowerCase(); - $('#apps-list').find('.section').addClass('hidden'); + $appList.find('.section').addClass('hidden'); + // App Name var apps = _.filter(OC.Settings.Apps.State.apps, function (app) { return app.name.toLowerCase().indexOf(query) !== -1; }); + // App Description apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) { return app.description.toLowerCase().indexOf(query) !== -1; })); + // Author Name + apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) { + return app.author.toLowerCase().indexOf(query) !== -1; + })); + + // App status + if (t('settings', 'Official').toLowerCase().indexOf(query) !== -1) { + apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) { + return app.level === 200; + })); + } + if (t('settings', 'Approved').toLowerCase().indexOf(query) !== -1) { + apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) { + return app.level === 100; + })); + } + if (t('settings', 'Experimental').toLowerCase().indexOf(query) !== -1) { + apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) { + return app.level !== 100 && app.level !== 200; + })); + } + apps = _.uniq(apps, function(app){return app.id;}); _.each(apps, function (app) { |