[Rt-commit] rt branch, 4.4/custom-field-class-callback, created. rt-4.4.1-123-g180de12
Dustin Graves
dustin at bestpractical.com
Thu Sep 29 11:30:01 EDT 2016
The branch, 4.4/custom-field-class-callback has been created
at 180de1228f547b35606eb22dd9191af99a6e41be (commit)
- Log -----------------------------------------------------------------
commit 23a265747c64cafc98773e8a924baf83f099e0a4
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu Sep 29 15:27:28 2016 +0000
refactor individual field row classes in Edit and ShowCustomFields
diff --git a/share/html/Elements/EditCustomFields b/share/html/Elements/EditCustomFields
index fbfb5ed..63208d4 100644
--- a/share/html/Elements/EditCustomFields
+++ b/share/html/Elements/EditCustomFields
@@ -60,8 +60,11 @@
% }
% for my $CustomField (@CustomFields) {
% my $Type = $CustomField->Type || 'Unknown';
-
- <<% $FIELD %> class="edit-custom-field cftype-<% $Type %>">
+% my @classes = (
+% 'edit-custom-field',
+% "cftype-$Type",
+% );
+ <<% $FIELD %> class="<% @classes ? join( ' ', @classes ) : '' %>">
<<% $CELL %> class="cflabel">
<span class="name"><% $CustomField->Name %>:</span><br />
<span class="type"><% $CustomField->EntryHint // '' %></span>
diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index 07b828e..1d7eba3 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -54,7 +54,12 @@
% my $Values = $Object->CustomFieldValues( $CustomField->Id );
% my $count = $Values->Count;
% next if $HideEmpty and not $count;
- <tr class="custom-field custom-field-<% $CustomField->id%><% $count ? q{} : q{ unset-field}%>" id="CF-<%$CustomField->id%>-ShowRow">
+% my @classes = (
+% 'custom-field',
+% 'custom-field-'.$CustomField->id,
+% );
+% push @classes, 'unset-field' if $count;
+ <tr class="<% @classes ? join( ' ', @classes ) : '' %>" id="CF-<%$CustomField->id%>-ShowRow">
<td class="label"><% $CustomField->Name %>:</td>
<td class="value<% $count ? '' : ' no-value' %>">
% unless ( $count ) {
commit 180de1228f547b35606eb22dd9191af99a6e41be
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu Sep 29 15:28:02 2016 +0000
add ModifyFieldClasses callback to Edit and ShowCustomFields
this lets you have callbacks to have certain custom fields with
different classes
particularly useful for highlighting / hiding certain fields
diff --git a/share/html/Elements/EditCustomFields b/share/html/Elements/EditCustomFields
index 63208d4..8d3c002 100644
--- a/share/html/Elements/EditCustomFields
+++ b/share/html/Elements/EditCustomFields
@@ -64,6 +64,8 @@
% 'edit-custom-field',
% "cftype-$Type",
% );
+% $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
+% Object => $Object, Classes => \@classes, Grouping => $Grouping );
<<% $FIELD %> class="<% @classes ? join( ' ', @classes ) : '' %>">
<<% $CELL %> class="cflabel">
<span class="name"><% $CustomField->Name %>:</span><br />
diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index 1d7eba3..058c529 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -59,6 +59,8 @@
% 'custom-field-'.$CustomField->id,
% );
% push @classes, 'unset-field' if $count;
+% $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
+% Object => $Object, Classes => \@classes, Grouping => $Grouping );
<tr class="<% @classes ? join( ' ', @classes ) : '' %>" id="CF-<%$CustomField->id%>-ShowRow">
<td class="label"><% $CustomField->Name %>:</td>
<td class="value<% $count ? '' : ' no-value' %>">
-----------------------------------------------------------------------
More information about the rt-commit
mailing list