mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
custom profile field: Minor tweaks in field-table in admin settings.
This commit add minor changes in profile field table in admin settings: - Hide table header if there is no field - Fix width of table column
This commit is contained in:
committed by
Tim Abbott
parent
66c2b6d2a6
commit
03f5422ce8
@@ -8,6 +8,8 @@ set_global('Sortable', {create: () => {}});
|
||||
const SHORT_TEXT_ID = 1;
|
||||
const CHOICE_ID = 3;
|
||||
|
||||
page_params.custom_profile_fields = {};
|
||||
|
||||
page_params.custom_profile_field_types = {
|
||||
SHORT_TEXT: {
|
||||
id: SHORT_TEXT_ID,
|
||||
|
||||
@@ -33,6 +33,17 @@ exports.field_type_id_to_string = function (type_id) {
|
||||
return field_type_str;
|
||||
};
|
||||
|
||||
function update_profile_fields_table_element() {
|
||||
var 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();
|
||||
@@ -41,6 +52,7 @@ function delete_profile_field(e) {
|
||||
channel.del,
|
||||
"/json/realm/profile_fields/" + encodeURIComponent($(this).attr('data-profile-field-id')),
|
||||
{}, $('#admin-profile-field-status').expectOne());
|
||||
update_profile_fields_table_element();
|
||||
}
|
||||
|
||||
function read_field_data_from_form(selector) {
|
||||
@@ -114,6 +126,7 @@ function create_profile_field(e) {
|
||||
|
||||
settings_ui.do_settings_change(channel.post, "/json/realm/profile_fields", form_data,
|
||||
$('#admin-profile-field-status').expectOne(), opts);
|
||||
update_profile_fields_table_element();
|
||||
}
|
||||
|
||||
function add_choice_row(e) {
|
||||
@@ -295,6 +308,8 @@ exports.do_populate_profile_fields = function (profile_fields_data) {
|
||||
onUpdate: update_field_order,
|
||||
});
|
||||
}
|
||||
|
||||
update_profile_fields_table_element();
|
||||
loading.destroy_indicator($('#admin_page_profile_fields_loading_indicator'));
|
||||
};
|
||||
|
||||
|
||||
@@ -705,6 +705,10 @@ input[type=checkbox].inline-block {
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
#settings_content .admin-table-wrapper table.admin_profile_fields_table tr td {
|
||||
width: 28%;
|
||||
}
|
||||
|
||||
.admin_profile_fields_table,
|
||||
.profile_field_choices_table {
|
||||
.movable-profile-field-row {
|
||||
|
||||
Reference in New Issue
Block a user