zulip/static/js/settings_toggle.js
Steve Howell db514002ec settings: Use separate lists for the two sidebar panels.
The list with the options for normal settings now has
the class normal-settings-list.

The list with the options for org settings now has
the class org-settings-list.

The new markup helps us avoid code like this:

    $(".settings-list li:not(.admin)")

We also have funny hacks in our key handlers related
to the old combined-list approach, which we can
eventually eliminate.
2018-06-06 09:42:33 -07:00

49 lines
1.3 KiB
JavaScript

var settings_toggle = (function () {
var exports = {};
var toggler;
exports.highlight_toggle = function (tab_name) {
if (toggler) {
toggler.goto(tab_name, { dont_switch_tab: true });
}
};
exports.initialize = function () {
toggler = components.toggle({
values: [
{ label: i18n.t("Settings"), key: "settings" },
{ label: i18n.t("Organization"), key: "organization" },
],
callback: function (name, key, payload) {
var normal_list = $('.normal-settings-list');
var org_list = $('.org-settings-list');
if (key === "organization") {
normal_list.hide();
org_list.show();
if (!payload.dont_switch_tab) {
$("li[data-section='organization-profile']").click();
}
} else {
org_list.hide();
normal_list.show();
if (!payload.dont_switch_tab) {
$("li[data-section='your-account']").click();
}
}
},
});
$("#settings_overlay_container .tab-container").append(toggler.get());
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = settings_toggle;
}