From 37edcf3463bb90adaa568b39b55aecdcd8b2aef2 Mon Sep 17 00:00:00 2001 From: yasushiito Date: Thu, 22 Nov 2012 08:27:38 +0900 Subject: [PATCH] t#30102#30122:update i18n index --- app/controllers/stories_controller.rb | 11 ++++ app/models/story.rb | 29 ++++++++++ app/views/comics/top.html.erb | 76 ++++++++++++++++++++++++ app/views/home/ground_color.html.erb | 21 +++---- app/views/home/index.html.erb | 62 +++++++++++++++++--- app/views/layouts/test.html.erb | 105 ++++++++++++++++++---------------- app/views/stories/show.html.erb | 2 +- config/locales/pettanr.ja.yml | 32 +++++++++-- config/routes.rb | 13 ++++- 9 files changed, 274 insertions(+), 77 deletions(-) diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index bcb470ee..9e30edab 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -7,6 +7,17 @@ class StoriesController < ApplicationController 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) diff --git a/app/models/story.rb b/app/models/story.rb index 3a7f329d..6549cfae 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -93,6 +93,35 @@ class Story < ActiveRecord::Base }} 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) diff --git a/app/views/comics/top.html.erb b/app/views/comics/top.html.erb index e69de29b..e23a5441 100644 --- a/app/views/comics/top.html.erb +++ b/app/views/comics/top.html.erb @@ -0,0 +1,76 @@ +

<%= t '.title' -%>

+ +

<%= t('comics.top.user_resources') -%>

+ + + + + + + + + + + + + +
+ <%= link_to t_m('Comic'), main_app.comics_path %> + + <%= link_to t_m('Story'), main_app.stories_path %> + + <%= link_to t_m('Panel'), main_app.panels_path %> + + <%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %> +
+ <%= link_to t_m('PanelPicture'), main_app.panel_pictures_path %> + + <%= link_to t_m('GroundPicture'), main_app.ground_pictures_path %> + + <%= link_to t_m('GroundColor'), main_app.ground_colors_path %> + + <%= link_to t_m('PanelColor'), main_app.panel_colors_path %> +
+

<%= t('comics.top.human_resources') -%>

+ + + + + + + +
+ <%= link_to t_m('Author'), main_app.authors_path %> + + <%= link_to t_m('Artist'), main_app.artists_path %> + + +
+

<%= t('comics.top.system_resources') -%>

+ + + + + + + + + + + + + +
+ <%= link_to t_m('SpeechBalloonTemplate'), main_app.speech_balloon_templates_path %> + + <%= link_to t_m('LicenseGroup'), main_app.license_groups_path %> + + <%= link_to t_m('License'), main_app.licenses_path %> + + <%= link_to t_m('Color'), main_app.colors_path %> +
+ <%= link_to t_m('SystemPicture'), main_app.system_pictures_path %> + + + +
diff --git a/app/views/home/ground_color.html.erb b/app/views/home/ground_color.html.erb index fed3158d..962807e0 100644 --- a/app/views/home/ground_color.html.erb +++ b/app/views/home/ground_color.html.erb @@ -1,19 +1,14 @@ -

Listing Ground Colors

+

<%= t '.title' -%>

- - - - + + + + -<% @ground_colors.each do |gc| %> - - - - - - -<% end -%> + <% @ground_colors.each do |gc| %> + <%= render 'ground_colors/list_item', :ground_color => gc, :author => @author %> + <% end -%>
idpanel_idcolor_idz<%= t_m 'GroundColor.color_id' -%><%= t_m 'GroundColor.panel_id' -%><%= t_m 'GroundColor.z' -%><%= t_m 'GroundColor.updated_at' -%>
<%= gc.id %><%= link_to gc.panel_id, panel_path(gc.panel_id) %><%= link_to gc.color_id, color_path(gc.color_id) %><%= gc.z %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 26ddf739..bff696c7 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,12 +1,58 @@ -

<%= h(@author.name) -%>(<%= h(@user.email) -%>)

+

<%= t '.title' -%>

-
-

絵師活動

+

<%= link_to h(@author.name), main_app.author_path(@author) -%>

+

<%= t('.updated_comic') -%>

+ + + + + + + +
+ <%= link_to t_m('Comic'), '/home/comic' %> + + <%= link_to t_m('Story'), '/home/story' %> + + <%= link_to t_m('Panel'), '/home/panel' %> + +
+

<%= t('.used_element') -%>

