Changed select2 dropdowns to be in alphabetical format. Fixes #899

pull/919/merge
Jordan Wright 2018-01-13 18:12:09 -06:00
parent e995b0fcb7
commit 8def08f46d
No known key found for this signature in database
GPG Key ID: 138D5AD2331B3C11
2 changed files with 16 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,9 @@ function launch() {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
groups = [] groups = []
$("#users").select2("data").forEach(function (group) { $("#users").select2("data").forEach(function (group) {
groups.push({ name: group.text }); groups.push({
name: group.text
});
}) })
// Validate our fields // Validate our fields
campaign = { campaign = {
@ -353,4 +355,15 @@ $(document).ready(function () {
$.fn.select2.defaults.set("width", "100%"); $.fn.select2.defaults.set("width", "100%");
$.fn.select2.defaults.set("dropdownParent", $("#modal_body")); $.fn.select2.defaults.set("dropdownParent", $("#modal_body"));
$.fn.select2.defaults.set("theme", "bootstrap"); $.fn.select2.defaults.set("theme", "bootstrap");
$.fn.select2.defaults.set("sorter", function (data) {
return data.sort(function (a, b) {
if (a.text.toLowerCase() > b.text.toLowerCase()) {
return 1;
}
if (a.text.toLowerCase() < b.text.toLowerCase()) {
return -1;
}
return 0;
});
})
}) })