OSDN Git Service

t#30102:update i18n color,sp,sbt
authoryasushiito <yas@pen-chan.jp>
Thu, 15 Nov 2012 10:25:46 +0000 (19:25 +0900)
committeryasushiito <yas@pen-chan.jp>
Thu, 15 Nov 2012 10:25:46 +0000 (19:25 +0900)
16 files changed:
app/controllers/colors_controller.rb
app/views/colors/index.html.erb
app/views/colors/list.html.erb [new file with mode: 0644]
app/views/panels/_body.html.erb
app/views/speech_balloon_templates/_form.html.erb [deleted file]
app/views/speech_balloon_templates/browse.html.erb
app/views/speech_balloon_templates/index.html.erb
app/views/speech_balloon_templates/list.html.erb
app/views/speech_balloon_templates/show.html.erb
app/views/system/browse.html.erb
app/views/system_pictures/browse.html.erb
app/views/system_pictures/index.html.erb
app/views/system_pictures/list.html.erb
app/views/system_pictures/new.html.erb [deleted file]
app/views/system_pictures/show.html.erb
config/routes.rb

index ea99428..6c3ae00 100644 (file)
@@ -1,5 +1,6 @@
 class ColorsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
+  before_filter :authenticate_admin!, :only => [:list]
   
   # GET /colors
   # GET /colors.json
@@ -13,4 +14,13 @@ class ColorsController < ApplicationController
       format.json { render json: @colors.to_json(Color.list_json_opt) }
     end
   end
+  
+  def list
+    @colors = Color.all
+
+    respond_to do |format|
+      format.html { render layout: 'system' }# index.html.erb
+      format.json { render json: @colors }
+    end
+  end
 end
index 907e97f..b9e5286 100644 (file)
@@ -1,19 +1,9 @@
-<h1>Listing Colors</h1>
+<h1><%= t '.title' -%></h1>
 
 <table>
-  <tr>
-    <th>id</th>
-    <th>name</th>
-    <th>code</th>
-    <th>t</th>
-  </tr>
-
 <% @colors.each do |c| %>
   <tr>
-    <td><%= c.id %></td>
-    <td><%= h c.name %></td>
-    <td><%= c.code %><font color="<%= c.code %>">*****</font></td>
-    <td><%= c.t %></td>
+    <td style="color: #<%= format("%06x", c.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", c.code) -%>;"><%= h c.name %></td>
   </tr>
 <% end -%>
 </table>
diff --git a/app/views/colors/list.html.erb b/app/views/colors/list.html.erb
new file mode 100644 (file)
index 0000000..ca7f67e
--- /dev/null
@@ -0,0 +1,25 @@
+<h1><%= t '.title' -%></h1>
+
+<table>
+  <tr>
+    <th><%= t_m 'Color.id' -%></th>
+    <th><%= t_m 'Color.name' -%></th>
+    <th><%= t_m 'Color.code' -%></th>
+    <th><%= t_m 'Color.code' -%></th>
+    <th><%= t_m 'Color.t' -%></th>
+    <th><%= t_m 'Color.created_at' -%></th>
+    <th><%= t_m 'Color.updated_at' -%></th>
+  </tr>
+
+<% @colors.each do |c| %>
+  <tr>
+    <td><%= c.id %></td>
+    <td><%= h c.name %></td>
+    <td><%= c.code %></td>
+    <td style="background-color: #<%= format("%06x", c.code) -%>;"></td>
+    <td><%= c.t %></td>
+    <td><%= l c.created_at %></td>
+    <td><%= l c.updated_at %></td>
+  </tr>
+<% end -%>
+</table>
index a3ff970..1950604 100644 (file)
@@ -18,7 +18,7 @@
       
       </div>
     <% when 'PanelColor' %>
-      <div id="panel-color<%= elm.id -%>" class="pettanr-comic-panel-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%x", elm.code) -%>;">
+      <div id="panel-color<%= elm.id -%>" class="pettanr-comic-panel-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%06x", elm.code) -%>;">
       
       </div>
     <% when 'GroundPicture' %>
