Changeset 5
- Timestamp:
- 06/21/06 01:25:32 (3 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
app/controllers/themes_controller.rb (modified) (1 diff)
-
app/views/themes/search.rhtml (modified) (2 diffs)
-
db/migrate/001_initial_schema.rb (modified) (1 diff)
-
db/schema.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/themes_controller.rb
r2 r5 13 13 @versions = [["", ""]] 14 14 @versions += Version.find(:all, :order => "name DESC").collect { |v| [v.name, v.id] } 15 16 unless @params["search"].nil? 17 name = @params["search"]["name"] 18 @themes = Theme.find(:all, :conditions=>["name like ?", "%#{name}%"], :order=>"name ASC") 19 end 15 20 end 16 21 -
trunk/app/views/themes/search.rhtml
r1 r5 1 1 <table> 2 <thead> 3 <%= form_tag({:action=>"search"}) %> 2 4 <tr> 3 5 <th>Name</th> … … 12 14 "version", 13 15 @versions) %></td> 14 <td><%= submit_t o_remote("submit","Search") %></td>16 <td><%= submit_tag("Search") %></td> 15 17 </tr> 18 </form> 19 </thead> 20 <tbody> 21 <% unless @themes.nil? 22 @themes.each { |theme| %> 23 <tr> 24 <td><%= link_to theme.name, {:action=>"view", :id=>theme.id } %></td> 25 <td></td> 26 <td></td> 27 </tr> 28 <% } 29 end %> 30 </tbody> 16 31 </table> -
trunk/db/migrate/001_initial_schema.rb
r1 r5 18 18 19 19 execute "ALTER TABLE themes_versions ADD CONSTRAINT theme_id_fkey FOREIGN KEY (theme_id) REFERENCES themes(id);" 20 execute "ALTER TABLE themes_versions ADD CONSTRAINT version_id_fkey FOREIGN KEY (version_id) REFERENCES themes(id);"20 execute "ALTER TABLE themes_versions ADD CONSTRAINT version_id_fkey FOREIGN KEY (version_id) REFERENCES versions(id);" 21 21 end 22 22 end -
trunk/db/schema.rb
r1 r5 7 7 create_table "themes", :force => true do |t| 8 8 t.column "name", :string 9 t.column "display_name", :string 9 10 end 10 11
