OSDN Git Service

t#30102#30122:update i18n index
authoryasushiito <yas@pen-chan.jp>
Wed, 21 Nov 2012 23:27:38 +0000 (08:27 +0900)
committeryasushiito <yas@pen-chan.jp>
Wed, 21 Nov 2012 23:27:38 +0000 (08:27 +0900)
app/controllers/stories_controller.rb
app/models/story.rb
app/views/comics/top.html.erb
app/views/home/ground_color.html.erb
app/views/home/index.html.erb
app/views/layouts/test.html.erb
app/views/stories/show.html.erb
config/locales/pettanr.ja.yml
config/routes.rb

index bcb470e..9e30eda 100644 (file)
@@ -7,6 +7,17 @@ class StoriesController < ApplicationController
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
+  def index
+    @page = Story.page params[:page]
+    @page_size = Story.page_size params[:page_size]
+    @stories = Story.list(@page, @page_size)
+
+    respond_to do |format|
+      format.html # index.html.erb
+      format.json { render :json => @stories.to_json(Story.list_json_opt) }
+    end
+  end
+
   def show
     @story = Story.show(params[:id], @author)
 
   def show
     @story = Story.show(params[:id], @author)
 
index 3a7f329..6549cfa 100644 (file)
@@ -93,6 +93,35 @@ class Story < ActiveRecord::Base
     }}
   end
   
     }}
   end
   
+  def self.default_page_size
+    25
+  end
+  
+  def self.max_page_size
+    100
+  end
+  
+  def self.page prm = nil
+    page = prm.to_i
+    page = 1 if page < 1
+    page
+  end
+  
+  def self.page_size prm = self.default_page_size
+    page_size = prm.to_i
+    page_size = self.max_page_size if page_size > self.max_page_size
+    page_size = self.default_page_size if page_size < 1
+    page_size
+  end
+  
+  def self.list page = 1, page_size = self.default_page_size
+    opt = {}
+    opt.merge!(self.list_opt)
+    opt.merge!({:limit => page_size, :offset => (page -1) * page_size}) if page_size > 0
+    opt.merge!({:order => 'updated_at desc'})
+    Story.find(:all, opt)
+  end
+  
   def self.mylist au, page = 1, page_size = Author.default_story_page_size
     opt = {}
     opt.merge!(Story.list_opt)
   def self.mylist au, page = 1, page_size = Author.default_story_page_size
     opt = {}
     opt.merge!(Story.list_opt)
index e69de29..e23a544 100644 (file)
@@ -0,0 +1,76 @@
+<h1><%= t '.title' -%></h1>\r
+\r
+<h2><%= t('comics.top.user_resources') -%></h2>\r
+<table>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Comic'), main_app.comics_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Story'), main_app.stories_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Panel'), main_app.panels_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %>\r
+    </td>\r
+  </tr>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('PanelPicture'), main_app.panel_pictures_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('GroundPicture'), main_app.ground_pictures_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('GroundColor'), main_app.ground_colors_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('PanelColor'), main_app.panel_colors_path %>\r
+    </td>\r
+  </tr>\r
+</table>\r
+<h2><%= t('comics.top.human_resources') -%></h2>\r
+<table>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Author'), main_app.authors_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Artist'), main_app.artists_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+  </tr>\r
+</table>\r
+<h2><%= t('comics.top.system_resources') -%></h2>\r
+<table>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('SpeechBalloonTemplate'), main_app.speech_balloon_templates_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('LicenseGroup'), main_app.license_groups_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('License'), main_app.licenses_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('Color'), main_app.colors_path %>\r
+    </td>\r
+  </tr>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('SystemPicture'), main_app.system_pictures_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+  </tr>\r
+</table>\r
index fed3158..962807e 100644 (file)
@@ -1,19 +1,14 @@
-<h1>Listing Ground Colors</h1>
+<h1><%= t '.title' -%></h1>
 
 <table>
   <tr>
 
 <table>
   <tr>
-    <th>id</th>
-    <th>panel_id</th>
-    <th>color_id</th>
-    <th>z</th>
+    <th><%= t_m 'GroundColor.color_id' -%></th>
+    <th><%= t_m 'GroundColor.panel_id' -%></th>
+    <th><%= t_m 'GroundColor.z' -%></th>
+    <th><%= t_m 'GroundColor.updated_at' -%></th>
   </tr>
 
   </tr>
 
