Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_groups: Add search input to the user group.
Maneesh Shukla3ce9c558b2d5
diff --git a/web/src/user_profile.ts b/web/src/user_profile.tsindex 2759fe69477..2adef5912f8 100644--- a/web/src/user_profile.ts+++ b/web/src/user_profile.ts@@ -378,6 +378,17 @@ function render_user_group_list(groups: UserGroup[], user: User): void {modifier_html(item) {return format_user_group_list_item_html(item, user);},+ filter: {+ $element: $("#user-profile-groups-tab .group-search"),+ predicate(item, value) {+ return item?.name.toLocaleLowerCase().includes(value);+ },+ onupdate() {+ if ($container.find(".empty-table-message").length > 0) {+ $container.parent().addClass("empty-list");+ }+ },+ },$simplebar_container: $("#user-profile-modal .modal__body"),});}@@ -1315,6 +1326,16 @@ export function initialize(): void {e.preventDefault();});+ $("body").on("click", "#user-profile-modal #clear_groups_search", (e) => {+ const $input = $("#user-profile-groups-tab .group-search");+ $input.val("");++ $input.trigger("input");++ e.stopPropagation();+ e.preventDefault();+ });+$("body").on("click","#user-profile-modal #name .user-profile-manage-others-edit-button",@@ -1349,6 +1370,15 @@ export function initialize(): void {}});+ $("body").on("input", "#user-profile-groups-tab .group-search", () => {+ const $input = $<HTMLInputElement>("#user-profile-groups-tab input.group-search");+ if ($input.val()!.trim().length > 0) {+ $("#user-profile-groups-tab #clear_groups_search").show();+ } else {+ $("#user-profile-groups-tab #clear_groups_search").hide();+ }+ });+new ClipboardJS(".copy-link-to-user-profile", {text(trigger) {const user_id = $(trigger).attr("data-user-id");diff --git a/web/styles/popovers.css b/web/styles/popovers.cssindex 936b9d20a51..d4f3b8355ad 100644--- a/web/styles/popovers.css+++ b/web/styles/popovers.css@@ -526,6 +526,7 @@ ul.popover-group-menu-member-list {margin-bottom: 20px;}+ .group-tab-element-header,.stream-tab-element-header {margin: 0;display: inline-block;@@ -565,12 +566,14 @@ ul.popover-group-menu-member-list {}}+ .group-list-top-section,.stream-list-top-section {display: flex;margin-top: 12px;align-items: center;margin-bottom: 5px;+ .group-search-container,.stream-search-container {margin-left: auto;display: grid;@@ -579,6 +582,7 @@ ul.popover-group-menu-member-list {30px;}+ .group-search,.stream-search {grid-column: search-input-start / clear-search-end;grid-row: search-input;@@ -589,6 +593,7 @@ ul.popover-group-menu-member-list {margin-bottom: 0;}+ .group-search:placeholder-shown + #clear_groups_search,.stream-search:placeholder-shown + #clear_stream_search {visibility: hidden;}@@ -713,6 +718,7 @@ ul.popover-group-menu-member-list {}#user-profile-modal {+ .group-list-top-section,.stream-list-top-section {display: block;@@ -720,10 +726,12 @@ ul.popover-group-menu-member-list {width: 100%;}+ .group-search,.stream-search {margin-bottom: 8px;}+ #clear_groups_search,#clear_stream_search {padding-top: 1px;}diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbsindex aed6d8e8695..b46d8581c83 100644--- a/web/templates/user_profile_modal.hbs+++ b/web/templates/user_profile_modal.hbs@@ -131,8 +131,19 @@<div class="tabcontent" id="user-profile-groups-tab"><div class="alert user-profile-group-list-alert"></div>+ <div class="group-list-top-section">+ <div class="header-section">+ <h3 class="group-tab-element-header">{{t 'Group membership' }}</h3>+ </div>+ <div class="group-search-container">+ <input type="text" class="group-search modal_text_input" placeholder="{{t 'Filter groups' }}" />+ <button type="button" class="clear_search_button" id="clear_groups_search">+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>+ </button>+ </div>+ </div><div class="subscription-group-list empty-list">- <table class="user-group-list" data-empty="{{t 'Not a member of any groups.'}}"></table>+ <table class="user-group-list" data-empty="{{t 'Not a member of any groups.'}}" data-search-results-empty="{{t 'No matching user groups' }}"></table></div></div><div class="tabcontent" id="manage-profile-tab"></div>