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

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


The branch, master has been updated
       via  aa314dea229983f84453097e2309c8a28045df97 (commit)
      from  586148d8c8a9794efd1fdd9bef47477c4fe43aaf (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/View.pm      |   14 ++++++++++++--
 t/TestApp-Plugin-RecordHistory/t/005-view.t |    4 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit aa314dea229983f84453097e2309c8a28045df97
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sat Feb 12 00:14:12 2011 -0500

    Display the record class name instead of Record

diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index c89da55..996f0da 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -141,7 +141,8 @@ template 'change-create' => sub {
     my $change = shift;
 
     span {
-        outs _('Record created by ');
+        show 'record' => $change->record;
+        outs _(' created by ');
         show 'actor' => $change->created_by;
     };
 };
@@ -154,7 +155,8 @@ template 'change-update' => sub {
     return if !$change_fields->count;
 
     span {
-        outs _('Record updated by ');
+        show 'record' => $change->record;
+        outs _(' updated by ');
         show 'actor' => $change->created_by;
     };
 
@@ -181,6 +183,14 @@ template 'change_field' => sub {
     };
 };
 
+template 'record' => sub {
+    my $self   = shift;
+    my $record = shift;
+
+    (my $class = ref $record) =~ s/.*:://;
+    return outs $class;
+};
+
 template 'actor' => sub {
     my $self  = shift;
     my $actor = shift;
diff --git a/t/TestApp-Plugin-RecordHistory/t/005-view.t b/t/TestApp-Plugin-RecordHistory/t/005-view.t
index 6f14a2b..70bf1b7 100644
--- a/t/TestApp-Plugin-RecordHistory/t/005-view.t
+++ b/t/TestApp-Plugin-RecordHistory/t/005-view.t
@@ -20,8 +20,8 @@ $book->set_author('Aldous Huxley');
 $book->end_change;
 
 $mech->get_ok($URL . '/book/history?id=' . $book->id);
-$mech->text_contains("Record created by 0");
-$mech->text_contains("Record updated by 0");
+$mech->text_contains("Book created by 0");
+$mech->text_contains("Book updated by 0");
 $mech->text_contains("title changed from '1984' to 'Brave New World'");
 $mech->text_contains("author changed from '' to 'Aldous Huxley'");
 

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



More information about the Bps-public-commit mailing list