mirror of https://github.com/zulip/zulip.git
46 lines
1.1 KiB
JavaScript
46 lines
1.1 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) {
|
|
$(".sidebar li").hide();
|
|
|
|
if (key === "organization") {
|
|
$("li.admin").show();
|
|
if (!payload.dont_switch_tab) {
|
|
$("li[data-section='organization-profile']").click();
|
|
}
|
|
} else {
|
|
$(".settings-list li:not(.admin)").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;
|
|
}
|