js: Convert static/js/settings.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:23:16 -08:00 committed by Tim Abbott
parent 65840a2001
commit 972a52ca99
7 changed files with 26 additions and 26 deletions

View File

@ -155,7 +155,6 @@
"realm_night_logo": false,
"recent_topics": false,
"search_pill_widget": false,
"settings": false,
"settings_profile_fields": false,
"stream_list": false,
"StripeCheckout": false,

View File

@ -34,7 +34,8 @@ rewiremock("../../static/js/message_viewport").with(message_viewport);
const narrow = set_global("narrow", {});
const overlays = {__esModule: true};
rewiremock("../../static/js/overlays").with(overlays);
const settings = set_global("settings", {});
const settings = {__esModule: true};
rewiremock("../../static/js/settings").with(settings);
const subs = set_global("subs", {});
const ui_util = {__esModule: true};
rewiremock("../../static/js/ui_util").with(ui_util);

View File

@ -4,6 +4,7 @@ const render_admin_tab = require("../templates/admin_tab.hbs");
const render_settings_organization_settings_tip = require("../templates/settings/organization_settings_tip.hbs");
const overlays = require("./overlays");
const settings = require("./settings");
const settings_bots = require("./settings_bots");
const settings_config = require("./settings_config");
const settings_data = require("./settings_data");

View File

@ -27,7 +27,6 @@ declare let pointer: any;
declare let reactions: any;
declare let recent_topics: any;
declare let search_pill_widget: any;
declare let settings: any;
declare let settings_profile_fields: any;
declare let stream_list: any;
declare let subs: any;

View File

@ -7,6 +7,7 @@ import * as message_viewport from "./message_viewport";
import * as navigate from "./navigate";
import * as overlays from "./overlays";
import * as search from "./search";
import * as settings from "./settings";
import * as settings_panel_menu from "./settings_panel_menu";
import * as top_left_corner from "./top_left_corner";
import * as ui_util from "./ui_util";

View File

@ -1,17 +1,17 @@
"use strict";
import timezones from "../generated/timezones.json";
import render_settings_tab from "../templates/settings_tab.hbs";
const timezones = require("../generated/timezones.json");
const render_settings_tab = require("../templates/settings_tab.hbs");
import * as overlays from "./overlays";
import * as people from "./people";
import * as settings_account from "./settings_account";
import * as settings_bots from "./settings_bots";
import * as settings_config from "./settings_config";
import * as settings_notifications from "./settings_notifications";
import * as settings_panel_menu from "./settings_panel_menu";
import * as settings_sections from "./settings_sections";
import * as settings_toggle from "./settings_toggle";
const overlays = require("./overlays");
const people = require("./people");
const settings_account = require("./settings_account");
const settings_bots = require("./settings_bots");
const settings_config = require("./settings_config");
const settings_notifications = require("./settings_notifications");
const settings_panel_menu = require("./settings_panel_menu");
const settings_sections = require("./settings_sections");
const settings_toggle = require("./settings_toggle");
export let settings_label;
$("body").ready(() => {
$("#settings_overlay_container").on("click", (e) => {
@ -33,7 +33,7 @@ $("body").ready(() => {
});
function setup_settings_label() {
exports.settings_label = {
settings_label = {
// settings_notification
enable_online_push_notifications: i18n.t(
"Send mobile notifications even if I'm online (useful for testing)",
@ -67,7 +67,7 @@ function setup_settings_label() {
};
}
exports.build_page = function () {
export function build_page() {
setup_settings_label();
const rendered_settings_tab = render_settings_tab({
@ -79,7 +79,7 @@ exports.build_page = function () {
botserverrc: "botserverrc",
timezones: timezones.timezones,
can_create_new_bots: settings_bots.can_create_new_bots(),
settings_label: exports.settings_label,
settings_label,
demote_inactive_streams_values: settings_config.demote_inactive_streams_values,
color_scheme_values: settings_config.color_scheme_values,
twenty_four_hour_time_values: settings_config.twenty_four_hour_time_values,
@ -94,19 +94,19 @@ exports.build_page = function () {
});
$(".settings-box").html(rendered_settings_tab);
};
}
exports.launch = function (section) {
exports.build_page();
export function launch(section) {
build_page();
admin.build_page();
settings_sections.reset_sections();
overlays.open_settings();
settings_panel_menu.normal_settings.activate_section_or_default(section);
settings_toggle.highlight_toggle("settings");
};
}
exports.set_settings_header = function (key) {
export function set_settings_header(key) {
const header_text = $(
`#settings_page .sidebar-list [data-section='${CSS.escape(key)}'] .text`,
).text();
@ -120,6 +120,4 @@ exports.set_settings_header = function (key) {
" sidebar list. Please add it.",
);
}
};
window.settings = exports;
}

View File

@ -1,6 +1,7 @@
import * as hashchange from "./hashchange";
import * as keydown_util from "./keydown_util";
import * as popovers from "./popovers";
import * as settings from "./settings";
import * as settings_sections from "./settings_sections";
export let normal_settings;