mirror of https://github.com/zulip/zulip.git
js: Convert static/js/admin.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
972a52ca99
commit
d36c6f23f6
|
@ -125,7 +125,6 @@
|
||||||
"files": ["static/js/**"],
|
"files": ["static/js/**"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"$": false,
|
"$": false,
|
||||||
"admin": false,
|
|
||||||
"blueslip": false,
|
"blueslip": false,
|
||||||
"bot_data": false,
|
"bot_data": false,
|
||||||
"compose_actions": false,
|
"compose_actions": false,
|
||||||
|
|
|
@ -21,7 +21,8 @@ rewiremock("../../static/js/search").with({
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
const history = set_global("history", {});
|
const history = set_global("history", {});
|
||||||
|
|
||||||
const admin = set_global("admin", {});
|
const admin = {__esModule: true};
|
||||||
|
rewiremock("../../static/js/admin").with(admin);
|
||||||
const drafts = {__esModule: true};
|
const drafts = {__esModule: true};
|
||||||
rewiremock("../../static/js/drafts").with(drafts);
|
rewiremock("../../static/js/drafts").with(drafts);
|
||||||
set_global("favicon", {});
|
set_global("favicon", {});
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
"use strict";
|
import render_admin_tab from "../templates/admin_tab.hbs";
|
||||||
|
import render_settings_organization_settings_tip from "../templates/settings/organization_settings_tip.hbs";
|
||||||
|
|
||||||
const render_admin_tab = require("../templates/admin_tab.hbs");
|
import * as overlays from "./overlays";
|
||||||
const render_settings_organization_settings_tip = require("../templates/settings/organization_settings_tip.hbs");
|
import * as settings from "./settings";
|
||||||
|
import * as settings_bots from "./settings_bots";
|
||||||
const overlays = require("./overlays");
|
import * as settings_config from "./settings_config";
|
||||||
const settings = require("./settings");
|
import * as settings_data from "./settings_data";
|
||||||
const settings_bots = require("./settings_bots");
|
import * as settings_emoji from "./settings_emoji";
|
||||||
const settings_config = require("./settings_config");
|
import * as settings_org from "./settings_org";
|
||||||
const settings_data = require("./settings_data");
|
import * as settings_panel_menu from "./settings_panel_menu";
|
||||||
const settings_emoji = require("./settings_emoji");
|
import * as settings_sections from "./settings_sections";
|
||||||
const settings_org = require("./settings_org");
|
import * as settings_toggle from "./settings_toggle";
|
||||||
const settings_panel_menu = require("./settings_panel_menu");
|
|
||||||
const settings_sections = require("./settings_sections");
|
|
||||||
const settings_toggle = require("./settings_toggle");
|
|
||||||
|
|
||||||
const admin_settings_label = {
|
const admin_settings_label = {
|
||||||
// Organization settings
|
// Organization settings
|
||||||
|
@ -50,7 +48,7 @@ function insert_tip_box() {
|
||||||
.prepend(tip_box);
|
.prepend(tip_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.build_page = function () {
|
export function build_page() {
|
||||||
const options = {
|
const options = {
|
||||||
custom_profile_field_types: page_params.custom_profile_field_types,
|
custom_profile_field_types: page_params.custom_profile_field_types,
|
||||||
realm_name: page_params.realm_name,
|
realm_name: page_params.realm_name,
|
||||||
|
@ -143,16 +141,14 @@ exports.build_page = function () {
|
||||||
$("#id_realm_default_twenty_four_hour_time").val(
|
$("#id_realm_default_twenty_four_hour_time").val(
|
||||||
JSON.stringify(page_params.realm_default_twenty_four_hour_time),
|
JSON.stringify(page_params.realm_default_twenty_four_hour_time),
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.launch = function (section) {
|
export function launch(section) {
|
||||||
settings.build_page();
|
settings.build_page();
|
||||||
exports.build_page();
|
build_page();
|
||||||
settings_sections.reset_sections();
|
settings_sections.reset_sections();
|
||||||
|
|
||||||
overlays.open_settings();
|
overlays.open_settings();
|
||||||
settings_panel_menu.org_settings.activate_section_or_default(section);
|
settings_panel_menu.org_settings.activate_section_or_default(section);
|
||||||
settings_toggle.highlight_toggle("organization");
|
settings_toggle.highlight_toggle("organization");
|
||||||
};
|
}
|
||||||
|
|
||||||
window.admin = exports;
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ import "../templates";
|
||||||
import "../dropdown_list_widget";
|
import "../dropdown_list_widget";
|
||||||
import "../settings_profile_fields";
|
import "../settings_profile_fields";
|
||||||
import "../settings";
|
import "../settings";
|
||||||
import "../admin";
|
|
||||||
import "../message_view_header";
|
import "../message_view_header";
|
||||||
import "../bot_data";
|
import "../bot_data";
|
||||||
import "../reactions";
|
import "../reactions";
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// remove each declaration when the corresponding module is migrated
|
// remove each declaration when the corresponding module is migrated
|
||||||
// to TS.
|
// to TS.
|
||||||
|
|
||||||
declare let admin: any;
|
|
||||||
declare let blueslip: any;
|
declare let blueslip: any;
|
||||||
declare let bot_data: any;
|
declare let bot_data: any;
|
||||||
declare let compose_actions: any;
|
declare let compose_actions: any;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as admin from "./admin";
|
||||||
import * as drafts from "./drafts";
|
import * as drafts from "./drafts";
|
||||||
import * as floating_recipient_bar from "./floating_recipient_bar";
|
import * as floating_recipient_bar from "./floating_recipient_bar";
|
||||||
import * as hash_util from "./hash_util";
|
import * as hash_util from "./hash_util";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import timezones from "../generated/timezones.json";
|
import timezones from "../generated/timezones.json";
|
||||||
import render_settings_tab from "../templates/settings_tab.hbs";
|
import render_settings_tab from "../templates/settings_tab.hbs";
|
||||||
|
|
||||||
|
import * as admin from "./admin";
|
||||||
import * as overlays from "./overlays";
|
import * as overlays from "./overlays";
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
import * as settings_account from "./settings_account";
|
import * as settings_account from "./settings_account";
|
||||||
|
|
Loading…
Reference in New Issue