[Jifty-commit] jifty branch, master, updated. 36cc491e8b1424a6d79bc3e7aad57dbb753467e9

Jifty commits jifty-commit at lists.jifty.org
Fri Aug 20 11:45:26 EDT 2010


The branch, master has been updated
       via  36cc491e8b1424a6d79bc3e7aad57dbb753467e9 (commit)
      from  defe7fbc66416ec5c85e18a58646fba91c2a4906 (commit)

Summary of changes:
 lib/Jifty/View/Declare/CRUD.pm |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 36cc491e8b1424a6d79bc3e7aad57dbb753467e9
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Aug 20 11:47:35 2010 -0400

    Allow subclasses to customize which search fields are rendered

diff --git a/lib/Jifty/View/Declare/CRUD.pm b/lib/Jifty/View/Declare/CRUD.pm
index 72ff9b3..aa13bb4 100644
--- a/lib/Jifty/View/Declare/CRUD.pm
+++ b/lib/Jifty/View/Declare/CRUD.pm
@@ -396,7 +396,11 @@ template 'index.html' => page {
 
 =head2 search
 
-The search fragment displays a search screen connected to the search action of the module. 
+The search fragment displays a search screen connected to the search action of
+the module.  If your subclass can C<search_fields>, then that method will be
+called and the return value (which should be a list) will be used as a list of
+fields to render.  Otherwise, all the fields of the Search action are
+displayed.
 
 See L<Jifty::Action::Record::Search>.
 
@@ -411,8 +415,15 @@ template 'search' => sub {
     );
 
     div {
-        { class is "jifty_admin" };
-        render_action($search);
+        { class is "jifty_admin crud-search-form" };
+
+        if ( $self->can('search_fields') ) {
+            render_param( $search => $_ )
+                for $self->search_fields;
+        }
+        else {
+            render_action($search);
+        }
 
         $search->button(
             label   => _('Search'),

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


More information about the Jifty-commit mailing list