mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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":
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user