diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-09-09 18:00:53 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-09-09 18:04:00 +0200 |
commit | 0d28ba06625466adda4cc985d701962843eb5be2 (patch) | |
tree | 8313afc1f99c59f09847d1cc03fef75f2dda78b7 /settings/js/admin.js | |
parent | 39f5580cdf154256a7586fa57c8e7f094a9721a9 (diff) | |
download | nextcloud-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/admin.js')
-rw-r--r-- | settings/js/admin.js | 63 |
1 files changed, 1 insertions, 62 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js index d38c770a28a..943bf78e024 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -1,64 +1,3 @@ -var SharingGroupList = { - setupGroupsSelect: function($elements) { - if ($elements.length > 0) { - // note: settings are saved through a "change" event registered - // on all input fields - $elements.select2({ - placeholder: t('core', 'Groups'), - allowClear: true, - multiple: true, - ajax: { - url: OC.generateUrl('/settings/ajax/grouplist'), - dataType: 'json', - quietMillis: 100, - data: function (term) { - return { - pattern: term, //search term - }; - }, - results: function (data) { - if (data.status === "success") { - var results = []; - - // add groups - $.each(data.data.adminGroups, function(i, group) { - results.push({id:group.id, displayname:group.name}); - }); - $.each(data.data.groups, function(i, group) { - results.push({id:group.id, displayname:group.name}); - }); - - return {results: results}; - } else { - //FIXME add error handling - } - } - }, - id: function(element) { - return element.id; - }, - initSelection: function(element, callback) { - var selection = - _.map(($(element).val() || []).split(',').sort(), - function(groupName) { - return { - id: groupName, - displayname: groupName - }; - }); - callback(selection); - }, - formatResult: function (element) { - return element.displayname; - }, - formatSelection: function (element) { - return element.displayname; - } - }); - } - } -}; - $(document).ready(function(){ var params = OC.Util.History.parseUrlQuery(); @@ -80,7 +19,7 @@ $(document).ready(function(){ $('#excludedGroups').each(function (index, element) { - SharingGroupList.setupGroupsSelect($(element)); + OC.Settings.setupGroupsSelect($(element)); }); |