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

Shawn Moore sartak at bestpractical.com
Wed Feb 9 22:53:43 EST 2011


The branch, master has been updated
       via  b8ebcbe438f3a4cee885b5ce1dab0d3895f70de1 (commit)
      from  f8d513676971f910a1b9dd15beaec2b94c0cc939 (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/View.pm |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit b8ebcbe438f3a4cee885b5ce1dab0d3895f70de1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 22:53:34 2011 -0500

    Begin displaying actor for changes

diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 287c772..cedb97f 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -128,7 +128,10 @@ template 'change-create' => sub {
     my $self   = shift;
     my $change = shift;
 
-    outs _('Record created.');
+    span {
+        outs _('Record created by ');
+        show 'actor' => $change->created_by;
+    };
 };
 
 template 'change-update' => sub {
@@ -138,7 +141,11 @@ template 'change-update' => sub {
     my $change_fields = $change->change_fields;
     return if !$change_fields->count;
 
-    outs _('Record updated.');
+    span {
+        outs _('Record updated by ');
+        show 'actor' => $change->created_by;
+    };
+
     ul {
         while (my $change_field = $change_fields->next) {
             show 'change_field' => $change_field;
@@ -157,5 +164,14 @@ template 'change_field' => sub {
     li { _("%1 changed from '%2' to '%3'.", $field, $old, $new) };
 };
 
+template 'actor' => sub {
+    my $self  = shift;
+    my $actor = shift;
+
+    return outs _('somebody') if !$actor->id || !$actor->current_user_can('read');
+    return outs $actor->email if $actor->can('email');
+    return outs _('user #%1', $actor->id);
+};
+
 1;
 

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



More information about the Bps-public-commit mailing list