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

Shawn Moore sartak at bestpractical.com
Wed Feb 9 22:29:35 EST 2011


The branch, master has been updated
       via  4e3e5bbdeda4b9c681cdcd5068e1140f53ca5fa7 (commit)
       via  05532bb01e9be7dc4f847f1a310c28b94442d09e (commit)
       via  8d78f19faf68a9eac00f1d986c8dd85206330615 (commit)
      from  0c4b3ea605fee54ac6eac4578f25fc627ed07760 (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/View.pm             |   13 +++----
 t/TestApp-Plugin-RecordHistory/etc/config.yml      |   38 +++++---------------
 .../lib/TestApp/Plugin/RecordHistory/View.pm       |   11 ++++++
 t/TestApp-Plugin-RecordHistory/t/005-view.t        |   24 ++++++++++++
 4 files changed, 50 insertions(+), 36 deletions(-)
 create mode 100644 t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/View.pm
 create mode 100644 t/TestApp-Plugin-RecordHistory/t/005-view.t

- Log -----------------------------------------------------------------
commit 8d78f19faf68a9eac00f1d986c8dd85206330615
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 22:24:13 2011 -0500

    Load record only once and pass it into header, changes, and footer

diff --git a/lib/Jifty/Plugin/RecordHistory/View.pm b/lib/Jifty/Plugin/RecordHistory/View.pm
index 6225b9d..c8ab183 100644
--- a/lib/Jifty/Plugin/RecordHistory/View.pm
+++ b/lib/Jifty/Plugin/RecordHistory/View.pm
@@ -71,22 +71,21 @@ template 'index.html' => page { title => shift->page_title } content {
 };
 
 template 'header' => sub {
-    my $self = shift;
-    h1 { _('History for %1', $self->object_type) };
 };
 
 template 'footer' => sub {
 };
 
 template 'list' => sub {
-    show 'header';
-    show 'changes';
-    show 'footer';
+    my $record = $self->load_record;
+    show 'header' => $record;
+    show 'changes' => $record;
+    show 'footer' => $record;
 };
 
 template 'changes' => sub {
-    my $self = shift;
-    my $record = $self->load_record;
+    my $self    = shift;
+    my $record  = shift;
     my $changes = $record->changes;
 
     while (my $change = $changes->next) {

commit 05532bb01e9be7dc4f847f1a310c28b94442d09e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 22:24:23 2011 -0500

    Simplify plugin config

diff --git a/t/TestApp-Plugin-RecordHistory/etc/config.yml b/t/TestApp-Plugin-RecordHistory/etc/config.yml
index 302a25d..683df68 100644
--- a/t/TestApp-Plugin-RecordHistory/etc/config.yml
+++ b/t/TestApp-Plugin-RecordHistory/etc/config.yml
@@ -1,7 +1,7 @@
 # See perldoc Jifty::Config for more information about config files
 --- 
 framework: 
-  AdminMode: 1
+  AdminMode: 0
   ApplicationClass: TestApp::Plugin::RecordHistory
   ApplicationName: TestApp-Plugin-RecordHistory
   ApplicationUUID: D25CC0EA-33C9-11E0-887F-C54A534EF7F3
@@ -16,7 +16,7 @@ framework:
     RecordBaseClass: Jifty::DBI::Record::Cachable
     User: ''
     Version: 0.0.1
-  DevelMode: 1
+  DevelMode: 0
   L10N: 
     PoDir: share/po
   LogLevel: INFO
@@ -24,37 +24,17 @@ framework:
   MailerArgs: []
 
   Plugins: 
-    - 
-      AdminUI: {}
-
-    - 
-      CompressedCSSandJS: {}
-
-    - 
-      ErrorTemplates: {}
-
-    - 
-      Halo: {}
-
-    - 
-      LetMe: {}
-
-    - 
-      OnlineDocs: {}
-
-    - 
-      REST: {}
-
-    - 
-      SkeletonApp: {}
-
-    - 
-      RecordHistory: {}
+    - CompressedCSSandJS: {}
+    - ErrorTemplates: {}
+    - LetMe: {}
+    - REST: {}
+    - SkeletonApp: {}
+    - RecordHistory: {}
 
   PubSub: 
     Backend: Memcached
     Enable: ~
-  SkipAccessControl: 0
+  SkipAccessControl: 1
   TemplateClass: TestApp::Plugin::RecordHistory::View
   View: 
     Handlers: 

commit 4e3e5bbdeda4b9c681cdcd5068e1140f53ca5fa7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 22:24:34 2011 -0500

    Begin testing the templates

diff --git a/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/View.pm b/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/View.pm
new file mode 100644
index 0000000..49057b4
--- /dev/null
+++ b/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/View.pm
@@ -0,0 +1,11 @@
+package TestApp::Plugin::RecordHistory::View;
+use Jifty::View::Declare -base;
+
+use Jifty::Plugin::RecordHistory::View;
+
+alias Jifty::Plugin::RecordHistory::View under '/book/history', {
+    object_type => 'Book',
+};
+
+1;
+
diff --git a/t/TestApp-Plugin-RecordHistory/t/005-view.t b/t/TestApp-Plugin-RecordHistory/t/005-view.t
new file mode 100644
index 0000000..de4c2ca
--- /dev/null
+++ b/t/TestApp-Plugin-RecordHistory/t/005-view.t
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+use Jifty::Test::Dist tests => 20;
+my $server = Jifty::Test->make_server;
+isa_ok($server, 'Jifty::TestServer');
+my $URL  = $server->started_ok;
+my $mech = Jifty::Test::WWW::Mechanize->new;
+
+my $book = TestApp::Plugin::RecordHistory::Model::Book->new;
+$book->create(
+    title => '1984',
+);
+ok($book->id, 'created a book');
+
+$book->start_change;
+$book->set_title('Brave New World');
+$book->set_author('Aldous Huxley');
+$book->end_change;
+
+$mech->get_ok($URL . '/book/history?id=' . $book->id);
+$mech->save_content('test.html');
+

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



More information about the Bps-public-commit mailing list