diff --git a/app/views/speech_balloon_templates/_form.html.erb b/app/views/speech_balloon_templates/_form.html.erb
deleted file mode 100644 (file)
index cfe0195..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<%= form_for(@speech_balloon_template) do |f| %>
-  <% if @speech_balloon_template.errors.any? %>
-    <div id="error_explanation">
-      <h2><%= pluralize(@speech_balloon_template.errors.count, "error") %> prohibited this speech_balloon_template from being saved:</h2>
-
-      <ul>
-      <% @speech_balloon_template.errors.full_messages.each do |msg| %>
-        <li><%= msg %></li>
-      <% end %>
-      </ul>
-    </div>
-  <% end %>
-
-  <div class="actions">
-    <%= f.submit %>
-  </div>
-<% end %>
index d447525..8fb2bf1 100644 (file)
@@ -1,28 +1,44 @@
+<h1><%= t '.title' -%></h1>
 <p id="notice"><%= notice %></p>
 
 <p>
-  <b>Name:</b>
+  <b><%= t_m 'SpeechBalloonTemplate.id' -%>:</b>
+  <%= h @speech_balloon_template.id %>
+</p>
+
+<p>
+  <b><%= t_m 'SpeechBalloonTemplate.name' -%>:</b>
   <%= h @speech_balloon_template.name %>
 </p>
 
 <p>
-  <b>classname:</b>
+  <b><%= t_m 'SpeechBalloonTemplate.classname' -%>:</b>
   <%= h @speech_balloon_template.classname %>
 </p>
 
 <p>
-  <b>caption:</b>
+  <b><%= t_m 'SpeechBalloonTemplate.caption' -%>:</b>
   <%= h @speech_balloon_template.caption %>
 </p>
 
 <p>
-  <b>t:</b>
+  <b><%= t_m 'SpeechBalloonTemplate.t' -%>:</b>
   <%= @speech_balloon_template.t %>
 </p>
 
 <p>
-  <b>settings:</b>
+  <b><%= t_m 'SpeechBalloonTemplate.settings' -%>:</b>
   <%= h @speech_balloon_template.settings %>
 </p>
 
-<%= link_to 'Back', :action => :list %>
+<p>
+  <b><%= t_m 'SpeechBalloonTemplate.created_at' -%>:</b>
+  <%= l @speech_balloon_template.created_at %>
+</p>
+
+<p>
+  <b><%= t_m 'SpeechBalloonTemplate.updated_at' -%>:</b>
+  <%= l @speech_balloon_template.updated_at %>
+</p>
+
+<%= link_to t('link.back'), :action => :list %>
index 148dee0..70af039 100644 (file)
@@ -1,12 +1,13 @@
-<h1>Listing speach balloon template</h1>
+<h1><%= t '.title' -%></h1>
+
 <table>
   <tr>
-    <th>Name</th>
+    <th><%= t_m 'SpeechBalloonTemplate.caption' -%></th>
   </tr>
 
-<% @speech_balloon_templates.each do |st| %>
-  <tr>
-    <td><%= h st.caption %></td>
-  </tr>
-<% end %>
+  <% @speech_balloon_templates.each do |st| %>
+    <tr>
+      <td><%= link_to h(st.caption), speech_balloon_template_path(st) %></td>
+    </tr>
+  <% end %>
 </table>
index 175673d..07c9800 100644 (file)
@@ -1,28 +1,40 @@
-<h1>Listing speech_balloon_templates</h1>
-<table>
-  <tr>
-    <th>id</th>
-    <th>Name</th>
-    <th>classname</th>
-    <th>caption</th>
-    <th>t</th>
-    <th>created_at</th>
-    <th>updated_at</th>
-    <th></th>
-  </tr>
+<h1><%= t '.title' -%></h1>
 
-<% @speech_balloon_templates.each do |speech_balloon_template| %>
+<table>
   <tr>
