[Jifty-commit] r1605 - in jifty/branches/moose: . lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jul 17 21:47:14 EDT 2006


Author: audreyt
Date: Mon Jul 17 21:47:14 2006
New Revision: 1605

Modified:
   jifty/branches/moose/Makefile.PL
   jifty/branches/moose/lib/Jifty/Param.pm
   jifty/branches/moose/lib/Jifty/Param/Schema.pm

Log:
* Declarative Param is now auto-ordering; the sort_order field is
  defaulted to the order as they are generated.

Modified: jifty/branches/moose/Makefile.PL
==============================================================================
--- jifty/branches/moose/Makefile.PL	(original)
+++ jifty/branches/moose/Makefile.PL	Mon Jul 17 21:47:14 2006
@@ -44,7 +44,7 @@
 requires('Module::Pluggable' => '2.95');
 requires('Module::Refresh' => '0.09');
 requires('Moose' => '0.11');
-requires('Object::Declare');
+requires('Object::Declare' => '0.05');
 requires('Params::Validate');
 requires('Pod::Simple'); #Pod::Simple::Text
 requires('Scalar::Defer');

Modified: jifty/branches/moose/lib/Jifty/Param.pm
==============================================================================
--- jifty/branches/moose/lib/Jifty/Param.pm	(original)
+++ jifty/branches/moose/lib/Jifty/Param.pm	Mon Jul 17 21:47:14 2006
@@ -17,8 +17,10 @@
 has constructor         => qw( is rw isa Bool ); # XXX - bad name
 has valid_values        => qw( is rw isa Any );  # XXX - coercion
 has available_values    => qw( is rw isa Any );  # XXX - coercion
+has sort_order          => qw( is rw isa Int );
 no Moose;
 
+# Inhibit the reblessing inherent in Jifty::Web::Form::Field->BUILD
 sub BUILDALL { 1; }
 
 1;

Modified: jifty/branches/moose/lib/Jifty/Param/Schema.pm
==============================================================================
--- jifty/branches/moose/lib/Jifty/Param/Schema.pm	(original)
+++ jifty/branches/moose/lib/Jifty/Param/Schema.pm	Mon Jul 17 21:47:14 2006
@@ -20,7 +20,12 @@
     };
 
     Class::Data::Inheritable::mk_classdata($from => qw/PARAMS/);
-    $from->PARAMS( &declare($code) );
+    my @params = &declare($code);
+    my $count = 100; # arbitrary number
+    foreach my $param (@params) {
+        $param->sort_order($count++) if ref($param) and !defined($param->sort_order);
+    }
+    $from->PARAMS({ @params });
 
     no strict 'refs';
     push @{$from . '::ISA'}, 'Jifty::Action';


More information about the Jifty-commit mailing list