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.

profile_modal: Migrate manage user footer buttons to user profile.

palashb01218bde443a3e
diff --git a/web/src/settings_users.js b/web/src/settings_users.js
index e78f2f66246..e01a492c6a3 100644
--- a/web/src/settings_users.js
+++ b/web/src/settings_users.js
@@ -692,7 +692,7 @@ export function show_edit_user_info_modal(user_id, $container) {
confirm_deactivation(user_id, handle_confirm, true);
});
- $("#edit-user-form").on("click", ".dialog_submit_button", () => {
+ $("#user-profile-modal").on("click", ".dialog_submit_button", () => {
const role = Number.parseInt($("#user-role-select").val().trim(), 10);
const $full_name = $("#edit-user-form").find("input[name='full_name']");
const profile_data = get_human_profile_data(fields_user_pills);
@@ -703,8 +703,9 @@ export function show_edit_user_info_modal(user_id, $container) {
role: JSON.stringify(role),
profile_data: JSON.stringify(profile_data),
};
- const $submit_btn = $("#edit-user-form .dialog_submit_button");
- const $cancel_btn = $("#edit-user-form .dialog_exit_button");
+
+ const $submit_btn = $("#user-profile-modal .dialog_submit_button");
+ const $cancel_btn = $("#user-profile-modal .dialog_exit_button");
show_button_spinner($submit_btn);
$cancel_btn.prop("disabled", true);
diff --git a/web/src/user_profile.js b/web/src/user_profile.js
index 8502fc2ddff..9e1a14f5c3a 100644
--- a/web/src/user_profile.js
+++ b/web/src/user_profile.js
@@ -157,6 +157,7 @@ function format_user_group_list_item(group) {
}
function render_user_stream_list(streams, user) {
+ $("#user-profile-modal .modal__footer").hide();
streams.sort(compare_by_name);
const $container = $("#user-profile-modal .user-stream-list");
$container.empty();
@@ -177,6 +178,7 @@ function render_user_stream_list(streams, user) {
}
function render_user_group_list(groups, user) {
+ $("#user-profile-modal .modal__footer").hide();
groups.sort(compare_by_name);
const $container = $("#user-profile-modal .user-group-list");
$container.empty();
@@ -194,6 +196,7 @@ function render_manage_profile_content(user) {
const $container = $("#manage-profile-tab");
$container.empty();
settings_users.show_edit_user_info_modal(user.user_id, $container);
+ $("#user-profile-modal .modal__footer").show();
}
export function get_custom_profile_field_data(user, field, field_types) {
@@ -346,6 +349,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {
$(`#${CSS.escape(key)}`).show();
switch (key) {
case "profile-tab":
+ $("#user-profile-modal .modal__footer").hide();
initialize_user_type_fields(user);
break;
case "user-profile-groups-tab":
diff --git a/web/templates/settings/admin_human_form.hbs b/web/templates/settings/admin_human_form.hbs
index 41540ffbfe1..4967d5dbde8 100644
--- a/web/templates/settings/admin_human_form.hbs
+++ b/web/templates/settings/admin_human_form.hbs
@@ -31,11 +31,4 @@
{{t 'Deactivate user' }}
</button>
</div>
- <footer class="modal__footer">
- <button type="button" class="modal__btn dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>
- <button type="button" class="modal__btn dialog_submit_button">
- <span>{{t "Save changes"}}</span>
- <div class="modal__spinner"></div>
- </button>
- </footer>
</div>
diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbs
index 6b24684fe75..67fd5976dba 100644
--- a/web/templates/user_profile_modal.hbs
+++ b/web/templates/user_profile_modal.hbs
@@ -119,6 +119,13 @@
<div class="tabcontent" id="manage-profile-tab"></div>
</div>
</main>
+ <footer class="modal__footer">
+ <button type="button" class="modal__btn dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>
+ <button type="button" class="modal__btn dialog_submit_button">
+ <span>{{t "Save changes"}}</span>
+ <div class="modal__spinner"></div>
+ </button>
+ </footer>
</div>
</div>
</div>