-    <td><%= link_to speech_balloon_template.id, :action => :browse, :id => speech_balloon_template.id %></td>
-    <td><%= h speech_balloon_template.name %></td>
-    <td><%= h speech_balloon_template.classname %></td>
-    <td><%= h speech_balloon_template.caption %></td>
-    <td><%= speech_balloon_template.t %></td>
-    <td><%= speech_balloon_template.created_at %></td>
-    <td><%= speech_balloon_template.updated_at %></td>
-    <td>
-      <%= link_to 'Destroy', speech_balloon_template, confirm: 'Are you sure?', method: :delete %>
-    </td>
+    <th><%= t_m 'SpeechBalloonTemplate.id' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.name' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.classname' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.caption' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.t' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.settings' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.created_at' -%></th>
+    <th><%= t_m 'SpeechBalloonTemplate.updated_at' -%></th>
   </tr>
-<% end %>
+  <% @speech_balloon_templates.each do |speech_balloon_template| %>
+    <tr>
+      <td><%= link_to speech_balloon_template.id, browse_speech_balloon_template_path(speech_balloon_template) %></td>
+      <td>
+        <%= h(truncate(speech_balloon_template.name, :length => 16)) %>
+      </td>
+      <td>
+        <%= h(truncate(speech_balloon_template.classname, :length => 16)) %>
+      </td>
+      <td>
+        <%= h(truncate(speech_balloon_template.caption, :length => 16)) %>
+      </td>
+      <td>
+        <%= speech_balloon_template.t %>
+      </td>
+      <td>
+        <%= h(truncate(speech_balloon_template.settings, :length => 10)) %>
+      </td>
+      <td>
+        <%= l speech_balloon_template.created_at %>
+      </td>
+      <td>
+        <%= l speech_balloon_template.updated_at %>
+      </td>
+    </tr>
+  <% end -%>
 </table>
index 180db12..ee2bc5b 100644 (file)
@@ -1,28 +1,9 @@
+<h1><%= t '.title' -%></h1>
 <p id="notice"><%= notice %></p>
 
 <p>
-  <b>Name:</b>
-  <%= h @speech_balloon_template.name %>
-</p>
-
-<p>
-  <b>classname:</b>
-  <%= h @speech_balloon_template.classname %>
-</p>
-
-<p>
   <b>caption:</b>
   <%= h @speech_balloon_template.caption %>
 </p>
 
-<p>
-  <b>t:</b>
-  <%= @speech_balloon_template.t %>
-</p>
-
-<p>
-  <b>settings:</b>
-  <%= h @speech_balloon_template.settings %>
-</p>
-
-<%= link_to 'Back', speech_balloon_templates_path %>
+<%= link_to t('link.back'), speech_balloon_templates_path %>
index e857e0d..14b470a 100644 (file)
       <%= link_to 'system_pictures', :controller => 'system_pictures', :action => :list %>
     </td>
   </tr>
+  <tr>
+    <td>
+      <%= link_to 'colors', :controller => 'colors', :action => :list %>
+    </td>
+  </tr>
 </table>
 </div>
index 8954245..f3db818 100644 (file)
@@ -1,40 +1,45 @@
+<h1><%= t '.title' -%></h1>
 <p id="notice"><%= notice %></p>
 
+<%= link_to tag(:img, :src => @system_picture.url), @system_picture.url %>
 <p>
-  <b>Ext:</b>
+  <b><%= t_m 'SystemPicture.id' -%>:</b>
+  <%= @system_picture.id %>
+</p>
+
+<p>
+  <b><%= t_m 'SystemPicture.ext' -%>:</b>
   <%= @system_picture.ext %>
 </p>
 
 <p>
-  <b>Width:</b>
+  <b><%= t_m 'SystemPicture.width' -%>:</b>
   <%= @system_picture.width %>
 </p>
 
 <p>
-  <b>Height:</b>
+  <b><%= t_m 'SystemPicture.height' -%>:</b>
   <%= @system_picture.height %>
 </p>
 
 <p>
-  <b>filesize:</b>
+  <b><%= t_m 'SystemPicture.filesize' -%>:</b>
   <%= @system_picture.filesize %>
 </p>
 
