Allow searching by author name and app level as well
This commit is contained in:
parent
a9a6d4c182
commit
6532fe8e24
|
@ -414,17 +414,46 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
},
|
},
|
||||||
|
|
||||||
filter: function(query) {
|
filter: function(query) {
|
||||||
|
var $appList = $('#apps-list');
|
||||||
|
if (query === '') {
|
||||||
|
$appList.find('.section').removeClass('hidden');
|
||||||
|
return;
|
||||||
|
}
|
||||||
query = query.toLowerCase();
|
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) {
|
var apps = _.filter(OC.Settings.Apps.State.apps, function (app) {
|
||||||
return app.name.toLowerCase().indexOf(query) !== -1;
|
return app.name.toLowerCase().indexOf(query) !== -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// App Description
|
||||||
apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) {
|
apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) {
|
||||||
return app.description.toLowerCase().indexOf(query) !== -1;
|
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;});
|
apps = _.uniq(apps, function(app){return app.id;});
|
||||||
|
|
||||||
_.each(apps, function (app) {
|
_.each(apps, function (app) {
|
||||||
|
|
Loading…
Reference in New Issue