[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 0.06-1-g885ce27

Thomas Sibley trs at bestpractical.com
Thu May 26 10:10:24 EDT 2011


The branch, master has been updated
       via  885ce27aa9351ac2e4d75eb6b17e4c7b94c1298d (commit)
      from  2f002aa2df331727a197d9f3cf83834908f8a521 (commit)

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

- Log -----------------------------------------------------------------
commit 885ce27aa9351ac2e4d75eb6b17e4c7b94c1298d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 26 10:08:53 2011 -0400

    Support two ways of overriding the collection of Changes displayed
    
    A simple user of this view can set the changeset template variable.  A
    more advanced subclass of this view class can override the changes_for
    method.

diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 33bbdc8..6c07bfe 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -68,6 +68,12 @@ sub load_record {
     return $record;
 }
 
+sub changes_for {
+    my $self   = shift;
+    my $record = shift;
+    return $record->changes;
+}
+
 template 'index.html' => page { title => shift->page_title } content {
     show 'list';
 };
@@ -96,7 +102,7 @@ template 'no-changes' => sub {
 template 'changes' => sub {
     my $self    = shift;
     my $record  = get 'record';
-    my $changes = $record->changes;
+    my $changes = get('changeset') || $self->changes_for($record);
 
     if ($changes->count == 0) {
         show 'no-changes';

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



More information about the Bps-public-commit mailing list