-class SongsController < ApplicationController
+class SongsController < BaseController
+def index
+end
+
+def new
+ @song = Song.new
+end
+
end
module SongsHelper
+ HIRAGANA = %w(
+ あ い う え お か き く け こ さ し す せ そ @
+ た ち つ て と な に ぬ ね の は ひ ふ へ ほ @
+ ま み む め も や ゆ よ ら り る れ ろ @
+ わ @
+ )
+ KATAKANA = %w(
+ ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ @
+ タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ @
+ マ ミ ム メ モ ヤ ユ ヨ ワ リ ル レ ロ @
+ ワ @
+ )
+ ROMAN = %w(
+ A B C D E F G H I J K L M N @
+ O P Q R S T U V W X Y Z
+ )
+ SENTINEL = '@'
+
+ def letter_links(kind)
+ kind.map do |char|
+ unless char == SENTINEL
+ link_to char, list_songs_path(:letter => char)
+ else
+ '<br />'
+ end
+ end.join " "
+ end
end
+++ /dev/null
-<% content_for :head do -%>
- <title>Praise DATABASE</title>
-<% end -%>
-<h1 id="heading">Praise DATABASE</h1>
-
-<% form_for :search, :url => search_song_url do |f| -%>
- <%= f.label :word, '検索(search)' %>
- <%= f.text_field 'word' -%>
- <%= f.submit 'search' %>
-<% end -%>
--- /dev/null
+<% content_for :head do -%>
+ <title>Praise DATABASE</title>
+<% end -%>
+<h1 id="heading">Praise DATABASE</h1>
+
+<% form_for :search, :url => search_songs_path do |f| -%>
+ <%= f.label :word, '検索' %>
+ <%= f.text_field 'word' -%>
+ <%= f.submit 'search' %>
+<% end -%>
+
+<h2>歌いだしインデックス<br />
+First Letter Indexes</h2>
+
+<%= letter_links(SongsHelper::HIRAGANA) %>
+<%= letter_links(SongsHelper::KATAKANA) %>
+<%= letter_links(SongsHelper::ROMAN) %>
+
+<h2>操作<br />Operations</h2>
+
+<ul>
+ <li><%= link_to '新しい曲の追加 - Add a new song', new_song_path %></li>
+ <li><%= link_to '聖句検索 - Bible words' %></li>
+ <li><%= link_to 'メッセージレジュメ - Message summeries' %></li>
+</ul>
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
- map.resources :songs
+ map.resources :songs, :collection => { :search => [:get], :list => [:get] }
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'