-<% @ground_colors.each do |gc| %>
-  <tr>
-    <td><%= gc.id %></td>
-    <td><%= link_to gc.panel_id, panel_path(gc.panel_id) %></td>
-    <td><%= link_to gc.color_id, color_path(gc.color_id) %></td>
-    <td><%= gc.z %></td>
-  </tr>
-<% end -%>
+  <% @ground_colors.each do |gc| %>
+    <%= render 'ground_colors/list_item', :ground_color => gc, :author => @author %>
+  <% end -%>
 </table>
 </table>
index 26ddf73..bff696c 100644 (file)
@@ -1,12 +1,58 @@
-<h1><%= h(@author.name) -%>(<%= h(@user.email) -%>)</h1>
+<h1><%= t '.title' -%></h1>
 
 
-<div>
-<p>絵師活動</p>
+<h2><%= link_to h(@author.name), main_app.author_path(@author) -%></h2>
+<h3><%= t('.updated_comic') -%></h3>
+<table>
+  <tr height="100px">
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('Comic'), '/home/comic' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('Story'), '/home/story' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('Panel'), '/home/panel' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+    </td>
+  </tr>
+</table>
+<h3><%= t('.used_element') -%></h3>
+<table>
+  <tr height="100px">
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('PanelPicture'), '/home/panel_picture' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('GroundPicture'), '/home/ground_picture' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('GroundColor'), '/home/ground_color' %>
+    </td>
+    <td width="200px" align="center" valign="middle">
+      <%= link_to t_m('PanelColor'), '/home/panel_color' %>
+    </td>
+  </tr>
+</table>
 <% if @author.artist? -%>
 <% if @author.artist? -%>
-  <%= link_to h(@author.artist.name), @author.artist %>です
+  <h2><%= link_to h(@artist.name), main_app.artist_path(@artist) -%></h2>
+  <h3><%= t('.updated_picture') -%></h3>
+  <table>
+    <tr height="100px">
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('OriginalPicture'), main_app.original_pictures_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%=  %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%=  %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%=  %>
+      </td>
+    </tr>
+  </table>
 <% else -%>
 <% else -%>
-  <p>まだ絵師登録していません。</p>
-  <p>登録する</p>
-    <%= render 'original_pictures/artist_register' %>
+  <h2><%= t('artist.noregister') -%></h2>
 <% end -%>
 <% end -%>
-</div>
index 48ca2de..6f902e3 100644 (file)
@@ -8,60 +8,65 @@
 </head>\r
 <body>\r
 \r
 </head>\r
 <body>\r
 \r
-<div>\r
-<% if user_signed_in? %>\r
-  <%= link_to t('home.index.title'), '/home' %>\r
-  <%= link_to t('home.comic.title'), '/home/comic' %>\r
-  <%= link_to t('home.panel.title'), '/home/panel' %>\r
-  <%= link_to t('home.panel_picture.title'), '/home/panel_picture' %>\r
-  <%= link_to h(truncate(@author.name, :length => 12)), main_app.author_path(@author) %>\r
-  <% if @artist %>\r
-    <%= link_to t('home.picture.title'), main_app.original_pictures_path %>\r
-    <%= link_to h(truncate(@artist.name, :length => 12)), main_app.artist_path(@artist) %>\r
-  <% end %>\r
-  <%= link_to t('home.configure.title'), '/home/configure' %>\r
-  <%= link_to t('home.sign_out.title'), main_app.destroy_user_session_path, :method => :delete %>\r
-<% else %>\r
-  <%= link_to "sign in", main_app.new_user_session_path %>\r
-<% end %>\r
-</div>\r
-<div>\r
-<% if admin_signed_in? %>\r
-  <%= link_to "system", '/system' %>\r
-  <%= link_to "browse", '/system/browse' %>\r
-  <%= link_to "approve", '/system/waiting_list' %>\r
-  <%= link_to "token", '/system/auth_token' %>\r
-  layout:\r
-  <%= link_to "test", '/system/test_layout' %>\r
-  <%= link_to "production", '/system/production_layout' %>\r
-  <%= link_to "sign out", main_app.destroy_admin_session_path, :method => :delete %>\r
-<% else %>\r
-  <%= link_to "sign in", main_app.new_admin_session_path %>\r
-<% end %>\r
+<div width="100%">\r
+<table class="no-border">\r
+  <tr>\r
+    <td width="80%">\r
+      <h3>PettanR</h3>\r
+    </td>\r
+    <td>\r
+      <div>\r
+        <%= link_to h(truncate(@author.name, :length => 12)), main_app.author_path(@author) %>\r
+      </div>\r
+      <div>\r
+        <% if @artist %>\r
+          <%= link_to h(truncate(@artist.name, :length => 12)), main_app.artist_path(@artist) %>\r
+        <% end %>\r
+      </div>\r
+    </td>\r
+    <td>\r
+      <%= link_to t('home.configure.title'), '/home/configure' %>\r
+      <%= link_to t('home.sign_out.title'), main_app.destroy_user_session_path, :method => :delete %>\r
+    </td>\r
+  </tr>\r
+</table>\r
 </div>\r
 </div>\r
