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