[Bps-public-commit] App-Changeloggr branch, master, updated. dbb03de321db966008c365ac170b6cc668ee8871

sartak at bestpractical.com sartak at bestpractical.com
Mon May 11 20:03:03 EDT 2009


The branch, master has been updated
       via  dbb03de321db966008c365ac170b6cc668ee8871 (commit)
      from  5b0879f20978197bbb1b2e1bc44155c2f0903319 (commit)

Summary of changes:
 etc/config.yml                                     |    2 +-
 .../Changeloggr/Model/{Vote.pm => Rewording.pm}    |   27 +++++++------------
 2 files changed, 11 insertions(+), 18 deletions(-)
 copy lib/App/Changeloggr/Model/{Vote.pm => Rewording.pm} (63%)

- Log -----------------------------------------------------------------
commit dbb03de321db966008c365ac170b6cc668ee8871
Author: Shawn M Moore <sartak at gmail.com>
Date:   Mon May 11 20:02:51 2009 -0400

    Add Rewording model

diff --git a/etc/config.yml b/etc/config.yml
index 733c053..5283f9e 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -14,7 +14,7 @@ framework:
     Password: ''
     RecordBaseClass: Jifty::DBI::Record::Cachable
     User: ''
-    Version: 0.0.6
+    Version: 0.0.7
   DevelMode: 1
   L10N: 
     PoDir: share/po
diff --git a/lib/App/Changeloggr/Model/Rewording.pm b/lib/App/Changeloggr/Model/Rewording.pm
new file mode 100644
index 0000000..10ed025
--- /dev/null
+++ b/lib/App/Changeloggr/Model/Rewording.pm
@@ -0,0 +1,49 @@
+use strict;
+use warnings;
+
+package App::Changeloggr::Model::Rewording;
+use Jifty::DBI::Schema;
+use Scalar::Defer 'defer';
+
+use App::Changeloggr::Record schema {
+    column change_id =>
+        refers_to App::Changeloggr::Model::Change,
+        is mandatory,
+        is immutable,
+        render as 'hidden';
+
+    column user_id =>
+        refers_to App::Changeloggr::Model::User,
+        is mandatory,
+        is immutable,
+        is private,
+        default is defer { Jifty->web->current_user->user_object };
+
+    column message =>
+        type is 'text',
+        default is '';
+
+    column date =>
+        type is 'timestamp',
+        filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime),
+        label is 'Date',
+        default is defer { DateTime->now };
+};
+
+sub since { '0.0.7' }
+
+sub current_user_can {
+    my $self  = shift;
+    my $right = shift;
+    my %args  = @_;
+
+    # rewordings are public
+    return 1 if $right eq 'read' || $right eq 'create';
+
+    # but are otherwise immutable
+    return $self->SUPER::current_user_can($right, %args);
+}
+
+1;
+
+

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



More information about the Bps-public-commit mailing list