summaryrefslogtreecommitdiffstats
path: root/settings/js/apps.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-09 18:00:53 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-09 18:04:00 +0200
commit0d28ba06625466adda4cc985d701962843eb5be2 (patch)
tree8313afc1f99c59f09847d1cc03fef75f2dda78b7 /settings/js/apps.js
parent39f5580cdf154256a7586fa57c8e7f094a9721a9 (diff)
downloadnextcloud-server-0d28ba06625466adda4cc985d701962843eb5be2.tar.gz
nextcloud-server-0d28ba06625466adda4cc985d701962843eb5be2.zip
Added select2 on the apps page
Moved setupGroupsSelect() from admin.js to a common settings.js as OC.Settings.setupGoupsSelect(). Now using select2 as well on the apps page.
Diffstat (limited to 'settings/js/apps.js')
-rw-r--r--settings/js/apps.js35
1 files changed, 19 insertions, 16 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index e808e51e936..20b0c5ce18f 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -7,6 +7,11 @@
OC.Settings = OC.Settings || {};
OC.Settings.Apps = OC.Settings.Apps || {
+ setupGroupsSelect: function() {
+ OC.Settings.setupGroupsSelect($('#group_select'), {
+ placeholder: t('core', 'All')
+ });
+ },
loadApp:function(app) {
var page = $('#app-content');
page.find('p.license').show();
@@ -112,23 +117,16 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find(".warning").hide();
}
- page.find("div.multiselect").parent().remove();
if(OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) {
page.find("#groups_enable").hide();
page.find("label[for='groups_enable']").hide();
page.find("#groups_enable").attr('checked', null);
} else {
- $('#group_select > option').each(function (i, el) {
- if (app.groups.length === 0 || app.groups.indexOf(el.value) >= 0) {
- $(el).attr('selected', 'selected');
- } else {
- $(el).attr('selected', null);
- }
- });
+ $('#group_select').val((app.groups || []).join(','));
if (app.active) {
if (app.groups.length) {
- $('#group_select').multiSelect();
+ OC.Settings.Apps.setupGroupsSelect();
page.find("#groups_enable").attr('checked','checked');
} else {
page.find("#groups_enable").attr('checked', null);
@@ -383,6 +381,11 @@ $(document).ready(function(){
$('#group_select').change(function() {
var element = $('#app-content input.enable');
var groups = $(this).val();
+ if (groups && groups !== '') {
+ groups = groups.split(',');
+ } else {
+ groups = [];
+ }
var appid = element.data('appid');
if (appid) {
OC.Settings.Apps.enableApp(appid, false, element, groups);
@@ -404,14 +407,14 @@ $(document).ready(function(){
}
$("#groups_enable").change(function() {
+ var $select = $('#group_select');
+ $select.val('');
if (this.checked) {
- $("div.multiselect").parent().remove();
- $('#group_select').multiSelect();
- } else {
- $('#group_select').hide().val(null);
- $("div.multiselect").parent().remove();
+ OC.Settings.Apps.setupGroupsSelect();
}
-
- $('#group_select').change();
+ else {
+ $select.select2('destroy');
+ }
+ $select.change();
});
});