Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

subscriptions: Simplify the displaying of subs pane.

Ryan Rehman806da412ac6c
diff --git a/static/js/stream_create.js b/static/js/stream_create.js
index 6730623a872..a712c5e5e19 100644
--- a/static/js/stream_create.js
+++ b/static/js/stream_create.js
@@ -235,14 +235,9 @@ function create_stream() {
exports.new_stream_clicked = function (stream_name) {
// this changes the tab switcher (settings/preview) which isn't necessary
// to a add new stream title.
- $(".display-type #add_new_stream_title").show();
- $(".display-type #stream_settings_title").hide();
-
+ subs.show_subs_pane.create_stream();
$(".stream-row.active").removeClass("active");
- $("#stream_settings_title, .subscriptions-container .settings, .nothing-selected").hide();
- $("#stream-creation, #add_new_stream_title").show();
-
if (stream_name !== "") {
$("#create_stream_name").val(stream_name);
}
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js
index 1367c767264..9d7df80faff 100644
--- a/static/js/stream_edit.js
+++ b/static/js/stream_edit.js
@@ -116,12 +116,6 @@ function set_stream_message_retention_setting_dropdown(stream) {
change_stream_message_retention_days_block_display_property(value);
}
-function clear_edit_panel() {
- $(".display-type #add_new_stream_title").hide();
- $(".display-type #stream_settings_title, .right .settings").show();
- $(".stream-row.active").removeClass("active");
-}
-
function get_stream_id(target) {
if (target.constructor !== jQuery) {
target = $(target);
@@ -148,7 +142,7 @@ function get_sub_for_target(target) {
exports.open_edit_panel_for_row = function (stream_row) {
const sub = get_sub_for_target(stream_row);
- clear_edit_panel();
+ $(".stream-row.active").removeClass("active");
subs.show_subs_pane.settings();
$(stream_row).addClass("active");
setup_subscriptions_stream_hash(sub);
@@ -157,7 +151,7 @@ exports.open_edit_panel_for_row = function (stream_row) {
exports.open_edit_panel_empty = function () {
const tab_key = $(subs.get_active_data().tabs[0]).attr("data-tab-key");
- clear_edit_panel();
+ $(".stream-row.active").removeClass("active");
subs.show_subs_pane.nothing_selected();
exports.setup_subscriptions_tab_hash(tab_key);
};
diff --git a/static/js/subs.js b/static/js/subs.js
index 6faa4625ce9..f97cae2a34a 100644
--- a/static/js/subs.js
+++ b/static/js/subs.js
@@ -11,12 +11,16 @@ const util = require("./util");
exports.show_subs_pane = {
nothing_selected() {
- $(".nothing-selected, #stream_settings_title").show();
- $("#add_new_stream_title, .settings, #stream-creation").hide();
+ $(".stream-info-title, .settings, #stream-creation").hide();
+ $("#stream_settings_title, .nothing-selected").show();
},
settings() {
- $(".settings, #stream_settings_title").show();
- $("#add_new_stream_title, #stream-creation, .nothing-selected").hide();
+ $(".stream-info-title, .settings, #stream-creation").hide();
+ $("#stream_settings_title, .settings").show();
+ },
+ create_stream() {
+ $(".stream-info-title, .nothing-selected, .settings, #stream-creation").hide();
+ $("#add_new_stream_title, #stream-creation").show();
},
};