-<div>\r
-user.resources\r
-<%= link_to t_m('Comic'), main_app.comics_path %>\r
-<%= link_to t_m('Story'), main_app.new_story_path %>\r
-<%= link_to t_m('Panel'), main_app.panels_path %>\r
-<%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %>\r
-<%= link_to t_m('PanelPicture'), main_app.panel_pictures_path %>\r
-<%= link_to t_m('GroundPicture'), main_app.ground_pictures_path %>\r
-<%= link_to t_m('GroundColor'), main_app.ground_colors_path %>\r
-<%= link_to t_m('PanelColor'), main_app.panel_colors_path %>\r
- : \r
-<%= link_to t_m('Author'), main_app.authors_path %>\r
-<%= link_to t_m('Artist'), main_app.artists_path %>\r
+<div width="100%" style="background-color: #ddfadd; padding: 5px;">\r
+  <%= link_to t('tab.reader.title'), '/' %>\r
+  <%= link_to t_m('Comic'), main_app.comics_path %>\r
+  <%= link_to t_m('Panel'), main_app.panels_path %>\r
+  <%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %>\r
+   : \r
+  <%= link_to t_m('Author'), main_app.authors_path %>\r
+  <%= link_to t_m('Artist'), main_app.artists_path %>\r
 </div>\r
 </div>\r
-<div>\r
-system.resources\r
-<%= link_to 'speech_balloon_templates', main_app.speech_balloon_templates_path %>\r
-<%= link_to 'license_groups', main_app.license_groups_path %>\r
-<%= link_to 'licenses', main_app.licenses_path %>\r
-<%= link_to 'colors', main_app.colors_path %>\r
-<%= link_to 'system_pictures', main_app.system_pictures_path %>\r
+<div width="100%" style="background-color: #fadddd; padding: 5px;">\r
+  <% if user_signed_in? %>\r
+    <%= link_to t('tab.creator.home'), '/home' %>\r
+    <%= link_to t('tab.creator.comic'), '/home/comic' %>\r
+    <%= link_to t('tab.creator.panel'), '/home/panel' %>\r
+    <% if @artist %>\r
+      <%= link_to t('tab.creator.picture'), main_app.original_pictures_path %>\r
+    <% end %>\r
+  <% else %>\r
+    <%= link_to "sign in", main_app.new_user_session_path %>\r
+  <% end %>\r
 </div>\r
 <%= yield %>\r
 </div>\r
 <%= yield %>\r
+<div width="100%" style="background-color: #ddddfa; padding: 5px;">\r
+  <% if admin_signed_in? %>\r
+    <%= link_to t('tab.system.title'), '/system' %>\r
+    <%= link_to "browse", '/system/browse' %>\r
+    <%= link_to "approve", '/system/waiting_list' %>\r
+    <%= link_to "token", '/system/auth_token' %>\r
+    layout:\r
+    <%= link_to "test", '/system/test_layout' %>\r
+    <%= link_to "production", '/system/production_layout' %>\r
+    <%= link_to "sign out", main_app.destroy_admin_session_path, :method => :delete %>\r
+  <% else %>\r
+    <%= link_to "sign in", main_app.new_admin_session_path %>\r
+  <% end %>\r
+</div>\r
 <%= javascript_tag 'var server_result=' + @server_result.to_json + ';' %>\r
 \r
 </body>\r
 <%= javascript_tag 'var server_result=' + @server_result.to_json + ';' %>\r
 \r
 </body>\r
