summaryrefslogtreecommitdiffstats
path: root/settings/js/apps.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-10 14:30:02 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-10 14:30:02 +0200
commita064536ec13c8effb5e97b152e1949bc6dab6612 (patch)
tree07a316f0fd80f33fc5dbd3c4a95e6da32fca8576 /settings/js/apps.js
parent0d28ba06625466adda4cc985d701962843eb5be2 (diff)
downloadnextcloud-server-a064536ec13c8effb5e97b152e1949bc6dab6612.tar.gz
nextcloud-server-a064536ec13c8effb5e97b152e1949bc6dab6612.zip
Fixed select2 for admin and apps page
Added explicit escaping. Now internally using a pipe symbol as separator for select2, to make it possible to use group names containing commas.
Diffstat (limited to 'settings/js/apps.js')
-rw-r--r--settings/js/apps.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 20b0c5ce18f..22bac1eaf3e 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -123,10 +123,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find("label[for='groups_enable']").hide();
page.find("#groups_enable").attr('checked', null);
} else {
- $('#group_select').val((app.groups || []).join(','));
if (app.active) {
if (app.groups.length) {
OC.Settings.Apps.setupGroupsSelect();
+ $('#group_select').select2('val', app.groups || []);
page.find("#groups_enable").attr('checked','checked');
} else {
page.find("#groups_enable").attr('checked', null);
@@ -378,14 +378,10 @@ $(document).ready(function(){
}
});
- $('#group_select').change(function() {
+ $('#group_select').change(function(ev) {
var element = $('#app-content input.enable');
- var groups = $(this).val();
- if (groups && groups !== '') {
- groups = groups.split(',');
- } else {
- groups = [];
- }
+ // getting an array of values from select2
+ var groups = ev.val || [];
var appid = element.data('appid');
if (appid) {
OC.Settings.Apps.enableApp(appid, false, element, groups);