mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
gear_menu: Delete unused Bootstrap tabs code.
Before 2017, Zulip's manage streams and settings UIs were tab in the same pane position as our current message feed and recent topics. That original implementation was implemented using Bootstrap tabs; while it hasn't been in use for years, we had a bunch of stale code related to it leftover in this module.
This commit is contained in:
@@ -2,10 +2,7 @@ import $ from "jquery";
|
||||
|
||||
import render_gear_menu from "../templates/gear_menu.hbs";
|
||||
|
||||
import * as hashchange from "./hashchange";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as navigate from "./navigate";
|
||||
import {page_params} from "./page_params";
|
||||
import * as settings_data from "./settings_data";
|
||||
|
||||
@@ -80,15 +77,8 @@ in static/js/info_overlay.js. They are dispatched
|
||||
using a click handler in static/js/click_handlers.js.
|
||||
The click handler uses "[data-overlay-trigger]" as
|
||||
the selector and then calls browser_history.go_to_location.
|
||||
|
||||
*/
|
||||
|
||||
// We want to remember how far we were scrolled on each 'tab'.
|
||||
// To do so, we need to save away the old position of the
|
||||
// scrollbar when we switch to a new tab (and restore it
|
||||
// when we switch back.)
|
||||
const scroll_positions = new Map();
|
||||
|
||||
export function update_org_settings_menu_item() {
|
||||
const $item = $(".admin-menu-item").expectOne();
|
||||
if (page_params.is_admin) {
|
||||
@@ -156,38 +146,6 @@ export function initialize() {
|
||||
});
|
||||
$("#navbar-buttons").html(rendered_gear_menu);
|
||||
update_org_settings_menu_item();
|
||||
|
||||
$('#gear-menu a[data-toggle="tab"]').on("show", (e) => {
|
||||
// Save the position of our old tab away, before we switch
|
||||
const old_tab = $(e.relatedTarget).attr("href");
|
||||
scroll_positions.set(old_tab, message_viewport.scrollTop());
|
||||
});
|
||||
$('#gear-menu a[data-toggle="tab"]').on("shown", (e) => {
|
||||
const target_tab = $(e.target).attr("href");
|
||||
// Hide all our error messages when switching tabs
|
||||
$(".alert").removeClass("show");
|
||||
|
||||
// Set the URL bar title to show the sub-page you're currently on.
|
||||
let browser_url = target_tab;
|
||||
if (browser_url === "#message_feed_container") {
|
||||
browser_url = "";
|
||||
}
|
||||
hashchange.changehash(browser_url);
|
||||
|
||||
// After we show the new tab, restore its old scroll position
|
||||
// (we apparently have to do this after setting the hash,
|
||||
// because otherwise that action may scroll us somewhere.)
|
||||
if (target_tab === "#message_feed_container") {
|
||||
if (scroll_positions.has(target_tab)) {
|
||||
message_viewport.scrollTop(scroll_positions.get(target_tab));
|
||||
} else {
|
||||
navigate.scroll_to_selected();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The admin and settings pages are generated client-side through
|
||||
// templates.
|
||||
}
|
||||
|
||||
export function open() {
|
||||
|
||||
@@ -26,7 +26,6 @@ import * as spectators from "./spectators";
|
||||
import * as stream_settings_ui from "./stream_settings_ui";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as ui_report from "./ui_report";
|
||||
import * as ui_util from "./ui_util";
|
||||
import * as user_groups_settings_ui from "./user_groups_settings_ui";
|
||||
import {user_settings} from "./user_settings";
|
||||
|
||||
@@ -91,7 +90,6 @@ export function save_narrow(operators) {
|
||||
|
||||
function show_all_message_view() {
|
||||
const coming_from_recent_topics = maybe_hide_recent_topics();
|
||||
ui_util.change_tab_to("#message_feed_container");
|
||||
narrow.deactivate(coming_from_recent_topics);
|
||||
top_left_corner.handle_narrow_deactivated();
|
||||
floating_recipient_bar.update();
|
||||
@@ -138,7 +136,6 @@ function do_hashchange_normal(from_reload) {
|
||||
switch (hash[0]) {
|
||||
case "#narrow": {
|
||||
maybe_hide_recent_topics();
|
||||
ui_util.change_tab_to("#message_feed_container");
|
||||
let operators;
|
||||
try {
|
||||
// TODO: Show possible valid URLs to the user.
|
||||
|
||||
@@ -39,7 +39,6 @@ import * as stream_list from "./stream_list";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as topic_generator from "./topic_generator";
|
||||
import * as typing_events from "./typing_events";
|
||||
import * as ui_util from "./ui_util";
|
||||
import * as unread from "./unread";
|
||||
import * as unread_ops from "./unread_ops";
|
||||
import * as unread_ui from "./unread_ui";
|
||||
@@ -489,7 +488,6 @@ export function activate(raw_operators, opts) {
|
||||
$("#zfilt").addClass("focused_table");
|
||||
$("#zhome").removeClass("focused_table");
|
||||
|
||||
ui_util.change_tab_to("#message_feed_container");
|
||||
message_list.set_narrowed(msg_list);
|
||||
message_lists.set_current(message_list.narrowed);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ export function narrow_or_search_for_term(search_string) {
|
||||
// while using input tool
|
||||
return $search_query_box.val();
|
||||
}
|
||||
ui_util.change_tab_to("#message_feed_container");
|
||||
|
||||
let operators;
|
||||
if (page_params.search_pills_enabled) {
|
||||
|
||||
@@ -5,10 +5,6 @@ import * as keydown_util from "./keydown_util";
|
||||
// Add functions to this that have no non-trivial
|
||||
// dependencies other than jQuery.
|
||||
|
||||
export function change_tab_to(tabname: string): void {
|
||||
$(`#gear-menu a[href="${CSS.escape(tabname)}"]`).tab("show");
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser
|
||||
export function place_caret_at_end(el: HTMLElement): void {
|
||||
el.focus();
|
||||
|
||||
Reference in New Issue
Block a user