index 0122e4a..16cc6dd 100644 (file)
@@ -1,4 +1,4 @@
-  <%= render 'panels/standard', :panel => @story.panel %>
+  <%= render 'panels/standard', :panel => @story.panel, :author => @author %>
   <% if @story.author.id == @author.id -%>
     <span>
     t:<%= @story.t %>
   <% if @story.author.id == @author.id -%>
     <span>
     t:<%= @story.t %>
index 3d34116..fbe5e53 100644 (file)
@@ -216,14 +216,23 @@ ja:
   home:
     index:
       title: ホーム
   home:
     index:
       title: ホーム
+      updated_comic: 最近更新した漫画
+      used_element: 最近使った部品
+      updated_picture: 最近更新した画像
     comic:
     comic:
-      title: コミック
+      title: 最近更新したコミック
     panel:
     panel:
-      title: コマ
+      title: 最近更新したコマ
     picture:
     picture:
-      title: 原画
+      title: 最近更新した原画
     panel_picture:
     panel_picture:
-      title: コマ絵
+      title: 最近使ったコマ絵
+    ground_picture:
+      title: 最近使った絵地
+    ground_color:
+      title: 最近選択した色地
+    panel_color:
+      title: 最近指定した色地
     configure:
       title: 設定
     sign_out:
     configure:
       title: 設定
     sign_out:
@@ -242,6 +251,11 @@ ja:
       title: コミック 生一覧
     browse:
       title: コミック 生単票
       title: コミック 生一覧
     browse:
       title: コミック 生単票
+    top:
+      title: 読む・探す
+      user_resources: 発表作品から
+      human_resources: 人物から
+      system_resources: システムリソースから
   stories:
     index:
       title: ストーリー一覧
   stories:
     index:
       title: ストーリー一覧
@@ -445,3 +459,13 @@ ja:
     destroy: 削除
     back: 戻る
     marker: ■
     destroy: 削除
     back: 戻る
     marker: ■
+  tab:
+    creator:
+      home: 作る・見せる
+      comic: コミック
+      panel: コマ
+      picture: 原画
+    reader:
+      title: 読む・探す
+    system:
+      title: 管理者メンテナンス
index 67008d2..400f71b 100644 (file)
@@ -48,6 +48,8 @@ Pettanr::Application.routes.draw do
   end
   resources :speeches do
     collection do
   end
   resources :speeches do
     collection do
+      get :index
+      get :show
       get :list
     end
     member do
       get :list
     end
     member do
@@ -56,6 +58,8 @@ Pettanr::Application.routes.draw do
   end
   resources :balloons do
     collection do
   end
   resources :balloons do
     collection do
+      get :index
+      get :show
       get :list
     end
     member do
       get :list
     end
     member do
@@ -64,6 +68,8 @@ Pettanr::Application.routes.draw do
   end
   resources :speech_balloons do
     collection do
   end
   resources :speech_balloons do
     collection do
+      get :index
+      get :show
       get :list
     end
     member do
       get :list
     end
     member do
@@ -95,8 +101,8 @@ Pettanr::Application.routes.draw do
   resources :resource_pictures do
     collection do
       get :index
   resources :resource_pictures do
     collection do
       get :index
-      get :new
       get :show
       get :show
+      get :new
       post :create
       get :count
       get :list
       post :create
       get :count
       get :list
@@ -136,6 +142,7 @@ Pettanr::Application.routes.draw do
   resources :colors do
     collection do
       get :index
   resources :colors do
     collection do
       get :index
+      get :show
       get :list
     end
     member do
       get :list
     end
     member do
@@ -145,6 +152,7 @@ Pettanr::Application.routes.draw do
   resources :panel_colors do
     collection do
       get :index
   resources :panel_colors do
     collection do
       get :index
+      get :show
     end
     member do
       get :browse
     end
     member do
       get :browse
@@ -153,6 +161,7 @@ Pettanr::Application.routes.draw do
   resources :ground_colors do
     collection do
       get :index
   resources :ground_colors do
     collection do
       get :index
+      get :show
     end
     member do
       get :browse
     end
     member do
       get :browse
@@ -161,6 +170,7 @@ Pettanr::Application.routes.draw do
   resources :ground_pictures do
     collection do
       get :index
   resources :ground_pictures do
     collection do
       get :index
+      get :show
     end
     member do
       get :browse
     end
     member do
       get :browse
@@ -188,6 +198,7 @@ Pettanr::Application.routes.draw do
       get :new
     end
     collection do
       get :new
     end
     collection do
+      get :index
       get :show
       post :create
       get :list
       get :show
       post :create
       get :list