[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 28d816ef045ceb984bf8ca53c07e74dcd36e1be1

Shawn Moore sartak at bestpractical.com
Sat Feb 12 00:22:36 EST 2011


The branch, master has been updated
       via  28d816ef045ceb984bf8ca53c07e74dcd36e1be1 (commit)
      from  aa314dea229983f84453097e2309c8a28045df97 (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/View.pm |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 28d816ef045ceb984bf8ca53c07e74dcd36e1be1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sat Feb 12 00:22:13 2011 -0500

    Better handle the case where the user filters away all change_fields

diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 996f0da..22fcfa4 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -154,16 +154,22 @@ template 'change-update' => sub {
     my $change_fields = $change->change_fields;
     return if !$change_fields->count;
 
+    my $record = $change->record;
+
     span {
-        show 'record' => $change->record;
+        show 'record' => $record;
         outs _(' updated by ');
         show 'actor' => $change->created_by;
     };
 
+    my @change_fields = grep { !$record->hide_change_field($_) }
+                        @{ $change->change_fields->items_array_ref };
+
+    return if !@change_fields;
+
     ul {
         { class is 'change-fields' };
-        while (my $change_field = $change_fields->next) {
-            next if $change_field->record->hide_change_field($change_field);
+        for my $change_field (@change_fields) {
             show 'change_field' => $change_field;
         }
     };

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



More information about the Bps-public-commit mailing list