Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-10-15 17:31:28 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2015-10-26 18:15:14 +0300
commit6532fe8e246e87dffb5a9768e8ed0f3d691c0036 (patch)
tree607da40835c26671364ee1161df12ec142923323 /settings/js
parenta9a6d4c1826c7d1c1d11af9af349b67ba5af4923 (diff)
Allow searching by author name and app level as well
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/apps.js31
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) {