mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
user-groups: Add function wrappers to reduce variable scope.
Extract set_up_typeahead function. Extract pill_remove function.
This commit is contained in:
@@ -23,7 +23,6 @@ exports.reload = function () {
|
||||
exports.populate_user_groups = function () {
|
||||
var user_groups_section = $('#user-groups').expectOne();
|
||||
var user_groups_array = user_groups.get_realm_user_groups();
|
||||
|
||||
_.each(user_groups_array, function (data) {
|
||||
user_groups_section.append(templates.render('admin_user_group_list', {
|
||||
user_group: {
|
||||
@@ -197,7 +196,7 @@ exports.populate_user_groups = function () {
|
||||
});
|
||||
|
||||
var input = pill_container.children('.input');
|
||||
|
||||
(function set_up_typeahead() {
|
||||
input.typeahead({
|
||||
items: 5,
|
||||
fixed: true,
|
||||
@@ -224,7 +223,9 @@ exports.populate_user_groups = function () {
|
||||
},
|
||||
stopAdvance: true,
|
||||
});
|
||||
}());
|
||||
|
||||
(function pill_remove() {
|
||||
pills.onPillRemove(function () {
|
||||
// onPillRemove is fired before the pill is removed from
|
||||
// the DOM.
|
||||
@@ -233,13 +234,12 @@ exports.populate_user_groups = function () {
|
||||
input.focus();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
}());
|
||||
});
|
||||
};
|
||||
|
||||
exports.set_up = function () {
|
||||
meta.loaded = true;
|
||||
|
||||
exports.populate_user_groups();
|
||||
|
||||
$(".organization").on("submit", "form.admin-user-group-form", function (e) {
|
||||
|
||||
Reference in New Issue
Block a user