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.

popovers: Add filter widget for stream list in profile modal.

m-e-l-u-h-a-n0d3f22928344
diff --git a/static/js/user_profile.js b/static/js/user_profile.js
index 33417d3169f..b43ccc27d01 100644
--- a/static/js/user_profile.js
+++ b/static/js/user_profile.js
@@ -63,6 +63,12 @@ function render_user_stream_list(streams, user) {
modifier(item) {
return format_user_stream_list_item(item, user);
},
+ filter: {
+ element: $("#streams-tab .stream-search"),
+ predicate(item, value) {
+ return item && item.name.toLocaleLowerCase().includes(value);
+ },
+ },
simplebar_container: $("#user-profile-modal .modal-body"),
});
}
diff --git a/static/styles/popovers.css b/static/styles/popovers.css
index ab61adc7fd1..5a4749fff78 100644
--- a/static/styles/popovers.css
+++ b/static/styles/popovers.css
@@ -368,11 +368,19 @@ ul {
margin-bottom: 8px;
}
}
+ .stream-list-top-section {
+ display: flex;
- .stream-list-header {
- margin: 0;
- display: inline-block;
- font-weight: inherit;
+ .stream-list-header {
+ margin: 0;
+ display: inline-block;
+ font-weight: inherit;
+ }
+
+ .stream-search {
+ margin-left: auto;
+ align-self: center;
+ }
}
.subscription-group-list,
@@ -526,6 +534,19 @@ ul {
position: static;
margin-right: 0;
}
+ #user-profile-modal {
+ .stream-list-top-section {
+ display: block;
+
+ .header-section {
+ width: 100%;
+ }
+
+ .stream-search {
+ margin-bottom: 8px;
+ }
+ }
+ }
}
.popover.top .arrow::after {
diff --git a/static/templates/user_profile_modal.hbs b/static/templates/user_profile_modal.hbs
index 4eb0e58c641..42b496a3f06 100644
--- a/static/templates/user_profile_modal.hbs
+++ b/static/templates/user_profile_modal.hbs
@@ -65,7 +65,12 @@
</div>
<div class="tabcontent" id="streams-tab">
- <h3 class="stream-list-header">{{t 'Subscribed streams' }}</h3>
+ <div class="stream-list-top-section">
+ <div class="header-section">
+ <h3 class="stream-list-header">{{t 'Subscribed streams' }}</h3>
+ </div>
+ <input type="text" class="stream-search" placeholder="{{t 'Filter streams' }}" />
+ </div>
<div class="alert stream_list_info"></div>
<div class="subscription-stream-list">
<table class="user-stream-list" data-empty="{{t 'No stream subscriptions.'}}"></table>