[Jifty-commit] r5958 - in jifty/trunk/lib/Jifty/Action: Record

Jifty commits jifty-commit at lists.jifty.org
Tue Oct 21 04:03:32 EDT 2008


Author: ruz
Date: Tue Oct 21 04:03:32 2008
New Revision: 5958

Modified:
   jifty/trunk/lib/Jifty/Action/Record.pm
   jifty/trunk/lib/Jifty/Action/Record/Update.pm

Log:
* simplify some code by using possible_columns instead of possible_fields

Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm	Tue Oct 21 04:03:32 2008
@@ -185,21 +185,12 @@
 
     # Get ready to rumble
     my $field_info = {};
-    my @fields     = $self->possible_fields;
+    my @columns     = $self->possible_columns;
 
     # we use a while here because we may be modifying the fields on the fly.
-    while ( my $field = shift @fields ) {
+    while ( my $column = shift @columns ) {
         my $info = {};
-        my $column;
-
-        # The field is a column object, adjust to that
-        if ( ref $field ) {
-            $column = $field;
-        } else {
-            $column = $self->record->column($field);
-        }
-
-        $field = $column->name;
+        my $field = $column->name;
 
         # Canonicalize the render_as setting for the column
         my $render_as = lc( $column->render_as || '' );

Modified: jifty/trunk/lib/Jifty/Action/Record/Update.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Update.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record/Update.pm	Tue Oct 21 04:03:32 2008
@@ -36,7 +36,7 @@
     my $arguments = $self->SUPER::arguments(@_);
 
     # Mark read-only columns for read-only display
-    for my $column ( map {$self->record->column($_)} $self->possible_fields ) {
+    for my $column ( $self->possible_columns ) {
         if ( not $column->writable and $column->readable ) {
             $arguments->{$column->name}{'render_mode'} = 'read';
         }


More information about the Jifty-commit mailing list