[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-193-g7d49a62e1

? sunnavy sunnavy at bestpractical.com
Mon Apr 2 17:03:32 EDT 2018


The branch, 4.6/inline-edit has been updated
       via  7d49a62e11c38ffe7ed1e91fb48c3342b51bf2b7 (commit)
      from  62b7ef03cebd0e0353d9d0908575eea3b2393323 (commit)

Summary of changes:
 share/html/Elements/ShowCustomFieldCustomGroupings | 13 +++++++++++++
 1 file changed, 13 insertions(+)

- Log -----------------------------------------------------------------
commit 7d49a62e11c38ffe7ed1e91fb48c3342b51bf2b7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 3 04:40:39 2018 +0800

    Don't show empty custom field groupings
    
    For current ShowCustomFieldCustomGroupings, "hide_empty" doesn't work
    because it returns div/form blocks even there are no custom fields to
    show. This commit fixes it by adding another "hide empty" logic(it also
    respects the "MassageCustomFields" callback in ShowCustomFields).

diff --git a/share/html/Elements/ShowCustomFieldCustomGroupings b/share/html/Elements/ShowCustomFieldCustomGroupings
index a82a76e8a..cedc310bf 100644
--- a/share/html/Elements/ShowCustomFieldCustomGroupings
+++ b/share/html/Elements/ShowCustomFieldCustomGroupings
@@ -47,6 +47,19 @@
 %# END BPS TAGGED BLOCK }}}
 <%perl>
 for my $group ( @Groupings ) {
+    my $CustomFields = $Object->CustomFields;
+    $m->callback(
+        Table        => 1, # default is true
+        %ARGS,
+        CallbackPage => '/Elements/ShowCustomFields',
+        CallbackName => 'MassageCustomFields',
+        Object       => $Object,
+        CustomFields => $CustomFields,
+    );
+
+    $CustomFields->LimitToGrouping( $Object => $group );
+    next unless $CustomFields->First;
+
     my $modify_url = $title_href ? "$title_href?id=".$Object->id.($group?";Grouping=".$m->interp->apply_escapes($group,'u')."#".CSSClass("$css_class-$group") : "#".$css_class) : undef;
     my $modify_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes(($modify_url||'#'), 'h' ).'">'.$edit_label.'</a>';
     my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{$group} || $inline_edit_behavior{_default} || 'link') : 'hide';

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


More information about the rt-commit mailing list