diff options
author | Joas Schilling <coding@schilljs.com> | 2018-01-24 13:39:48 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-03-08 17:13:49 +0100 |
commit | 0e2366233afd9ed201841e932757f96f4dd2ebb2 (patch) | |
tree | 8f25f1c1c6878e42b68d181ad7cf1e1607ada41d | |
parent | 82137f443d050c5856071ea5cd5b3569738d6095 (diff) | |
download | nextcloud-server-0e2366233afd9ed201841e932757f96f4dd2ebb2.tar.gz nextcloud-server-0e2366233afd9ed201841e932757f96f4dd2ebb2.zip |
Start fixing Select2 options
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | apps/workflowengine/js/usergroupmembershipplugin.js | 18 | ||||
-rw-r--r-- | settings/js/settings.js | 8 |
2 files changed, 16 insertions, 10 deletions
diff --git a/apps/workflowengine/js/usergroupmembershipplugin.js b/apps/workflowengine/js/usergroupmembershipplugin.js index 1c09e7d5ccd..10f2382db2c 100644 --- a/apps/workflowengine/js/usergroupmembershipplugin.js +++ b/apps/workflowengine/js/usergroupmembershipplugin.js @@ -64,11 +64,11 @@ // add admin groups $.each(response.data.adminGroups, function(id, group) { - results.push({ id: group.id }); + results.push({ id: group.id, displayname: group.name }); }); // add groups $.each(response.data.groups, function(id, group) { - results.push({ id: group.id }); + results.push({ id: group.id, displayname: group.name }); }); // TODO once limit and offset is implemented for groups we should paginate the search results @@ -79,13 +79,21 @@ } }, initSelection: function (element, callback) { - callback({id: element.val()}); + var groupId = element.val(); + if (groupId) { + callback({ + id: groupId, + displayname: groupId + 'FIXME' // FIXME + }); + } else { + callback(); + } }, formatResult: function (element) { - return '<span>' + escapeHTML(element.id) + '</span>'; + return '<span>' + escapeHTML(element.displayname) + '</span>'; }, formatSelection: function (element) { - return '<span title="'+escapeHTML(element.id)+'">'+escapeHTML(element.id)+'</span>'; + return '<span title="'+escapeHTML(element.id)+'">'+escapeHTML(element.displayname)+'</span>'; } }); } diff --git a/settings/js/settings.js b/settings/js/settings.js index 3a1e67f41cd..ad0ab758e9e 100644 --- a/settings/js/settings.js +++ b/settings/js/settings.js @@ -73,12 +73,10 @@ OC.Settings = _.extend(OC.Settings, { return element.id; }, initSelection: function(element, callback) { - var selection = - _.map(($(element).val() || []).split('|').sort(), - function(groupName) { + var selection = _.map(($(element).val() || []).split('|').sort(), function(groupId) { return { - id: groupName, - displayname: groupName + id: groupId, + displayname: groupId + 'FIXME' // FIXME }; }); callback(selection); |