mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
gear_menu: Move from TS to normal JS module.
Need to convert gear menu to popover.
This commit is contained in:
@@ -104,7 +104,7 @@ EXEMPT_FILES = make_set(
|
|||||||
"web/src/favicon.ts",
|
"web/src/favicon.ts",
|
||||||
"web/src/feedback_widget.ts",
|
"web/src/feedback_widget.ts",
|
||||||
"web/src/flatpickr.ts",
|
"web/src/flatpickr.ts",
|
||||||
"web/src/gear_menu.ts",
|
"web/src/gear_menu.js",
|
||||||
"web/src/giphy.js",
|
"web/src/giphy.js",
|
||||||
"web/src/global.d.ts",
|
"web/src/global.d.ts",
|
||||||
"web/src/hash_util.ts",
|
"web/src/hash_util.ts",
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ The click handler uses "[data-overlay-trigger]" as
|
|||||||
the selector and then calls browser_history.go_to_location.
|
the selector and then calls browser_history.go_to_location.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function initialize(): void {
|
export function initialize() {
|
||||||
const rendered_gear_menu = render_gear_menu({
|
const rendered_gear_menu = render_gear_menu({
|
||||||
realm_name: page_params.realm_name,
|
realm_name: page_params.realm_name,
|
||||||
realm_url: new URL(page_params.realm_uri).hostname,
|
realm_url: new URL(page_params.realm_uri).hostname,
|
||||||
@@ -108,17 +108,17 @@ export function initialize(): void {
|
|||||||
$("#navbar-buttons").html(rendered_gear_menu);
|
$("#navbar-buttons").html(rendered_gear_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function open(): void {
|
export function open() {
|
||||||
$("#settings-dropdown").trigger("click");
|
$("#settings-dropdown").trigger("click");
|
||||||
// there are invisible li tabs, which should not be clicked.
|
// there are invisible li tabs, which should not be clicked.
|
||||||
$("#gear-menu").find("li:not(.invisible) a").eq(0).trigger("focus");
|
$("#gear-menu").find("li:not(.invisible) a").eq(0).trigger("focus");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function is_open(): boolean {
|
export function is_open() {
|
||||||
return $(".dropdown").hasClass("open");
|
return $(".dropdown").hasClass("open");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function close(): void {
|
export function close() {
|
||||||
if (is_open()) {
|
if (is_open()) {
|
||||||
$(".dropdown").removeClass("open");
|
$(".dropdown").removeClass("open");
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,6 @@ import * as channel from "./channel";
|
|||||||
import * as common from "./common";
|
import * as common from "./common";
|
||||||
import {csrf_token} from "./csrf";
|
import {csrf_token} from "./csrf";
|
||||||
import * as dialog_widget from "./dialog_widget";
|
import * as dialog_widget from "./dialog_widget";
|
||||||
import * as gear_menu from "./gear_menu";
|
|
||||||
import {$t, $t_html} from "./i18n";
|
import {$t, $t_html} from "./i18n";
|
||||||
import {page_params} from "./page_params";
|
import {page_params} from "./page_params";
|
||||||
import * as scroll_util from "./scroll_util";
|
import * as scroll_util from "./scroll_util";
|
||||||
@@ -276,7 +275,10 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): void
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
gear_menu.close();
|
const $gear_menu = $("#gear-menu");
|
||||||
|
if ($gear_menu.hasClass("open")) {
|
||||||
|
$gear_menu.removeClass("open");
|
||||||
|
}
|
||||||
|
|
||||||
const time_unit_choices = ["minutes", "hours", "days", "weeks"];
|
const time_unit_choices = ["minutes", "hours", "days", "weeks"];
|
||||||
const html_body = render_invite_user_modal({
|
const html_body = render_invite_user_modal({
|
||||||
|
|||||||
Reference in New Issue
Block a user