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.

left_sidebar: Replace cog icon with plus icon.

Aman Agrawal4b4fdad0e3b0
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index b545a37181c..73828afd8cf 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -694,11 +694,6 @@ export function initialize() {
// LEFT SIDEBAR
- $("#streams_inline_cog").on("click", (e) => {
- e.stopPropagation();
- browser_history.go_to_location("streams/subscribed");
- });
-
$(".streams_filter_icon").on("click", (e) => {
e.stopPropagation();
stream_list.toggle_filter_displayed(e);
diff --git a/static/js/stream_list.js b/static/js/stream_list.js
index 422fe11893a..825521cc987 100644
--- a/static/js/stream_list.js
+++ b/static/js/stream_list.js
@@ -521,6 +521,10 @@ export function set_event_handlers() {
$("#streams_header")
.expectOne()
.on("click", (e) => {
+ e.preventDefault();
+ if (e.target.id === "streams_inline_cog") {
+ return;
+ }
toggle_filter_displayed(e);
});
diff --git a/static/js/tippyjs.js b/static/js/tippyjs.js
index 91a229eb7f1..6d7e4776d88 100644
--- a/static/js/tippyjs.js
+++ b/static/js/tippyjs.js
@@ -1,8 +1,11 @@
import $ from "jquery";
import tippy, {delegate} from "tippy.js";
+import render_left_sidebar_stream_setting_popover from "../templates/left_sidebar_stream_setting_popover.hbs";
+
import * as reactions from "./reactions";
import * as rows from "./rows";
+import * as settings_data from "./settings_data";
// We override the defaults set by tippy library here,
// so make sure to check this too after checking tippyjs
@@ -104,4 +107,23 @@ export function initialize() {
return true;
},
});
+
+ delegate("body", {
+ delay: 0,
+ target: "#streams_inline_cog",
+ onShow(instance) {
+ instance.setContent(
+ render_left_sidebar_stream_setting_popover({
+ can_create_streams: settings_data.user_can_create_streams(),
+ }),
+ );
+ $(instance.popper).on("click", instance.hide);
+ },
+ appendTo: () => document.body,
+ trigger: "click",
+ allowHTML: true,
+ interactive: true,
+ hideOnClick: true,
+ theme: "light-border",
+ });
}
diff --git a/static/styles/left_sidebar.css b/static/styles/left_sidebar.css
index c8dee81e53d..5953545c6f8 100644
--- a/static/styles/left_sidebar.css
+++ b/static/styles/left_sidebar.css
@@ -68,6 +68,10 @@ li.show-more-topics {
}
}
+.streams_inline_cog_wrapper {
+ float: right;
+}
+
#streams_inline_cog {
margin-right: 10px;
}
@@ -501,7 +505,7 @@ li.expanded_private_message {
}
#streams_header {
- margin-right: 0;
+ margin-right: 12px;
padding-left: $far_left_gutter_size;
cursor: pointer;
margin-top: 3px;
diff --git a/static/templates/left_sidebar_stream_setting_popover.hbs b/static/templates/left_sidebar_stream_setting_popover.hbs
new file mode 100644
index 00000000000..7b0c6c65cb1
--- /dev/null
+++ b/static/templates/left_sidebar_stream_setting_popover.hbs
@@ -0,0 +1,14 @@
+<ul class="nav nav-list">
+ <li>
+ <a href="#streams/all">
+ {{t "Browse streams" }}
+ </a>
+ </li>
+ {{#if can_create_streams }}
+ <li>
+ <a href="#streams/new">
+ {{t "Create a stream" }}
+ </a>
+ </li>
+ {{/if}}
+</ul>
diff --git a/templates/zerver/app/left_sidebar.html b/templates/zerver/app/left_sidebar.html
index 2eba38c1578..fa7ffc2f257 100644
--- a/templates/zerver/app/left_sidebar.html
+++ b/templates/zerver/app/left_sidebar.html
@@ -60,7 +60,9 @@
</ul>
<div id="streams_list" class="zoom-out">
<div id="streams_header" class="zoom-in-hide"><h4 class="sidebar-title tippy-zulip-tooltip" data-tippy-content="{{ _('Filter streams') }} (q)">{{ _('STREAMS') }}</h4>
- <i id="streams_inline_cog" class='fa fa-cog tippy-zulip-tooltip' aria-hidden="true" data-tippy-content="{{ _('Subscribe, add, or configure streams') }}"></i>
+ <span class="tippy-zulip-tooltip streams_inline_cog_wrapper" data-tippy-content="{{ _('Add streams') }}" data-tippy-placement="top">
+ <i id="streams_inline_cog" class='fa fa-plus' aria-hidden="true" ></i>
+ </span>
<i class='streams_filter_icon fa fa-search tippy-zulip-tooltip' aria-hidden="true" data-tippy-content="{{ _('Filter streams') }} (q)"></i>
<div class="input-append notdisplayed stream_search_section">
<input class="stream-list-filter home-page-input" type="text" autocomplete="off" placeholder="{{ _('Filter streams') }}" />