create_at DATETIME NOT NULL,
update_at DATETIME NOT NULL);
-CREATE VIEW book_fulls (isbn, title, volume, author, publisher, pubdate, user_id) AS
+CREATE VIEW book_fulls (isbn, title, volume, author, publisher, pubdate,
+ user_id, cover_uri) AS
SELECT B.isbn AS isbn, B.title AS title, B.volume AS volume,
B.author AS author, B.publisher AS publisher, B.pubdate AS pubdate,
- C.user_id AS user_id
+ C.user_id AS user_id, B.cover_uri AS cover_uri
FROM (books AS B left join book_collections AS C
ON((B.isbn = C.isbn)));
if (find_books == nil)
break
end
- if (value =~ /^\/(.+)\/$/)
- reg_value = $~[1]
- find_books = find_books.with_regexp(key, reg_value)
+ if (key == :image_unregist)
+ # 書影の有無を確認するための検索
+ find_books = find_books.where(cover_uri: nil)
else
- find_books = find_books.where(key => value)
+ # 通常の要素検索
+ if (value =~ /^\/(.+)\/$/)
+ reg_value = $~[1]
+ find_books = find_books.with_regexp(key, reg_value)
+ else
+ find_books = find_books.where(key => value)
+ end
end
end
end
- # encoding: utf-8
- user_name = @username; book_list = @book_list
- start = @start; step = @step; index = @start; full_size = @full_size
+:ruby
+ find_keys = {
+ :title => '書名', :author => '著者', :publisher => '出版社',
+ :original_author => '原作', :illustrator => '作画', :translator => '翻訳',
+ :supervisor => '監修', :series => '単行本シリーズ',
+ :image_unregist => '書影未登録'
+ }
+
+- find_params = nil
+- if @find_status
+ - @find_status.each do |key, value|
+ - if value.empty?
+ - find_str = "#{find_keys[key]}"
+ - else
+ - find_str = "#{find_keys[key]} = #{value}"
+ - if find_params
+ - find_params += ", " + find_str
+ - else
+ - find_params = find_str
+
- if start + step >= full_size
- next_step = 0
- else
#{user_name} さんの蔵書一覧は以下となります。
.message
- 登録されている蔵書は #{full_size}冊になります。
+ - if find_params == nil
+ 登録されている蔵書は #{full_size}冊になります。
+ - else
+ 「#{find_params}」の条件にマッチする蔵書は #{full_size}冊になります。
.find_form
%form{:action => "/book_list/find", :method => "post"}
%tr
%td
%select{ :name => 'kind', :class => 'pulldown', :id => 'kind'}
- %option{ :value => 'title' }
- 書名
- %option{ :value => 'author' }
- 著者
- %option{ :value => 'publisher' }
- 出版社
- %option{ :value => 'original_author'}
- 原作
- %option{ :value => 'illustrator' }
- 作画
- %option{ :value => 'translator' }
- 翻訳
- %option{ :value => 'supervisor' }
- 監修
- %option{ :value => 'series' }
- 単行本シリーズ
+ - find_keys.each do | key, value |
+ %option{ :value => key.to_s }
+ #{value}
%td
%input{ :type => 'text', :class => 'input_text', :name => 'find_value', :id => 'find_value', :size => 40}
%td