-<img src="<%= @system_picture.url -%>">
+<p>
+  <b><%= t_m 'SystemPicture.md5' -%>:</b>
+  <%= @system_picture.md5 %>
+</p>
 
 <p>
-<a href="<%= @system_picture.url %>">browse picture</a> 
+  <b><%= t_m 'SystemPicture.created_at' -%>:</b>
+  <%= @system_picture.created_at %>
 </p>
-<% if admin_signed_in? -%>
+
 <p>
-Replace picture
+  <b><%= t_m 'SystemPicture.updated_at' -%>:</b>
+  <%= @system_picture.updated_at %>
 </p>
-  <%= form_for(@system_picture, :html => { :multipart => true }) do |f| %>
-    <label for="file">File to Upload</label> <%= f.file_field "file" %>
-    <div class="actions">
-      <%= f.submit 'replace' %>
-    </div>
-  <% end %>
-<% end -%>
 
-<%= link_to 'Back', :action => :list %>
+<%= link_to t('link.back'), :action => :list %>
index e65bf4c..450992c 100644 (file)
@@ -1,33 +1,19 @@
-<h1>Listing system_pictures</h1>
-
-<% if admin_signed_in? -%>
-  <%= form_tag( {:action => "create"} , { :multipart => true }) do %>
-    <label for="file">File to Upload</label> <%= file_field_tag "system_picture[file]" %>
-    <%= submit_tag 'upload' -%>
-  <% end -%>
-<% end -%>
+<h1><%= t '.title' -%></h1>
 
 <table>
   <tr>
-    <th>Ext</th>
-    <th>Width</th>
-    <th>Height</th>
-    <th>filesize</th>
     <th></th>
+    <th><%= t_m 'SystemPicture.ext' -%></th>
+    <th><%= t_m 'SystemPicture.width' -%>x<%= t_m 'SystemPicture.height' -%></th>
+    <th><%= t_m 'SystemPicture.filesize' -%></th>
   </tr>
 
 <% @system_pictures.each do |system_picture| %>
   <tr>
-    <td><%= system_picture.ext %></td>
-    <td><%= system_picture.width %></td>
-    <td><%= system_picture.height %></td>
+    <td><%= link_to tag(:img, :src => system_picture.url), system_picture.url %>(<%= link_to system_picture.id, system_picture_path(system_picture) %>)</td>
+    <td><%= h system_picture.ext %></td>
+    <td><%= system_picture.width %>x<%= system_picture.height %></td>
     <td><%= system_picture.filesize %></td>
-    <td><%= link_to 'Show', system_picture %></td>
-    <td>
-      <% if admin_signed_in? -%>
-        <%= link_to 'Destroy', system_picture, confirm: 'Are you sure?', method: :delete %>
-      <% end -%>
-    </td>
   </tr>
 <% end %>
 </table>
index 42eaf5d..f9d8877 100644 (file)
@@ -1,34 +1,29 @@
-<h1>Listing system_pictures</h1>
-
-<%= form_tag( {:action => "create"} , { :multipart => true }) do %>
-  <label for="file">File to Upload</label> <%= file_field_tag "system_picture[file]" %>
-  <%= submit_tag 'upload' -%>
-<% end -%>
+<h1><%= t '.title' -%></h1>
 
 <table>
   <tr>
-    <th>id</th>
-    <th>Ext</th>
-    <th>Width</th>
-    <th>Height</th>
-    <th>filesize</th>
-    <th>created_at</th>
-    <th>updated_at</th>
     <th></th>
+    <th><%= t_m 'SystemPicture.id' -%></th>
+    <th><%= t_m 'SystemPicture.ext' -%></th>
+    <th><%= t_m 'SystemPicture.width' -%></th>
+    <th><%= t_m 'SystemPicture.height' -%></th>
+    <th><%= t_m 'SystemPicture.filesize' -%></th>
+    <th><%= t_m 'SystemPicture.md5' -%></th>
+    <th><%= t_m 'SystemPicture.created_at' -%></th>
+    <th><%= t_m 'SystemPicture.updated_at' -%></th>
   </tr>
 
 <% @system_pictures.each do |system_picture| %>
   <tr>
