Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user groups: Add filter for group list in group settings overlay.
Purushottam Tiwari072996141f44
diff --git a/static/js/user_groups_settings_ui.js b/static/js/user_groups_settings_ui.jsindex 4fc1ac937de..b7d4d4fbd7a 100644--- a/static/js/user_groups_settings_ui.js+++ b/static/js/user_groups_settings_ui.js@@ -10,6 +10,20 @@ import * as people from "./people";import * as ui from "./ui";import * as user_groups from "./user_groups";+export function set_up_click_handlers() {+ $("#groups_overlay").on("click", ".left #clear_search_group_name", (e) => {+ const $input = $("#groups_overlay .left #search_group_name");+ $input.val("");++ // This is a hack to rerender complete+ // stream list once the text is cleared.+ $input.trigger("input");++ e.stopPropagation();+ e.preventDefault();+ });+}+export function setup_page(callback) {function populate_and_fill() {const rendered = render_user_group_settings_overlay();@@ -30,9 +44,21 @@ export function setup_page(callback) {);return render_browse_user_groups_list_item(item);},+ filter: {+ $element: $("#manage_groups_container .left #search_group_name"),+ predicate(item, value) {+ return (+ item &&+ (item.name.toLocaleLowerCase().includes(value) ||+ item.description.toLocaleLowerCase().includes(value))+ );+ },+ },$simplebar_container: $container,});+ set_up_click_handlers();+if (callback) {callback();}diff --git a/static/styles/dark_theme.css b/static/styles/dark_theme.cssindex 067ac6305f1..aa3eaaa9826 100644--- a/static/styles/dark_theme.css+++ b/static/styles/dark_theme.css@@ -170,6 +170,7 @@ body.dark-theme {.column-left .left-sidebar,.stream_name_search_section,+ .group_name_search_section,.column-right .right-sidebar {border-color: hsla(0, 0%, 0%, 0.2);}diff --git a/static/styles/subscriptions.css b/static/styles/subscriptions.cssindex e921800249a..287cfedb1bd 100644--- a/static/styles/subscriptions.css+++ b/static/styles/subscriptions.css@@ -429,7 +429,8 @@ h4.stream_setting_subsection_title {}}-#search_stream_name {+#search_stream_name,+#search_group_name {width: 100%;padding: 3px 5px;margin: 8px 0;@@ -444,7 +445,8 @@ h4.stream_setting_subsection_title {overflow: hidden;}-.stream_name_search_section {+.stream_name_search_section,+.group_name_search_section {width: 100%;display: flex;flex-direction: row;@@ -466,13 +468,14 @@ h4.stream_setting_subsection_title {.user-groups-list {/*This height rule is temporary for this preparatory commit and- will be removed as we add other search/filter widgets in groups list+ will be removed as we add other components widgets in groups listand its styling similar to streams list.*/- height: 100% !important;+ height: calc(100% - 42px) !important;}-#clear_search_stream_name {+#clear_search_stream_name,+#clear_search_group_name {right: 5px !important;}diff --git a/static/templates/user_group_settings/user_group_settings_overlay.hbs b/static/templates/user_group_settings/user_group_settings_overlay.hbsindex d37a9025b06..3b88cfcb8a4 100644--- a/static/templates/user_group_settings/user_group_settings_overlay.hbs+++ b/static/templates/user_group_settings/user_group_settings_overlay.hbs@@ -9,6 +9,13 @@</div></div><div class="left">+ <div class="input-append group_name_search_section" id="group_filter">+ <input type="text" name="group_name" id="search_group_name" autocomplete="off"+ placeholder="{{t 'Filter groups' }}" value=""/>+ <button type="button" class="btn clear_search_button" id="clear_search_group_name">+ <i class="fa fa-remove" aria-hidden="true"></i>+ </button>+ </div><div class="user-groups-list" data-simplebar></div></div>