profile_modal: Migrate manage user footer buttons to user profile.

This commit migrates the "Manage User" footer buttons to the user
profile modal. We made this change because we don't want the buttons
to scroll with the content; instead, we want them to be sticky at
the bottom at all times. Therefore, we moved the buttons to the user
profile modal.
This commit is contained in:
palashb01
2023-07-20 15:36:58 +05:30
committed by Tim Abbott
parent 61cca84b17
commit 218bde443a
4 changed files with 15 additions and 10 deletions

View File

@@ -692,7 +692,7 @@ export function show_edit_user_info_modal(user_id, $container) {
confirm_deactivation(user_id, handle_confirm, true); 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 role = Number.parseInt($("#user-role-select").val().trim(), 10);
const $full_name = $("#edit-user-form").find("input[name='full_name']"); const $full_name = $("#edit-user-form").find("input[name='full_name']");
const profile_data = get_human_profile_data(fields_user_pills); 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), role: JSON.stringify(role),
profile_data: JSON.stringify(profile_data), 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); show_button_spinner($submit_btn);
$cancel_btn.prop("disabled", true); $cancel_btn.prop("disabled", true);

View File

@@ -157,6 +157,7 @@ function format_user_group_list_item(group) {
} }
function render_user_stream_list(streams, user) { function render_user_stream_list(streams, user) {
$("#user-profile-modal .modal__footer").hide();
streams.sort(compare_by_name); streams.sort(compare_by_name);
const $container = $("#user-profile-modal .user-stream-list"); const $container = $("#user-profile-modal .user-stream-list");
$container.empty(); $container.empty();
@@ -177,6 +178,7 @@ function render_user_stream_list(streams, user) {
} }
function render_user_group_list(groups, user) { function render_user_group_list(groups, user) {
$("#user-profile-modal .modal__footer").hide();
groups.sort(compare_by_name); groups.sort(compare_by_name);
const $container = $("#user-profile-modal .user-group-list"); const $container = $("#user-profile-modal .user-group-list");
$container.empty(); $container.empty();
@@ -194,6 +196,7 @@ function render_manage_profile_content(user) {
const $container = $("#manage-profile-tab"); const $container = $("#manage-profile-tab");
$container.empty(); $container.empty();
settings_users.show_edit_user_info_modal(user.user_id, $container); 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) { 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(); $(`#${CSS.escape(key)}`).show();
switch (key) { switch (key) {
case "profile-tab": case "profile-tab":
$("#user-profile-modal .modal__footer").hide();
initialize_user_type_fields(user); initialize_user_type_fields(user);
break; break;
case "user-profile-groups-tab": case "user-profile-groups-tab":

View File

@@ -31,11 +31,4 @@
{{t 'Deactivate user' }} {{t 'Deactivate user' }}
</button> </button>
</div> </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> </div>

View File

@@ -119,6 +119,13 @@
<div class="tabcontent" id="manage-profile-tab"></div> <div class="tabcontent" id="manage-profile-tab"></div>
</div> </div>
</main> </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> </div>
</div> </div>