OSDN Git Service

search thumbs
authornomeu <nomeu@nomeu.org>
Sun, 13 Jun 2010 22:23:14 +0000 (07:23 +0900)
committernomeu <nomeu@nomeu.org>
Sun, 13 Jun 2010 22:23:14 +0000 (07:23 +0900)
app/controllers/welcome_controller.rb
app/views/layouts/arcs.html.erb
app/views/welcome/index.html.erb

index 58dc089..e96f301 100644 (file)
@@ -8,6 +8,7 @@ class WelcomeController < ApplicationController
       @pmds = []
       @vmds = []
       @xes = []
+      @thumbs = []
     else
       @arc_search = Arc::Search.new(params[:search])
       @arcs = Arc.paginate(@arc_search.find_options.merge(:page => nil, :order => 'location_id, code', :per_page => 15, :include => :location))
@@ -17,6 +18,8 @@ class WelcomeController < ApplicationController
       @vmds = Vmd.paginate(@vmd_search.find_options.merge(:page => nil, :per_page => 15, :include => { :arc => :location }))
       @x_search = X::Search.new(params[:search])
       @xes = X.paginate(@x_search.find_options.merge(:page => nil, :per_page => 15, :include => { :arc => :location }))
+      @thumb_search = Thumb::Search.new(params[:search])
+      @thumbs = Thumb.paginate(@thumb_search.find_options.merge(:page => nil, :per_page => 15))
     end
   end
 
index e4ea406..3f1dd0a 100644 (file)
@@ -10,8 +10,8 @@
 <body>
 <div id="wrapper">
   <div id="top-menu">
+    <%= link_to _("Home"), root_path %>
     <div id="account">
-      <%= link_to "Home", root_path %>
     </div>
   </div>
   <div id="header">
index 743aa34..d7cbf4e 100644 (file)
   <%= link_to _('and more')+' &raquo;', xes_path(:search => params[:search]) %>
 </div>
 <%-end-%>
+
+<%-unless @thumbs.empty?-%>
+<p>
+  <b><%= _'thumb' %>:</b>
+</p>
+<table class="list thumbs">
+  <thead>
+  <tr>
+    <th><%= _'Thumb|Video' %></th>
+    <th><%= _'Thumb|Title' %></th>
+    <th><%= _'Thumb|Description' %></th>
+  </tr>
+  </thead>
+
+  <tbody>
+<% for thumb in @thumbs %>
+  <tr class="<%= cycle('odd', 'even') %>">
+    <td><%=link_to h(thumb.video_id), thumb %></td>
+    <td><%=h thumb.title %></td>
+    <td><%=h truncate(thumb.description) %></td>
+  </tr>
+<% end %>
+  </tbody>
+</table>
+<div class="pagination">
+  <%= link_to _('and more')+' &raquo;', thumbs_path(:search => params[:search]) %>
+</div>
+<%-end-%>