[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 151dcb5cfce9c73c8f51fbe005f71c552016482d
Shawn Moore
sartak at bestpractical.com
Wed Feb 9 22:35:54 EST 2011
The branch, master has been updated
via 151dcb5cfce9c73c8f51fbe005f71c552016482d (commit)
via 41eae83aab84acddaf4148d1b1f51992c9ad17cb (commit)
from eaaa3e8c6c65cd78191a94838e1e458742a9595d (commit)
Summary of changes:
lib/Jifty/Plugin/RecordHistory/View.pm | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 41eae83aab84acddaf4148d1b1f51992c9ad17cb
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Feb 9 22:35:13 2011 -0500
On second thought, set/get record instead of passing it through every template
diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 7043493..7637324 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -77,15 +77,16 @@ template 'footer' => sub {
};
template 'list' => sub {
- my $record = $self->load_record;
- show 'header' => $record;
- show 'changes' => $record;
- show 'footer' => $record;
+ my $self = shift;
+ set record => $self->load_record;
+ show 'header';
+ show 'changes';
+ show 'footer';
};
template 'changes' => sub {
my $self = shift;
- my $record = shift;
+ my $record = get 'record';
my $changes = $record->changes;
while (my $change = $changes->next) {
commit 151dcb5cfce9c73c8f51fbe005f71c552016482d
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Feb 9 22:35:43 2011 -0500
Show a special no-changes template if needed
diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 7637324..c426252 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -84,11 +84,20 @@ template 'list' => sub {
show 'footer';
};
+template 'no-changes' => sub {
+ p { _("No changes.") };
+};
+
template 'changes' => sub {
my $self = shift;
my $record = get 'record';
my $changes = $record->changes;
+ if ($changes->count == 0) {
+ show 'no-changes';
+ return;
+ }
+
while (my $change = $changes->next) {
show 'change' => $change;
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list