From db3b9e4742d508a9e8e9561115972028f58312bd Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Thu, 27 Jul 2023 12:56:04 +0530 Subject: [PATCH] settings: Make custom profile fields table consistent with others. We change the custom profile fields table to have same header as of other table and as a result this also makes the page look better if an organization has zero custom profile fields. --- web/src/settings_profile_fields.js | 13 ------------ web/styles/settings.css | 3 ++- .../settings/profile_field_settings_admin.hbs | 21 +++++++++++-------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/web/src/settings_profile_fields.js b/web/src/settings_profile_fields.js index f6c87e7f46..c8b0632b6d 100644 --- a/web/src/settings_profile_fields.js +++ b/web/src/settings_profile_fields.js @@ -67,17 +67,6 @@ function is_valid_to_display_in_summary(field_type) { return true; } -function update_profile_fields_table_element() { - const $profile_fields_table = $("#admin_profile_fields_table").expectOne(); - - // If there are no custom fields, hide the table headers at the top - if (page_params.custom_profile_fields.length < 1) { - $profile_fields_table.hide(); - } else { - $profile_fields_table.show(); - } -} - function delete_profile_field(e) { e.preventDefault(); e.stopPropagation(); @@ -104,7 +93,6 @@ function delete_profile_field(e) { const opts = { success_continuation() { display_success_status(); - update_profile_fields_table_element(); }, }; dialog_widget.submit_api_request(channel.del, url, {}, opts); @@ -681,7 +669,6 @@ export function do_populate_profile_fields(profile_fields_data) { } update_profile_fields_checkboxes(); - update_profile_fields_table_element(); loading.destroy_indicator($("#admin_page_profile_fields_loading_indicator")); } diff --git a/web/styles/settings.css b/web/styles/settings.css index 1515221e1b..084eccff2b 100644 --- a/web/styles/settings.css +++ b/web/styles/settings.css @@ -132,7 +132,7 @@ h3, margin-right: 10px; } -#admin_profile_fields_table { +.admin_profile_fields_table { & th.display, td.display_in_profile_summary_cell { text-align: center; @@ -226,6 +226,7 @@ h3, /* Limit the actions column to not using excessive width */ .admin-table-wrapper table.admin_profile_fields_table tr .actions { width: 11%; + min-width: 70px; } } diff --git a/web/templates/settings/profile_field_settings_admin.hbs b/web/templates/settings/profile_field_settings_admin.hbs index 84693b25a0..eb7a42d974 100644 --- a/web/templates/settings/profile_field_settings_admin.hbs +++ b/web/templates/settings/profile_field_settings_admin.hbs @@ -8,15 +8,18 @@
- - - - - {{#if is_admin}} - - - {{/if}} - + + + + + + {{#if is_admin}} + + + {{/if}} + + +
{{t "Label" }}{{t "Hint" }}{{t "Type" }}{{t "Card"}}{{t "Actions" }}
{{t "Label" }}{{t "Hint" }}{{t "Type" }}{{t "Card"}}{{t "Actions" }}