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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:18:22 -08:00 committed by Tim Abbott
parent 8e8a2840c4
commit 4d738ebe15
7 changed files with 17 additions and 21 deletions

View File

@ -157,7 +157,6 @@
"search_pill_widget": false,
"settings": false,
"settings_bots": false,
"settings_display": false,
"settings_emoji": false,
"settings_exports": false,
"settings_linkifiers": false,

View File

@ -58,7 +58,8 @@ rewiremock("../../static/js/scroll_bar").with(scroll_bar);
const settings_account = {__esModule: true};
rewiremock("../../static/js/settings_account").with(settings_account);
const settings_bots = set_global("settings_bots", {});
const settings_display = set_global("settings_display", {});
const settings_display = {__esModule: true};
rewiremock("../../static/js/settings_display").with(settings_display);
const settings_emoji = set_global("settings_emoji", {});
const settings_exports = set_global("settings_exports", {});
const settings_invites = set_global("settings_invites", {});

View File

@ -35,7 +35,6 @@ import "../server_events";
import "../zulip";
import "../templates";
import "../dropdown_list_widget";
import "../settings_display";
import "../settings_notifications";
import "../settings_bots";
import "../settings_sections";

View File

@ -29,7 +29,6 @@ declare let recent_topics: any;
declare let search_pill_widget: any;
declare let settings: any;
declare let settings_bots: any;
declare let settings_display: any;
declare let settings_emoji: any;
declare let settings_exports: any;
declare let settings_invites: any;

View File

@ -23,6 +23,7 @@ import * as reload from "./reload";
import * as scroll_bar from "./scroll_bar";
import * as settings_account from "./settings_account";
import * as settings_config from "./settings_config";
import * as settings_display from "./settings_display";
import * as starred_messages from "./starred_messages";
import * as stream_data from "./stream_data";
import * as stream_events from "./stream_events";

View File

@ -1,12 +1,10 @@
"use strict";
const channel = require("./channel");
const emojisets = require("./emojisets");
const loading = require("./loading");
const overlays = require("./overlays");
const settings_config = require("./settings_config");
const settings_ui = require("./settings_ui");
const ui_report = require("./ui_report");
import * as channel from "./channel";
import * as emojisets from "./emojisets";
import * as loading from "./loading";
import * as overlays from "./overlays";
import * as settings_config from "./settings_config";
import * as settings_ui from "./settings_ui";
import * as ui_report from "./ui_report";
const meta = {
loaded: false,
@ -34,7 +32,7 @@ function change_display_setting(data, status_element, success_msg, sticky) {
);
}
exports.set_up = function () {
export function set_up() {
meta.loaded = true;
$("#display-settings-status").hide();
@ -151,9 +149,9 @@ exports.set_up = function () {
const data = {translate_emoticons: JSON.stringify(this.checked)};
change_display_setting(data, "#emoji-settings-status");
});
};
}
exports.report_emojiset_change = async function () {
export async function report_emojiset_change() {
// TODO: Clean up how this works so we can use
// change_display_setting. The challenge is that we don't want to
// report success before the server_events request returns that
@ -173,9 +171,9 @@ exports.report_emojiset_change = async function () {
const spinner = $("#emoji-settings-status").expectOne();
settings_ui.display_checkmark(spinner);
}
};
}
exports.update_page = function () {
export function update_page() {
$("#left_side_userlist").prop("checked", page_params.left_side_userlist);
$("#default_language_name").text(page_params.default_language_name);
$("#translate_emoticons").prop("checked", page_params.translate_emoticons);
@ -184,6 +182,4 @@ exports.update_page = function () {
// TODO: Set emojiset selector here.
// Longer term, we'll want to automate this function
};
window.settings_display = exports;
}

View File

@ -3,6 +3,7 @@
const alert_words_ui = require("./alert_words_ui");
const attachments_ui = require("./attachments_ui");
const settings_account = require("./settings_account");
const settings_display = require("./settings_display");
const settings_muting = require("./settings_muting");
const load_func_dict = new Map(); // group -> function