[Rt-commit] rt branch, 5.0/center-values-on-custom-field-edit-page, created. rt-5.0.0-165-gda52277053

Blaine Motsinger blaine at bestpractical.com
Tue Dec 22 15:30:26 EST 2020


The branch, 5.0/center-values-on-custom-field-edit-page has been created
        at  da5227705325d6a5aafc025ea37b5f9e178ec9b9 (commit)

- Log -----------------------------------------------------------------
commit da5227705325d6a5aafc025ea37b5f9e178ec9b9
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Tue Dec 22 14:17:44 2020 -0600

    Center values on custom field edit page
    
    This commit corrects the col definitions to center the add and edit
    values form rows on the custom field edit page.
    
    Additionally, if categories are enabled and the custom field is not
    a combobox, the description size will be col-4 instead of 6 to
    allow for the additional 2 cols.

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index fe3c2b36e0..e0483c0d31 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -281,9 +281,10 @@ jQuery( function() {
 <&| /Widgets/TitleBox, title => 'Values', class => 'custom-field-info-values', content_class => 'mx-auto width-lg' &>
 <div class="form-row">
   <div class="col-1"></div>
-  <div class="edit_custom_field_values col-11">
+  <div class="edit_custom_field_values col-10">
     <& /Admin/Elements/EditCustomFieldValues, CustomField => $CustomFieldObj &>
   </div>
+  <div class="col-1"></div>
 </div>
 </&>
 % }
diff --git a/share/html/Admin/Elements/AddCustomFieldValue b/share/html/Admin/Elements/AddCustomFieldValue
index 753299e205..56a3f4f5db 100644
--- a/share/html/Admin/Elements/AddCustomFieldValue
+++ b/share/html/Admin/Elements/AddCustomFieldValue
@@ -47,18 +47,22 @@
 %# END BPS TAGGED BLOCK }}}
 <div class="form-row">
   <div class="col-1"></div>
-  <div class="col-11">
+  <div class="col-10">
 <form name="AddCustomFieldValue" action="Modify.html" method="post">
 <input type="hidden" class="hidden" name="id" value="<% $CustomField->id %>" />
 
+% # we need to allow for an extra col-2 if not combobox and categories are enabled
+% # if so, make the description cols -2 smaller to allow for categories
+% my $description_col_size = ( $CustomField->Type ne 'Combobox' && $Categories ? 4 : 6 );
+
   <div class="form-row">
     <div class="label col-1 text-left">
       <&|/l&>Sort</&>
     </div>
-    <div class="label col-3 text-left">
+    <div class="label col-4 text-left">
       <&|/l&>Name</&>
     </div>
-    <div class="label col-3 text-left">
+    <div class="label col-<% $description_col_size %> text-left">
       <&|/l&>Description</&>
     </div>
 % if ( $CustomField->Type ne 'Combobox' && $Categories ) {
@@ -73,10 +77,10 @@
     <div class="value col-1">
       <input class="form-control" type="text" size="3"  name="<% $paramtag %>-SortOrder" />
     </div>
-    <div class="value col-3">
+    <div class="value col-4">
       <input class="form-control" type="text" size="25" name="<% $paramtag %>-Name" />
     </div>
-    <div class="value col-3">
+    <div class="value col-<% $description_col_size %>">
       <input class="form-control" type="text" size="45" name="<% $paramtag %>-Description" />
     </div>
 % if ( $CustomField->Type ne 'Combobox' && $Categories ) {
@@ -89,13 +93,14 @@
       </select>
     </div>
 % }
-    <div class="col-2">
+    <div class="col-1">
       <input type="submit" class="btn btn-primary btn-sm form-control" name="AddValue" value="<&|/l&>Add</&>" />
     </div>
   </div>
 % $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, ARGSRef => \%ARGS );
 </form>
 </div>
+  <div class="col-1"></div>
 </div>
 
 <script type="text/javascript">
diff --git a/share/html/Admin/Elements/EditCustomFieldValues b/share/html/Admin/Elements/EditCustomFieldValues
index 6393cb2dfe..bf0ef8be91 100644
--- a/share/html/Admin/Elements/EditCustomFieldValues
+++ b/share/html/Admin/Elements/EditCustomFieldValues
@@ -50,6 +50,10 @@
 %    return;
 % }
 
+% # we need to allow for an extra col-2 if not combobox and categories are enabled
+% # if so, make the description cols -2 smaller to allow for categories
+% my $description_col_size = ( $CustomField->Type ne 'Combobox' && $Categories ? 4 : 6 );
+
 <div class="form-row">
   <div class="label col-auto">
     <div class="custom-control custom-checkbox">
@@ -63,7 +67,7 @@
   <div class="label col-3 text-left">
     <&|/l&>Name</&>
   </div>
-  <div class="label col-3 text-left">
+  <div class="label col-<% $description_col_size %> text-left">
     <&|/l&>Description</&>
   </div>
 % if ( $CustomField->Type ne 'Combobox' && $Categories ) {
@@ -88,7 +92,7 @@
   <div class="value col-3">
     <input class="form-control" type="text" size="25" name="<% $paramtag %>-Name" value="<% $value->Name %>" />
   </div>
-  <div class="value col-3">
+  <div class="value col-<% $description_col_size %>">
     <input class="form-control" type="text" size="45" name="<% $paramtag %>-Description" value="<% $value->Description || '' %>" />
   </div>
 % if ( $CustomField->Type ne 'Combobox' && $Categories ) {
@@ -103,7 +107,7 @@
     </select>
   </div>
 % }
-  <div class="col-2">
+  <div class="col-1">
     <input type="button" class="delete_custom_field_value button btn btn-primary" data-cfv-id="<% $value->id %>" value="<&|/l&>Delete</&>" onclick="delete_custom_field_value(<% $value->id %>)" />
   </div>
 % $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, CustomFieldValueObj => $value, ARGSRef => \%ARGS );

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


More information about the rt-commit mailing list