+ + + + + + + +
+ <%= link_to t_m('PanelPicture'), '/home/panel_picture' %> + + <%= link_to t_m('GroundPicture'), '/home/ground_picture' %> + + <%= link_to t_m('GroundColor'), '/home/ground_color' %> + + <%= link_to t_m('PanelColor'), '/home/panel_color' %> +
<% if @author.artist? -%> - <%= link_to h(@author.artist.name), @author.artist %>です +

<%= link_to h(@artist.name), main_app.artist_path(@artist) -%>

+

<%= t('.updated_picture') -%>

+ + + + + + + +
+ <%= link_to t_m('OriginalPicture'), main_app.original_pictures_path %> + + <%= %> + + <%= %> + + <%= %> +
<% else -%> -

まだ絵師登録していません。

-

登録する

- <%= render 'original_pictures/artist_register' %> +

<%= t('artist.noregister') -%>

<% end -%> -
diff --git a/app/views/layouts/test.html.erb b/app/views/layouts/test.html.erb index 48ca2deb..6f902e33 100644 --- a/app/views/layouts/test.html.erb +++ b/app/views/layouts/test.html.erb @@ -8,60 +8,65 @@ -
-<% if user_signed_in? %> - <%= link_to t('home.index.title'), '/home' %> - <%= link_to t('home.comic.title'), '/home/comic' %> - <%= link_to t('home.panel.title'), '/home/panel' %> - <%= link_to t('home.panel_picture.title'), '/home/panel_picture' %> - <%= link_to h(truncate(@author.name, :length => 12)), main_app.author_path(@author) %> - <% if @artist %> - <%= link_to t('home.picture.title'), main_app.original_pictures_path %> - <%= link_to h(truncate(@artist.name, :length => 12)), main_app.artist_path(@artist) %> - <% end %> - <%= link_to t('home.configure.title'), '/home/configure' %> - <%= link_to t('home.sign_out.title'), main_app.destroy_user_session_path, :method => :delete %> -<% else %> - <%= link_to "sign in", main_app.new_user_session_path %> -<% end %> -
-
-<% if admin_signed_in? %> - <%= link_to "system", '/system' %> - <%= link_to "browse", '/system/browse' %> - <%= link_to "approve", '/system/waiting_list' %> - <%= link_to "token", '/system/auth_token' %> - layout: - <%= link_to "test", '/system/test_layout' %> - <%= link_to "production", '/system/production_layout' %> - <%= link_to "sign out", main_app.destroy_admin_session_path, :method => :delete %> -<% else %> - <%= link_to "sign in", main_app.new_admin_session_path %> -<% end %> +
+ + + + + + +
+

PettanR

