--- /dev/null
+class SeigasController < ApplicationController
+ layout 'arcs'
+ before_filter :login_required, :only => [ :new, :edit, :create, :update, :destroy ]
+
+ # GET /seigas
+ # GET /seigas.xml
+ def index
+ @search = Seiga::Search.new(params[:search])
+ @seigas = Seiga.search(@search).paginate([ '_id' ], :size => 30, :page => params[:page])
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @seigas }
+ end
+ end
+
+ # GET /seigas/1
+ # GET /seigas/1.xml
+ def show
+ @seiga = Seiga.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @seiga }
+ end
+ end
+end
@vmds = Vmd.select { |rec| rec.updated_at > time }.paginate([ :key => 'updated_at', :order => :desc ], :size => 15)
@xes = X.select { |rec| rec.updated_at > time }.paginate([ :key => 'updated_at', :order => :desc ], :size => 15)
@thumbs = Thumb.select { |rec| rec.updated_at > time }.paginate([ :key => 'updated_at', :order => :desc ], :size => 15)
+ @seigas = Seiga.select { |rec| rec.updated_at > time }.paginate([ :key => 'updated_at', :order => :desc ], :size => 15)
else
@arc_search = Arc::Search.new(params[:search])
@arcs = Arc.search(@arc_search).paginate([ 'site', '_key' ], :size => 15, :page => params[:page])
@xes = X.search(@x_search).paginate([ '_id' ], :size => 15, :page => params[:page])
@thumb_search = Thumb::Search.new(params[:search])
@thumbs = Thumb.search(@thumb_search).paginate([ '_id' ], :size => 15, :page => params[:page])
+ @seiga_search = Seiga::Search.new(params[:search])
+ @seigas = Seiga.search(@seiga_search).paginate([ '_id' ], :size => 15, :page => params[:page])
end
end
--- /dev/null
+module SeigasHelper
+ def nico_seiga(image_id)
+ content_tag 'iframe', '', :src => "http://ext.seiga.nicovideo.jp/thumb/" + u(image_id), :width => 312, :height => 176, :scrolling => "no", :frameborder => 0
+ end
+end
class Seiga < ActiveGroonga::Base
+ def self.search(search)
+ if search.text.blank?
+ all
+ else
+ select { |rec|
+ rec.match(search.text) { |mat|
+ (mat.title * 1) | (mat.description * 1)
+ }
+ }
+ end
+ end
+
+ def image_id
+ key
+ end
+
+ class Search
+ attr_accessor :text
+
+ def initialize(attributes)
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end if attributes
+ end
+ end
end
<li><%= link_menu_to _("x"), xes_path %></li>
<li><%= link_menu_to _("site"), sites_path %></li>
<li><%= link_menu_to _("thumb"), thumbs_path %></li>
+ <li><%= link_menu_to _("seiga"), seigas_path %></li>
<li><%= link_menu_to _("about"), welcome_about_path %></li>
</ul>
</div>
--- /dev/null
+<%=form_for(@search, :as => :search, :url => seigas_path, :html => { :method => :get }) do |f| %>
+ <p>
+ <%= _'Seiga|Title' %> or <%= _'Seiga|Description' %><br />
+ <%= f.text_field :text %>
+ <%= f.submit t("search") %>
+ </p>
+<% end %>
+<table class="list seigas">
+ <thead>
+ <tr>
+ <th><%= _'Seiga|Image' %></th>
+ <th><%= _'Seiga|Title' %></th>
+ <th><%= _'Seiga|Description' %></th>
+ </tr>
+ </thead>
+
+ <tbody>
+<% @seigas.each do |seiga| %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%=link_to seiga.image_id, seiga_path(seiga) %></td>
+ <td><%= seiga.title %></td>
+ <td><%= truncate(seiga.description) %></td>
+ </tr>
+<% end %>
+ </tbody>
+</table>
+
+<%= paginate(@seigas) %>
--- /dev/null
+<p>
+ <b><%= _'Seiga|Image' %>:</b>
+ <%= @seiga.image_id %>
+</p>
+
+<p>
+ <b><%= _'Seiga|Title' %>:</b>
+ <%= @seiga.title %>
+</p>
+
+<p>
+ <b><%= _'Seiga|Description' %>:</b>
+ <%= @seiga.description %>
+</p>
+
+<%= nico_seiga(@seiga.image_id) %>
<%= link_to t('and_more'), thumbs_path(:search => params[:search]) %>
</div>
<%-end-%>
+
+<%-if @seigas.count != 0-%>
+<p>
+ <b><%= _'seiga' %>:</b>
+</p>
+<table class="list seigas">
+ <thead>
+ <tr>
+ <th><%= _'Seiga|Image' %></th>
+ <th><%= _'Seiga|Title' %></th>
+ <th><%= _'Seiga|Description' %></th>
+ </tr>
+ </thead>
+
+ <tbody>
+<% for seiga in @seigas %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%=link_to seiga.image_id, seiga_path(seiga) %></td>
+ <td><%= seiga.title %></td>
+ <td><%= truncate(seiga.description) %></td>
+ </tr>
+<% end %>
+ </tbody>
+</table>
+<div class="pagination">
+ <%= link_to t('and_more'), seigas_path(:search => params[:search]) %>
+</div>
+<%-end-%>
site: "ロダ"
pmd: "モデル"
thumb: "動画"
+ seiga: "静画"
user: "User"
vmd: "モーション"
x: "アクセサリ"
arcs: Arcs
arc_thumbs: "書庫動画関連"
+ seiga:
+ image: "No."
+ title: "タイトル"
+ description: "説明文"
+
user:
login: "ログイン"
password: "パスワード"
resources :vmds, :only => :index
resources :xes, :only => :index
resources :thumbs, :only => [ :index, :show ]
+ resources :seigas, :only => [ :index, :show ]
resource :session
root :to => 'welcome#index'
get 'welcome/about'