mirror of https://github.com/zulip/zulip.git
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:
parent
f29e748e3b
commit
2a3f708e9a
|
@ -137,10 +137,6 @@ function test_helper({override, change_tab}) {
|
|||
stub(ui_report, "error");
|
||||
|
||||
if (change_tab) {
|
||||
override(ui_util, "change_tab_to", (hash) => {
|
||||
events.push("change_tab_to " + hash);
|
||||
});
|
||||
|
||||
override(narrow, "activate", (terms) => {
|
||||
narrow_terms = terms;
|
||||
events.push("narrow.activate");
|
||||
|
@ -190,7 +186,6 @@ run_test("hash_interactions", ({override}) => {
|
|||
helper.assert_events([
|
||||
[overlays, "close_for_hash_change"],
|
||||
[message_viewport, "stop_auto_scrolling"],
|
||||
"change_tab_to #message_feed_container",
|
||||
[narrow, "deactivate"],
|
||||
[floating_recipient_bar, "update"],
|
||||
]);
|
||||
|
@ -200,7 +195,6 @@ run_test("hash_interactions", ({override}) => {
|
|||
helper.assert_events([
|
||||
[overlays, "close_for_hash_change"],
|
||||
[message_viewport, "stop_auto_scrolling"],
|
||||
"change_tab_to #message_feed_container",
|
||||
[narrow, "deactivate"],
|
||||
[floating_recipient_bar, "update"],
|
||||
]);
|
||||
|
@ -225,7 +219,6 @@ run_test("hash_interactions", ({override}) => {
|
|||
helper.assert_events([
|
||||
[overlays, "close_for_hash_change"],
|
||||
[message_viewport, "stop_auto_scrolling"],
|
||||
"change_tab_to #message_feed_container",
|
||||
"narrow.activate",
|
||||
[floating_recipient_bar, "update"],
|
||||
]);
|
||||
|
@ -239,7 +232,6 @@ run_test("hash_interactions", ({override}) => {
|
|||
helper.assert_events([
|
||||
[overlays, "close_for_hash_change"],
|
||||
[message_viewport, "stop_auto_scrolling"],
|
||||
"change_tab_to #message_feed_container",
|
||||
"narrow.activate",
|
||||
[floating_recipient_bar, "update"],
|
||||
]);
|
||||
|
@ -254,7 +246,6 @@ run_test("hash_interactions", ({override}) => {
|
|||
helper.assert_events([
|
||||
[overlays, "close_for_hash_change"],
|
||||
[message_viewport, "stop_auto_scrolling"],
|
||||
"change_tab_to #message_feed_container",
|
||||
[ui_report, "error"],
|
||||
]);
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ const search = mock_esm("../../static/js/search");
|
|||
const stream_list = mock_esm("../../static/js/stream_list");
|
||||
const top_left_corner = mock_esm("../../static/js/top_left_corner");
|
||||
const typing_events = mock_esm("../../static/js/typing_events");
|
||||
const ui_util = mock_esm("../../static/js/ui_util");
|
||||
const unread_ops = mock_esm("../../static/js/unread_ops");
|
||||
mock_esm("../../static/js/recent_topics_util", {
|
||||
is_visible() {},
|
||||
|
@ -90,7 +89,6 @@ function test_helper() {
|
|||
stub(top_left_corner, "handle_narrow_activated");
|
||||
stub(typing_events, "render_notifications_for_narrow");
|
||||
stub(compose_actions, "update_narrow_to_recipient_visibility");
|
||||
stub(ui_util, "change_tab_to");
|
||||
stub(unread_ops, "process_visible");
|
||||
stub(compose_closed_ui, "update_buttons_for_stream");
|
||||
stub(compose_closed_ui, "update_buttons_for_private");
|
||||
|
@ -192,7 +190,6 @@ run_test("basics", () => {
|
|||
[message_scroll, "hide_indicators"],
|
||||
[notifications, "clear_compose_notifications"],
|
||||
[notifications, "redraw_title"],
|
||||
[ui_util, "change_tab_to"],
|
||||
[unread_ops, "process_visible"],
|
||||
[hashchange, "save_narrow"],
|
||||
[compose_closed_ui, "update_buttons_for_stream"],
|
||||
|
|
|
@ -21,7 +21,6 @@ mock_esm("../../static/js/search_pill_widget", {
|
|||
},
|
||||
});
|
||||
mock_esm("../../static/js/ui_util", {
|
||||
change_tab_to: noop,
|
||||
place_caret_at_end: noop,
|
||||
});
|
||||
|
||||
|
|
|
@ -9,14 +9,9 @@ const {page_params} = require("../zjsunit/zpage_params");
|
|||
|
||||
page_params.search_pills_enabled = false;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const narrow = mock_esm("../../static/js/narrow");
|
||||
const narrow_state = mock_esm("../../static/js/narrow_state");
|
||||
const search_suggestion = mock_esm("../../static/js/search_suggestion");
|
||||
mock_esm("../../static/js/ui_util", {
|
||||
change_tab_to: noop,
|
||||
});
|
||||
|
||||
const Filter = {};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -546,6 +546,10 @@ p.n-margin {
|
|||
|
||||
.column-middle {
|
||||
min-height: 100%;
|
||||
|
||||
.column-middle-inner {
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
<i class="fa fa-cog settings-dropdown-cog" aria-hidden="true"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="settings-dropdown">
|
||||
{{!-- It is quite ingrained in our frontend code that your Home
|
||||
view is a Bootstrap nav tab, even though we don't show the tab
|
||||
anymore --}}
|
||||
<li class="invisible" style="display:none;" role="presentation"><a href="#message_feed_container" data-toggle="tab"></a></li>
|
||||
<li class="org-info org-name">{{realm_name}}</li>
|
||||
<li class="org-info org-url">{{realm_uri}}</li>
|
||||
{{#if is_self_hosted }}
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
<div class="column-left" id="left-sidebar-container">
|
||||
</div>
|
||||
<div class="column-middle">
|
||||
<div class="column-middle-inner tab-content">
|
||||
<div class="column-middle-inner">
|
||||
<div id="recent_topics_view">
|
||||
<div class="recent_topics_container">
|
||||
<div id="recent_topics_table"></div>
|
||||
|
@ -166,7 +166,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="message_feed_container">
|
||||
<div id="message_feed_container">
|
||||
<div class="fixed-app" id="floating_recipient_bar">
|
||||
<div class="app-main recipient_bar_content">
|
||||
<div class="column-middle column-overlay recipient-bar-main">
|
||||
|
|
Loading…
Reference in New Issue