+
+
+ <%= link_to h(truncate(@author.name, :length => 12)), main_app.author_path(@author) %> +
+
+ <% if @artist %> + <%= link_to h(truncate(@artist.name, :length => 12)), main_app.artist_path(@artist) %> + <% end %> +
+
+ <%= link_to t('home.configure.title'), '/home/configure' %> + <%= link_to t('home.sign_out.title'), main_app.destroy_user_session_path, :method => :delete %> +
-
-user.resources -<%= link_to t_m('Comic'), main_app.comics_path %> -<%= link_to t_m('Story'), main_app.new_story_path %> -<%= link_to t_m('Panel'), main_app.panels_path %> -<%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %> -<%= link_to t_m('PanelPicture'), main_app.panel_pictures_path %> -<%= link_to t_m('GroundPicture'), main_app.ground_pictures_path %> -<%= link_to t_m('GroundColor'), main_app.ground_colors_path %> -<%= link_to t_m('PanelColor'), main_app.panel_colors_path %> - : -<%= link_to t_m('Author'), main_app.authors_path %> -<%= link_to t_m('Artist'), main_app.artists_path %> +
+ <%= link_to t('tab.reader.title'), '/' %> + <%= link_to t_m('Comic'), main_app.comics_path %> + <%= link_to t_m('Panel'), main_app.panels_path %> + <%= link_to t_m('ResourcePicture'), main_app.resource_pictures_path %> + : + <%= link_to t_m('Author'), main_app.authors_path %> + <%= link_to t_m('Artist'), main_app.artists_path %>
-
-system.resources -<%= link_to 'speech_balloon_templates', main_app.speech_balloon_templates_path %> -<%= link_to 'license_groups', main_app.license_groups_path %> -<%= link_to 'licenses', main_app.licenses_path %> -<%= link_to 'colors', main_app.colors_path %> -<%= link_to 'system_pictures', main_app.system_pictures_path %> +
+ <% if user_signed_in? %> + <%= link_to t('tab.creator.home'), '/home' %> + <%= link_to t('tab.creator.comic'), '/home/comic' %> + <%= link_to t('tab.creator.panel'), '/home/panel' %> + <% if @artist %> + <%= link_to t('tab.creator.picture'), main_app.original_pictures_path %> + <% end %> + <% else %> + <%= link_to "sign in", main_app.new_user_session_path %> + <% end %>
<%= yield %> +
+ <% if admin_signed_in? %> + <%= link_to t('tab.system.title'), '/system' %> + <%= link_to "browse", '/system/browse' %> + <%= link_to "approve", '/system/waiting_list' %> + <%= link_to "token", '/system/auth_token' %> + layout: + <%= link_to "test", '/system/test_layout' %> + <%= link_to "production", '/system/production_layout' %> + <%= link_to "sign out", main_app.destroy_admin_session_path, :method => :delete %> + <% else %> + <%= link_to "sign in", main_app.new_admin_session_path %> + <% end %> +
<%= javascript_tag 'var server_result=' + @server_result.to_json + ';' %> diff --git a/app/views/stories/show.html.erb b/app/views/stories/show.html.erb index 0122e4a9..16cc6dd6 100644 --- a/app/views/stories/show.html.erb +++ b/app/views/stories/show.html.erb @@ -1,4 +1,4 @@ - <%= render 'panels/standard', :panel => @story.panel %> + <%= render 'panels/standard', :panel => @story.panel, :author => @author %> <% if @story.author.id == @author.id -%> t:<%= @story.t %> diff --git a/config/locales/pettanr.ja.yml b/config/locales/pettanr.ja.yml index 3d34116e..fbe5e532 100644 --- a/config/locales/pettanr.ja.yml +++ b/config/locales/pettanr.ja.yml @@ -216,14 +216,23 @@ ja: home: index: title: ホーム + updated_comic: 最近更新した漫画 + used_element: 最近使った部品 + updated_picture: 最近更新した画像 comic: - title: コミック + title: 最近更新したコミック panel: - title: コマ + title: 最近更新したコマ picture: - title: 原画 + title: 最近更新した原画 panel_picture: - title: コマ絵 + title: 最近使ったコマ絵 + ground_picture: + title: 最近使った絵地 + ground_color: + title: 最近選択した色地 + panel_color: + title: 最近指定した色地 configure: title: 設定 sign_out: @@ -242,6 +251,11 @@ ja: title: コミック 生一覧 browse: title: コミック 生単票 + top: + title: 読む・探す + user_resources: 発表作品から + human_resources: 人物から + system_resources: システムリソースから stories: index: title: ストーリー一覧 @@ -445,3 +459,13 @@ ja: destroy: 削除 back: 戻る marker: ■ + tab: + creator: + home: 作る・見せる + comic: コミック + panel: コマ + picture: 原画 + reader: + title: 読む・探す + system: + title: 管理者メンテナンス diff --git a/config/routes.rb b/config/routes.rb index 67008d26..400f71b7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,6 +48,8 @@ Pettanr::Application.routes.draw do end resources :speeches do collection do + get :index + get :show get :list end member do @@ -56,6 +58,8 @@ Pettanr::Application.routes.draw do end resources :balloons do collection do + get :index + get :show get :list end member do @@ -64,6 +68,8 @@ Pettanr::Application.routes.draw do end resources :speech_balloons do collection do + get :index + get :show get :list end member do @@ -95,8 +101,8 @@ Pettanr::Application.routes.draw do resources :resource_pictures do collection do get :index - get :new get :show + get :new post :create get :count get :list @@ -136,6 +142,7 @@ Pettanr::Application.routes.draw do resources :colors do collection do get :index + get :show get :list end member do @@ -145,6 +152,7 @@ Pettanr::Application.routes.draw do resources :panel_colors do collection do get :index + get :show end member do get :browse @@ -153,6 +161,7 @@ Pettanr::Application.routes.draw do resources :ground_colors do collection do get :index + get :show end member do get :browse @@ -161,6 +170,7 @@ Pettanr::Application.routes.draw do resources :ground_pictures do collection do get :index + get :show end member do get :browse @@ -188,6 +198,7 @@ Pettanr::Application.routes.draw do get :new end collection do + get :index get :show post :create get :list -- 2.11.0