OSDN Git Service

ポイントでフォントサイズを指定
authorcake <cake@users.sourceforge.jp>
Sat, 25 Sep 2010 11:51:42 +0000 (20:51 +0900)
committercake <cake@users.sourceforge.jp>
Sat, 25 Sep 2010 11:51:42 +0000 (20:51 +0900)
app/models/song.rb
app/views/songs/_form.html.erb
app/views/songs/edit.html.erb
app/views/songs/show.html.erb

index c47e6b4..54db88f 100644 (file)
@@ -4,11 +4,11 @@ class Song < ActiveRecord::Base
   before_save :make_words_for_search
 
   selectable_attr :font_size do
-    entry "0", :xsmall, "25pt"
-    entry "1", :small,  "30pt"
-    entry "2", :middle, "34pt"
-    entry "3", :large,  "39pt"
-    entry "4", :xlarge, "44pt"
+    entry 0, :xsmall, "XSmall", :point => "25pt"
+    entry 1, :small,  "Small",  :point => "30pt"
+    entry 2, :middle, "Middle", :point => "34pt"
+    entry 3, :large,  "Large",  :point => "39pt"
+    entry 4, :xlarge, "XLarge", :point => "44pt"
   end
 
   RUBY_KANJI_HIRA   = %r/([一-龠]+)\(([ぁ-ん]+)\)/
index efc3f6a..52b9b3c 100644 (file)
@@ -1,24 +1,24 @@
 <%= f.error_messages %>
 <table>
   <tr>
-    <th>コード(CODE)</th>
+    <th><%= f.label :code, 'コード(CODE)' %></th>
     <td><%= f.select :code, Song::CODES, :include_blank => true %></td>
   </tr>
   <tr>
-    <th>題名(TITLE)</th>
+    <th><%= f.label :title, '題名(TITLE)' %></th>
     <td><%= f.text_field :title %></td>
   </tr>
   <tr>
-    <th>歌詞(WORDS)</th>
+    <th><%= f.label :words, '歌詞(WORDS)' %></th>
     <td><%= f.text_area :words, :size => "40x8" %></td>
   </tr>
   <tr>
-    <th>出典(SOURCE)</th>
+    <th><%= f.label :copyrigyt, '出典(SOURCE)' %></th>
     <td><%= f.text_field :copyright %></td>
   </tr>
   <tr>
-    <th>表示サイズ(FONT SIZE)</th>
-    <td><%= f.select :font_size, Song.font_size_options %></td>
+    <th><%= f.label :font_size, '表示サイズ(FONT SIZE)' %></th>
+    <td><%= f.select :font_size %></td>
   </tr>
   <tr>
     <td colspan="2"><%= f.submit "保存する(SAVE)" %></td>
index 466736f..4a81626 100644 (file)
 <%= button_to "このデータを削除する", @song, :confirm => '本当に削除しますか?', :method => :delete %>
 [<%= link_to "表示", @song %>]
 [<%= link_to "印刷用画面", print_song_path(@song) %>]
-[<%= link_to "トップに戻る", song_path %>]
+[<%= link_to "トップに戻る", songs_path %>]
 [<%= link_to_function "ローマ字", "toRoman()" %>]
 [<%= link_to_function "リセット", "reset()" %>]
 
 <hr />
-
+<div id="song_preview" style="font-size:18pt; width:20em;border:solid gray 1px">
 <%= format_words(@song) %>
+</div>
index 01ab05d..c978687 100644 (file)
@@ -3,7 +3,7 @@
   <%= javascript_include_tag "show_song" %>
 <script type="text/javascript">
 Event.observe(window, 'load', function() {
-  init(<%= @song.font_size_name %>);
+  init('<%=j @song.font_size_entry[:point] %>');
 });
 </script>
 <%- end -%>