mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 12:54:58 +00:00
web: Move web app to ‘web’ directory.
Ever since we started bundling the app with webpack, there’s been less and less overlap between our ‘static’ directory (files belonging to the frontend app) and Django’s interpretation of the ‘static’ directory (files served directly to the web). Split the app out to its own ‘web’ directory outside of ‘static’, and remove all the custom collectstatic --ignore rules. This makes it much clearer what’s actually being served to the web, and what’s being bundled by webpack. It also shrinks the release tarball by 3%. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
67
web/src/settings_toggle.js
Normal file
67
web/src/settings_toggle.js
Normal file
@@ -0,0 +1,67 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as components from "./components";
|
||||
import {$t} from "./i18n";
|
||||
import * as settings_panel_menu from "./settings_panel_menu";
|
||||
|
||||
let toggler;
|
||||
|
||||
export function highlight_toggle(tab_name) {
|
||||
if (toggler) {
|
||||
toggler.goto(tab_name);
|
||||
}
|
||||
}
|
||||
|
||||
export function initialize() {
|
||||
toggler = components.toggle({
|
||||
child_wants_focus: true,
|
||||
values: [
|
||||
{label: $t({defaultMessage: "Personal"}), key: "settings"},
|
||||
{label: $t({defaultMessage: "Organization"}), key: "organization"},
|
||||
],
|
||||
callback(name, key) {
|
||||
if (key === "organization") {
|
||||
settings_panel_menu.show_org_settings();
|
||||
} else {
|
||||
settings_panel_menu.show_normal_settings();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
settings_panel_menu.set_key_handlers(toggler);
|
||||
|
||||
$("#settings_overlay_container .tab-container").append(toggler.get());
|
||||
}
|
||||
|
||||
// Handles the collapse/reveal of some tabs in the org settings for non-admins.
|
||||
export function toggle_org_setting_collapse() {
|
||||
const is_collapsed = $(".collapse-org-settings").hasClass("hide-org-settings");
|
||||
const show_fewer_settings_text = $t({defaultMessage: "Show fewer"});
|
||||
const show_more_settings_text = $t({defaultMessage: "Show more"});
|
||||
|
||||
if (is_collapsed) {
|
||||
for (const elem of $(".collapse-org-settings")) {
|
||||
$(elem).removeClass("hide-org-settings");
|
||||
}
|
||||
|
||||
$("#toggle_collapse_chevron").removeClass("fa-angle-double-down");
|
||||
$("#toggle_collapse_chevron").addClass("fa-angle-double-up");
|
||||
|
||||
$("#toggle_collapse").text(show_fewer_settings_text);
|
||||
} else {
|
||||
for (const elem of $(".collapse-org-settings")) {
|
||||
$(elem).addClass("hide-org-settings");
|
||||
}
|
||||
|
||||
$("#toggle_collapse_chevron").removeClass("fa-angle-double-up");
|
||||
$("#toggle_collapse_chevron").addClass("fa-angle-double-down");
|
||||
|
||||
$("#toggle_collapse").text(show_more_settings_text);
|
||||
}
|
||||
|
||||
// If current tab is about to be collapsed, go to default tab.
|
||||
const $current_tab = $(".org-settings-list .active");
|
||||
if ($current_tab.hasClass("hide-org-settings")) {
|
||||
$(location).attr("href", "/#organization/organization-profile");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user