settings: Extract delete_user_group().

This preps us to make delete_user_group() be
a callback in the next commit.
This commit is contained in:
Steve Howell
2018-09-12 18:45:41 +00:00
committed by Tim Abbott
parent b7f764aa29
commit 19ca7145fc

View File

@@ -299,19 +299,24 @@ exports.set_up = function () {
}
var user_group = user_groups.get_user_group_from_id(group_id);
var btn = $(this);
channel.del({
url: "/json/user_groups/" + group_id,
data: {
id: group_id,
},
success: function () {
user_groups.remove(user_group);
settings_user_groups.reload();
},
error: function () {
btn.text(i18n.t("Failed!"));
},
});
function delete_user_group() {
channel.del({
url: "/json/user_groups/" + group_id,
data: {
id: group_id,
},
success: function () {
user_groups.remove(user_group);
settings_user_groups.reload();
},
error: function () {
btn.text(i18n.t("Failed!"));
},
});
}
delete_user_group();
});
$('#user-groups').on('keypress', '.user-group h4 > span', function (e) {