-    <td><%= link_to system_picture.id, :action => :browse, :id => system_picture.id %></td>
-    <td><%= system_picture.ext %></td>
+    <td><%= link_to tag(:img, :src => system_picture.url), system_picture.url %></td>
+    <td><%= link_to system_picture.id, browse_system_picture_path(system_picture) %></td>
+    <td><%= h system_picture.ext %></td>
     <td><%= system_picture.width %></td>
     <td><%= system_picture.height %></td>
     <td><%= system_picture.filesize %></td>
-    <td><%= system_picture.created_at %></td>
-    <td><%= system_picture.updated_at %></td>
-    <td>
-      <%= link_to 'Destroy', system_picture, confirm: 'Are you sure?', method: :delete %>
-    </td>
+    <td><%= h system_picture.md5 %></td>
+    <td><%= l system_picture.created_at %></td>
+    <td><%= l system_picture.updated_at %></td>
   </tr>
 <% end %>
 </table>
diff --git a/app/views/system_pictures/new.html.erb b/app/views/system_pictures/new.html.erb
deleted file mode 100644 (file)
index d4c99f6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<%= form_tag( {:controller => 'system_pictures',:action => "create"} , { :multipart => true }) do %>
-  <label for="file">File to Upload</label> <%= file_field_tag "system_picture[file]" %>
-  <%= submit_tag 'upload' -%>
-<% end -%>
index 1339953..46bf773 100644 (file)
@@ -1,40 +1,41 @@
+<h1><%= t '.title' -%></h1>
 <p id="notice"><%= notice %></p>
 
+<%= link_to tag(:img, :src => @system_picture.url), @system_picture.url %>
+
 <p>
-  <b>Ext:</b>
+  <b><%= t_m 'SystemPicture.ext' -%>:</b>
   <%= @system_picture.ext %>
 </p>
 
 <p>
-  <b>Width:</b>
+  <b><%= t_m 'SystemPicture.width' -%>:</b>
   <%= @system_picture.width %>
 </p>
 
 <p>
-  <b>Height:</b>
+  <b><%= t_m 'SystemPicture.height' -%>:</b>
   <%= @system_picture.height %>
 </p>
 
 <p>
-  <b>filesize:</b>
+  <b><%= t_m 'SystemPicture.filesize' -%>:</b>
   <%= @system_picture.filesize %>
 </p>
 
-<img src="<%= @system_picture.url -%>">
+<p>
+  <b><%= t_m 'SystemPicture.md5' -%>:</b>
+  <%= h @system_picture.md5 %>
+</p>
 
 <p>
-<a href="<%= @system_picture.url %>">browse picture</a> 
+  <b><%= t_m 'SystemPicture.created_at' -%>:</b>
+  <%= l @system_picture.created_at %>
 </p>
-<% if admin_signed_in? -%>
+
 <p>
-Replace picture
+  <b><%= t_m 'SystemPicture.updated_at' -%>:</b>
+  <%= l @system_picture.updated_at %>
 </p>
-  <%= form_for(@system_picture, :html => { :multipart => true }) do |f| %>
-    <label for="file">File to Upload</label> <%= f.file_field "file" %>
-    <div class="actions">
-      <%= f.submit 'replace' %>
-    </div>
-  <% end %>
-<% end -%>
-
-<%= link_to 'Back', system_pictures_path %>
+
+<%= link_to t('link.back'), system_pictures_path %>
index 1819a92..bfa8245 100644 (file)
@@ -40,9 +40,9 @@ Pettanr::Application.routes.draw do
       get :index
       get :show
       get :list
-      get :browse
     end
     member do
+      get :browse
       delete :destroy
     end
   end
@@ -132,6 +132,7 @@ Pettanr::Application.routes.draw do
   resources :colors do
     collection do
       get :index
+      get :list
     end
     member do
     end
@@ -227,12 +228,10 @@ Pettanr::Application.routes.draw do
     collection do
       get :index
       get :show
-      post :create
       get :list
-      get :browse
     end
     member do
-      put :update
+      get :browse
       delete :destroy
     end
   end