]> git.decadent.org.uk Git - maypole.git/commitdiff
search_form now uses search columns
authorAaron Trevena <aaron.trevena@gmail.com>
Thu, 2 Nov 2006 15:08:01 +0000 (15:08 +0000)
committerAaron Trevena <aaron.trevena@gmail.com>
Thu, 2 Nov 2006 15:08:01 +0000 (15:08 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@543 48953598-375a-da11-a14b-00016c27c3ee

lib/Maypole/templates/factory/search_form

index f67be23914a8a71f7ca4c41259037acad939dbe3..8aef790fcbb87a778f1b831a2986c8f0f6087e61 100644 (file)
@@ -1,20 +1,26 @@
+
+<!-- ### Search component ### -->
+
 <div id="search">
 <form method="get" action="[% base %]/[% classmetadata.moniker %]/search/">
 <fieldset>
 <legend>Search</legend>
-        [% FOR col = classmetadata.search_columns %]
-           <label>
-                <span class="field">[% classmetadata.colnames.$col; %]</span>
-                    [% SET element = classmetadata.cgi.$col;
-                    IF element.tag == "select";
-                        USE element_maker = Class("HTML::Element");
-                        SET element = element.unshift_content(
-                            element_maker.new("option", value," "));
-                    END;
-                   element.as_XML; %]
-                  </label>
-        [% END; %]
-    <input type="submit" name="search" value="search"/>
-    </fieldset>
+[% USE search_class = Class request.model_class; %]
+[% FOR col = search_class.search_columns() %]
+  <label>
+     <span class="field">[% classmetadata.colnames.$col; %]</span>
+     [% SET element = classmetadata.cgi.$col;
+      IF element.tag == "select";
+      USE element_maker = Class("HTML::Element");
+      SET element = element.unshift_content(
+      element_maker.new("option", value," "));
+      END;
+      element.as_XML; %]
+  </label>
+[% END; %]
+<input type="submit" name="search" value="search"/>
+</fieldset>
 </form>
 </div>
+
+<!-- # Search end -->