[Rt-commit] rt branch, 5.0/increase-custom-field-label-cols, created. rt-5.0.1-11-gdd6935a66e

Craig Kaiser craig at bestpractical.com
Tue Feb 16 17:51:40 EST 2021


The branch, 5.0/increase-custom-field-label-cols has been created
        at  dd6935a66e3a128d9a1eae701b64575a1a0a5d60 (commit)

- Log -----------------------------------------------------------------
commit b0fc27d0905ccd932d806d21ba1d8331c1f69660
Author: craig kaiser <craig at bestpractical.com>
Date:   Tue Feb 16 17:42:42 2021 -0500

    Encapsulate inline Perl in <%perl> block

diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index 71d4610732..d1d5fb1fec 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -51,20 +51,22 @@
 <div>
 % }
 % while ( my $CustomField = $CustomFields->Next ) {
-% my $Values = $Object->CustomFieldValues( $CustomField->Id );
-% my $count = $Values->Count;
-% next if $HideEmpty and not $count;
-% my $CustomFieldName = $CustomField->Name;
-%#The following substitution replaces all non-ID_Continue characters with a dash character. The ID_Continue Unicode property was chosen because it (combined with ID_Start) is meant for variable names. ID_Continue includes characters suitable for use in CSS-class names (even non-Latin ones, to support non-English custom field names) and excludes syntactic characters that are not (such as whitespace characters).
-% $CustomFieldName =~ s/\P{ID_Continue}+/-/g;
-% my @classes = (
-%   'custom-field',
-%   'custom-field-'.$CustomField->id,
-%   'custom-field-'.$CustomFieldName,
-% );
-% push @classes, 'unset-field' if not $count;
-% $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
-%               Object => $Object, Classes => \@classes, Grouping => $Grouping );
+<%perl>
+my $Values = $Object->CustomFieldValues( $CustomField->Id );
+my $count = $Values->Count;
+next if $HideEmpty and not $count;
+my $CustomFieldName = $CustomField->Name;
+#The following substitution replaces all non-ID_Continue characters with a dash character. The ID_Continue Unicode property was chosen because it (combined with ID_Start) is meant for variable names. ID_Continue includes characters suitable for use in CSS-class names (even non-Latin ones, to support non-English custom field names) and excludes syntactic characters that are not (such as whitespace characters).
+$CustomFieldName =~ s/\P{ID_Continue}+/-/g;
+my @classes = (
+   'custom-field',
+   'custom-field-'.$CustomField->id,
+   'custom-field-'.$CustomFieldName,
+);
+push @classes, 'unset-field' if not $count;
+$m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
+               Object => $Object, Classes => \@classes, Grouping => $Grouping );
+</%perl>
   <div class="form-row <% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">
     <div class="label col-2"><% $CustomField->Name %>:</div>
     <div class="value col-10 <% $count ? '' : ' no-value' %>">

commit dd6935a66e3a128d9a1eae701b64575a1a0a5d60
Author: craig kaiser <craig at bestpractical.com>
Date:   Tue Feb 16 17:48:04 2021 -0500

    Only use col-2/10 layout for transaction custom fields

diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index d1d5fb1fec..5d0e01bb14 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -66,10 +66,16 @@ my @classes = (
 push @classes, 'unset-field' if not $count;
 $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
                Object => $Object, Classes => \@classes, Grouping => $Grouping );
+
+my ($labelCols, $valueCols) = (3, 9);
+# If we a have transaction custom field we want smaller label section:
+if ( $CustomField->LookupType eq 'RT::Queue-RT::Ticket-RT::Transaction' ) {
+    ($labelCols, $valueCols) = (2, 10);
+}
 </%perl>
   <div class="form-row <% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">
-    <div class="label col-2"><% $CustomField->Name %>:</div>
-    <div class="value col-10 <% $count ? '' : ' no-value' %>">
+    <div class="label col-<% $labelCols %>"><% $CustomField->Name %>:</div>
+    <div class="value col-<% $valueCols %> <% $count ? '' : ' no-value' %>">
       <span class="current-value">
 % unless ( $count ) {
 <&|/l&>(no value)</&>

-----------------------------------------------------------------------


More information about the rt-commit mailing list