OSDN Git Service

t30329#:i18n flash message
authoryasushiito <yas@pen-chan.jp>
Sat, 22 Dec 2012 05:43:26 +0000 (14:43 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 22 Dec 2012 05:43:26 +0000 (14:43 +0900)
26 files changed:
app/controllers/application_controller.rb
app/controllers/artists_controller.rb
app/controllers/authors_controller.rb
app/controllers/comics_controller.rb
app/controllers/demander_statuses_controller.rb
app/controllers/demanders_controller.rb
app/controllers/home_controller.rb
app/controllers/original_pictures_controller.rb
app/controllers/panels_controller.rb
app/controllers/provider_statuses_controller.rb
app/controllers/stories_controller.rb
app/controllers/system_controller.rb
app/models/story.rb
app/views/admins/registrations/new.html.erb
app/views/admins/sessions/new.html.erb
app/views/admins/shared/_links.erb
app/views/comics/top.html.erb
app/views/demand_users/registrations/new.html.erb
app/views/demand_users/sessions/new.html.erb
app/views/demand_users/shared/_links.erb
app/views/demanders/show.html.erb
app/views/panels/_form.html.erb
app/views/stories/_footer.html.erb
app/views/stories/comic.html.erb
config/locales/pettanr.ja.yml
spec/models/story_spec.rb

index bd48f0f..5b32d2e 100644 (file)
@@ -10,6 +10,8 @@ class ApplicationController < ActionController::Base
         'test'
       when :user
         'test'
+      when :demand_user
+        'test'
       end
     else
       'application'
index acd5fa2..65f929e 100644 (file)
@@ -84,7 +84,8 @@ class ArtistsController < ApplicationController
     @ar.overwrite @author
     respond_to do |format|
       if @ar.save
-        format.html { redirect_to root_path, notice: 'Artist was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Artist.model_name.human)
+        format.html { redirect_to root_path }
         format.json { render json: @ar.to_json(Artist.show_json_opt), status: :created, location: @artist }
       else
         format.html { render action: "new" }
@@ -102,7 +103,8 @@ class ArtistsController < ApplicationController
 
     respond_to do |format|
       if @ar.save
-        format.html { redirect_to '/home/configure', notice: 'Artist was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Artist.model_name.human)
+        format.html { redirect_to '/home/configure' }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
index 50adf08..7acfbf5 100644 (file)
@@ -69,7 +69,8 @@ class AuthorsController < ApplicationController
     @au.overwrite @user.id
     respond_to do |format|
       if @au.save
-        format.html { redirect_to root_path, notice: 'Author was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Author.model_name.human)
+        format.html { redirect_to root_path }
         format.json { render json: @au.to_json(Author.show_json_opt), status: :created, location: @artist }
       else
         format.html { render action: "new" }
@@ -85,7 +86,8 @@ class AuthorsController < ApplicationController
 
     respond_to do |format|
       if @au.save
-        format.html { redirect_to '/home/configure', notice: 'Author was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Author.model_name.human)
+        format.html { redirect_to '/home/configure' }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
index df4e9fd..b68a578 100644 (file)
@@ -95,7 +95,8 @@ class ComicsController < ApplicationController
 
     respond_to do |format|
       if @comic.save
-        format.html { redirect_to @comic, notice: 'Comic was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
+        format.html { redirect_to @comic }
         format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
       else
         format.html { render action: "new" }
@@ -112,7 +113,8 @@ class ComicsController < ApplicationController
     @comic.overwrite @author
     respond_to do |format|
       if @comic.save
-        format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
+        format.html { redirect_to @comic }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
index c936bbb..180f3ee 100644 (file)
@@ -38,7 +38,8 @@ class DemanderStatusesController < ApplicationController
     @demander_status = DemanderStatus.edit(params[:id], @admin)
     respond_to do |format|
       if @demander_status.approve params[:demander_status][:receive_hour1], params[:demander_status][:receive_hour2]
-        format.html { redirect_to @demander_status, notice: 'DemanderStatus was successfully updated.' }
+        flash[:notice] = I18n.t('demander_statuses.flash.notice.approved')
+        format.html { redirect_to @demander_status }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
@@ -51,10 +52,12 @@ class DemanderStatusesController < ApplicationController
     @demander_status = DemanderStatus.edit(params[:id], @admin)
     respond_to do |format|
       if @demander_status.reject
-        format.html { redirect_to @demander_status, notice: 'DemanderStatus was successfully rejected.' }
+        flash[:notice] = I18n.t('demander_statuses.flash.notice.rejected')
+        format.html { redirect_to @demander_status }
         format.json { head :ok }
       else
-        format.html { redirect_to @demander_status, notice: 'DemanderStatus was not rejected.' }
+        flash[:notice] = I18n.t('demander_statuses.flash.notice.not_rejected')
+        format.html { redirect_to @demander_status }
         format.json { render json: @demander_status.errors, status: :unprocessable_entity }
       end
     end
index a8c08d8..0bad0ae 100644 (file)
@@ -9,7 +9,8 @@ class DemandersController < ApplicationController
         format.html # index.html.erb
       end
     else
-      redirect_to new_demander_path, notice: 'Demander not found.'
+      flash[:notice] = I18n.t('demanders.flash.notice.not_found')
+      redirect_to new_demander_path
     end
   end
 
@@ -46,7 +47,8 @@ class DemandersController < ApplicationController
 
     respond_to do |format|
       if @demander.store
-        format.html { redirect_to @demander, notice: 'Demander was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Demander.model_name.human)
+        format.html { redirect_to @demander }
         format.json { render json: @demander.to_json(Demander.show_json_opt), status: :created, location: @demander }
       else
         format.html { render action: "new" }
@@ -61,7 +63,8 @@ class DemandersController < ApplicationController
     @demander.overwrite @demand_user
     respond_to do |format|
       if @demander.store
-        format.html { redirect_to @demander, notice: 'Demander was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Demander.model_name.human)
+        format.html { redirect_to @demander }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
@@ -74,10 +77,12 @@ class DemandersController < ApplicationController
     @demander = @demand_user.demander
     respond_to do |format|
       if @demander.demander_status.request
-        format.html { redirect_to demanders_path, notice: 'Demander was successfully updated.' }
+        flash[:notice] = I18n.t('demanders.flash.notice.requested')
+        format.html { redirect_to demanders_path }
         format.json { head :ok }
       else
-        format.html { redirect_to demanders_path, notice: 'Demander was not successfully updated.' }
+        flash[:notice] = I18n.t('demanders.flash.notice.not_requested')
+        format.html { redirect_to demanders_path }
         format.json { render json: @demander.errors, status: :unprocessable_entity }
       end
     end
@@ -87,10 +92,12 @@ class DemandersController < ApplicationController
     @demander = Demander.edit(params[:id], @demand_user)
     respond_to do |format|
       if @demander.stop
-        format.html { redirect_to demanders_url, notice: 'Demander was successfully stopped.' }
+        flash[:notice] = I18n.t('demanders.flash.notice.stopped')
+        format.html { redirect_to demanders_url }
         format.json { head :ok }
       else
-        format.html { redirect_to demanders_url, notice: 'Demander was not successfully stopped.' }
+        flash[:notice] = I18n.t('demanders.flash.notice.not_stopped')
+        format.html { redirect_to demanders_url }
         format.json { render json: @demander.errors, status: :unprocessable_entity }
       end
     end
index 8466eb3..9f5c0c1 100644 (file)
@@ -20,19 +20,26 @@ class HomeController < ApplicationController
   end
   
   def create_token
-    respond_to do |format|
-      if @user.create_token
-        format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
-      else
-        format.html { render action: "auth_token" }
+    if @user.create_token
+      respond_to do |format|
+        flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
+        format.html { redirect_to({:action => :configure}) }
       end
+    else
+      flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
+      format.html { render action: "configure" }
     end
   end
   
   def delete_token
-    @user.delete_token
-    respond_to do |format|
-      format.html { redirect_to :action => :configure}
+    if @user.delete_token
+      respond_to do |format|
+        flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
+        format.html { redirect_to :action => :configure}
+      end
+    else
+      flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
+      format.html { render action: "configure" }
     end
   end
   
index d3910c8..9739a0e 100644 (file)
@@ -66,8 +66,6 @@ class OriginalPicturesController < ApplicationController
     end
   end
 
-  # GET /original_pictures/new
-  # GET /original_pictures/new.json
   def new
     @original_picture = OriginalPicture.new
     @original_picture.supply_default
@@ -79,7 +77,6 @@ class OriginalPicturesController < ApplicationController
     end
   end
 
-  # GET /original_pictures/1/edit
   def edit
     @original_picture = OriginalPicture.edit(params[:id], @artist)
     respond_to do |format|
@@ -88,8 +85,6 @@ class OriginalPicturesController < ApplicationController
     end
   end
 
-  # POST /original_pictures
-  # POST /original_pictures.json
   def create
     @imager = PettanImager.load set_image params[:original_picture][:file]
     @original_picture = OriginalPicture.new
@@ -98,7 +93,8 @@ class OriginalPicturesController < ApplicationController
 
     respond_to do |format|
       if @original_picture.store(@imager)
-        format.html { redirect_to @original_picture, notice: 'Original picture was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => OriginalPicture.model_name.human)
+        format.html { redirect_to @original_picture }
         format.json { render json: @original_picture.to_json(OriginalPicture.show_json_opt), status: :created, location: @original_picture }
       else
         format.html { render action: "new" }
@@ -107,8 +103,6 @@ class OriginalPicturesController < ApplicationController
     end
   end
 
-  # PUT /original_pictures/1
-  # PUT /original_pictures/1.json
   def update
     @imager = PettanImager.load set_image params[:original_picture][:file]
     @original_picture = OriginalPicture.edit(params[:id], @artist)
@@ -116,7 +110,8 @@ class OriginalPicturesController < ApplicationController
 
     respond_to do |format|
       if @original_picture.store(@imager)
-        format.html { redirect_to @original_picture, notice: 'Original picture was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => OriginalPicture.model_name.human)
+        format.html { redirect_to @original_picture }
         format.json { render json: @original_picture.to_json(OriginalPicture.show_json_opt), status: :created, location: @original_picture }
       else
         format.html { render action: "edit" }
@@ -125,8 +120,6 @@ class OriginalPicturesController < ApplicationController
     end
   end
 
-  # DELETE /original_pictures/1
-  # DELETE /original_pictures/1.json
   def destroy
     @original_picture = OriginalPicture.edit(params[:id], @artist)
     OriginalPicture.transaction do
index c0cd0cf..c2bc788 100644 (file)
@@ -6,8 +6,6 @@ class PanelsController < ApplicationController
 
   public
   
-  # GET /panels
-  # GET /panels.json
   def index
     @page = Panel.page params[:page]
     @page_size = Panel.page_size params[:page_size]
@@ -19,8 +17,6 @@ class PanelsController < ApplicationController
     end
   end
 
-  # GET /panels/1
-  # GET /panels/1.json
   def show
     @panel = Panel.show(params[:id], @author)
 
@@ -76,8 +72,6 @@ class PanelsController < ApplicationController
     end
   end
 
-  # POST /panels
-  # POST /panels.json
   def create
     @panel = Panel.new
     @panel.supply_default
@@ -88,7 +82,8 @@ class PanelsController < ApplicationController
     @prm = params[:panel] || jsn
     respond_to do |format|
       if @panel.store @prm, @author
-        format.html { redirect_to @panel, notice: 'Panel was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human)
+        format.html { redirect_to @panel }
         format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
       else
         format.html { render action: "new" }
@@ -97,8 +92,6 @@ class PanelsController < ApplicationController
     end
   end
 
-  # PUT /panels/1
-  # PUT /panels/1.json
   def update
     @panel = Panel.edit(params[:id], @author)
     jsn = nil
@@ -108,7 +101,8 @@ class PanelsController < ApplicationController
     @prm = params[:panel] || jsn
     respond_to do |format|
       if @panel.store @prm, @author
-        format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Panel.model_name.human)
+        format.html { redirect_to @panel }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
@@ -117,8 +111,6 @@ class PanelsController < ApplicationController
     end
   end
 
-  # DELETE /panels/1
-  # DELETE /panels/1.json
   def destroy
     @panel = Panel.edit(params[:id], @author)
     respond_to do |format|
index 95a60ef..e38c564 100644 (file)
@@ -41,7 +41,8 @@ class ProviderStatusesController < ApplicationController
     @provider_status.overwrite
     respond_to do |format|
       if @provider_status.save
-        format.html { redirect_to @provider_status, notice: 'ProviderStatus was successfully updated.' }
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.created')
+        format.html { redirect_to @provider_status }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
@@ -52,10 +53,16 @@ class ProviderStatusesController < ApplicationController
 
   def destroy
     @provider_status = ProviderStatus.edit(params[:id], @admin)
-    @provider_status.destroy
     respond_to do |format|
-      format.html { redirect_to comics_url }
-      format.json { head :ok }
+      if @provider_status.stop
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.stopped')
+        format.html { redirect_to provider_statuses_url }
+        format.json { head :ok }
+      else
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.not_stopped')
+        format.html { render action: "edit" }
+        format.json { render json: @provider_status.errors, status: :unprocessable_entity }
+      end
     end
   end
 end
index c062f71..e13a7d3 100644 (file)
@@ -62,9 +62,6 @@ class StoriesController < ApplicationController
     end
   end
   
-  # GET /stories/new
-  # GET /stories/new.js
-  # GET /stories/new.json
   def new
     @story = Story.new 
     @story.supply_default
@@ -75,8 +72,6 @@ class StoriesController < ApplicationController
     end
   end
 
-  # GET /stories/1/edit
-  # GET /stories/1.js/edit
   def edit
     @story = Story.edit(params[:id], @author)
     respond_to do |format|
@@ -85,8 +80,6 @@ class StoriesController < ApplicationController
     end
   end
 
-  # POST /stories
-  # POST /stories.json
   def create
     @story = Story.new 
     @story.supply_default
@@ -97,6 +90,7 @@ class StoriesController < ApplicationController
     
     respond_to do |format|
       if @story.store
+        flash[:notice] = I18n.t('flash.notice.created', :model => Story.model_name.human)
         format.html { redirect_to action: :comic, id: @story.comic_id }
         format.json { render json: @story.story_as_json(@author) }
       else
@@ -106,8 +100,6 @@ class StoriesController < ApplicationController
     end
   end
   
-  # PUT /stories/1
-  # PUT /stories/1.json
   def update
     @story = Story.edit(params[:id], @author)
     ot = @story.t
@@ -115,6 +107,7 @@ class StoriesController < ApplicationController
     @story.overwrite @author
     respond_to do |format|
       if @story.store ot
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Story.model_name.human)
         format.html { redirect_to action: :comic, id: @story.comic_id }
         format.json { head :ok }
       else
@@ -124,9 +117,6 @@ class StoriesController < ApplicationController
     end
   end
 
-  # DELETE /stories/1
-  # DELETE /stories/1.js
-  # DELETE /stories/1.json
   def destroy
     @story = Story.edit(params[:id], @author)
     Story.transaction do
index 632f7e7..778c9c9 100644 (file)
@@ -22,17 +22,24 @@ class SystemController < ApplicationController
     @admin = current_admin
     respond_to do |format|
       if @admin.create_token
-        format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { redirect_to({:action => :auth_token}) }
       else
+        flash[:notice] = I18n.t('flash.notice.not_created', :model => Admin.human_attribute_name(:authentication_token))
         format.html { render action: "auth_token" }
       end
     end
   end
   
   def delete_token
-    current_admin.delete_token
     respond_to do |format|
-      format.html { redirect_to :action => :auth_token}
+      if current_admin.delete_token
+        flash[:notice] = I18n.t('flash.notice.destroyed', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { redirect_to :action => :auth_token}
+      else
+        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { render action: "auth_token" }
+      end
     end
   end
   
index a886838..d67ac9d 100644 (file)
@@ -182,7 +182,7 @@ class Story < ActiveRecord::Base
   def self.licensed_pictures stories
     r = {}
     stories.each do |story|
-      r.merge! story.panel.licensed_pictures
+      r.merge!(story.panel.licensed_pictures) if story.panel
     end
     r
   end
index d15e275..14d5864 100644 (file)
@@ -1,4 +1,4 @@
-<h2>Sign up</h2>
+<h2><%= t('admins.signup.title') %></h2>
 
 <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
   <%= devise_error_messages! %>
@@ -12,7 +12,7 @@
   <div><%= f.label :password_confirmation %><br />
   <%= f.password_field :password_confirmation %></div>
 
-  <div><%= f.submit "Sign up" %></div>
+  <div><%= f.submit t('admins.signup.signup') %></div>
 <% end %>
 
-<%= render :partial => "devise/shared/links" %>
+<%= render :partial => "admins/shared/links" %>
index 1b6aee0..2383463 100644 (file)
@@ -1,4 +1,4 @@
-<h2>Sign in</h2>
+<h2><%= t('admins.signin.title') %></h2>
 
 <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
   <div><%= f.label :email %><br />
@@ -11,6 +11,6 @@
     <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
   <% end -%>
 
-  <div><%= f.submit "Sign in" %></div>
+  <div><%= f.submit t('admins.signin.signin') %></div>
 <% end %>
-<%= render :partial => "admins/shared/links" %>
\ No newline at end of file
+<%= render :partial => "admins/shared/links" %>
index eab783a..9f21234 100644 (file)
@@ -1,13 +1,13 @@
 <%- if controller_name != 'sessions' %>
-  <%= link_to "Sign in", new_session_path(resource_name) %><br />
+  <%= link_to t('admins.shared.signin'), new_session_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
-  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+  <%= link_to t('admins.shared.signup'), new_registration_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
-  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+  <%= link_to t('admins.shared.forgot'), new_password_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
@@ -22,4 +22,4 @@
   <%- resource_class.omniauth_providers.each do |provider| %>
     <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
   <% end -%>
-<% end -%>
\ No newline at end of file
+<% end -%>
index e23a544..219f459 100644 (file)
@@ -1,4 +1,5 @@
 <h1><%= t '.title' -%></h1>\r
+<p id="notice"><%= notice %></p>\r
 \r
 <h2><%= t('comics.top.user_resources') -%></h2>\r
 <table>\r
index d15e275..c6e2f1b 100644 (file)
@@ -1,4 +1,4 @@
-<h2>Sign up</h2>
+<h2><%= t('demand_users.signup.title') %></h2>
 
 <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
   <%= devise_error_messages! %>
@@ -12,7 +12,7 @@
   <div><%= f.label :password_confirmation %><br />
   <%= f.password_field :password_confirmation %></div>
 
-  <div><%= f.submit "Sign up" %></div>
+  <div><%= f.submit t('demand_users.signup.signup') %></div>
 <% end %>
 
-<%= render :partial => "devise/shared/links" %>
+<%= render :partial => "demand_users/shared/links" %>
index ff59f7c..73258ed 100644 (file)
@@ -1,4 +1,4 @@
-<h2>Sign in</h2>
+<h2><%= t('demand_users.signin.title') %></h2>
 
 <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
   <div><%= f.label :email %><br />
@@ -11,7 +11,7 @@
     <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
   <% end -%>
 
-  <div><%= f.submit "Sign in" %></div>
+  <div><%= f.submit t('demand_users.signin.signin') %></div>
 <% end %>
 
-<%= render :partial => "devise/shared/links" %>
\ No newline at end of file
+<%= render :partial => "demand_users/shared/links" %>
index eab783a..745dc60 100644 (file)
@@ -1,13 +1,13 @@
 <%- if controller_name != 'sessions' %>
-  <%= link_to "Sign in", new_session_path(resource_name) %><br />
+  <%= link_to t('demand_users.shared.signin'), new_session_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
-  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+  <%= link_to t('demand_users.shared.signup'), new_registration_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
-  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+  <%= link_to t('demand_users.shared.forgot'), new_password_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
@@ -22,4 +22,4 @@
   <%- resource_class.omniauth_providers.each do |provider| %>
     <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
   <% end -%>
-<% end -%>
\ No newline at end of file
+<% end -%>
index 0f2f070..58220c7 100644 (file)
@@ -27,6 +27,6 @@
   <%= t(MagicNumber['demander_status_status_items'][@demander.demander_status.status].first) %>
 </p>
 
-<%= link_to 'Edit', edit_demander_path(@demander) %>
+<%= link_to t('link.edit'), edit_demander_path(@demander) %>
 <%= link_to t('link.back'), demanders_path %>
 
index 08f1296..4499fd9 100644 (file)
@@ -1,5 +1,6 @@
-<%= form_tag( {:controller => 'panels',:action => "create"}) do %>
+<%= form_for(@panel) do |f| %>
   <%= render 'system/error_explanation', :obj => @panel %>
+
   <div>
     <label for="json">json data</label>
   </div>
@@ -7,4 +8,4 @@
   <div>
     <%= submit_tag t('panels.create_from_json') -%>
   </div>
-<% end -%>
+<% end %>
index d2dcb6f..56e9367 100644 (file)
@@ -1,9 +1,11 @@
 <table class="no-border" style="margin: 0px; padding: 0px; width=100%">
   <tr>
     <td>
-      <%= link_to panel_icon(:object => story.panel, :size => 25), panel_path(story.panel) %>
-      <%= link_to author_icon(:object => story.panel.author, :size => 17), author_path(story.panel.author) %>
-      <%= distance_of_time_in_words_to_now story.panel.updated_at %>
+      <% if story.panel -%>
+        <%= link_to panel_icon(:object => story.panel, :size => 25), panel_path(story.panel) %>
+        <%= link_to author_icon(:object => story.panel.author, :size => 17), author_path(story.panel.author) %>
+        <%= distance_of_time_in_words_to_now story.panel.updated_at %>
+      <% end %>
     </td>
     <td>
       <%= link_to story_icon(:object => story, :size => 25), story_path(story) %>
index 63c22b5..a78f843 100644 (file)
@@ -1,11 +1,14 @@
 <h1><%= t '.title' -%></h1>
+<p id="notice"><%= notice %></p>
 <%= render 'comic_header', :comic => @comic, :author => @author %>
 
 <% if @stories.empty? -%>
   <h2><%= t('stories.comic.empty') %></h2>
 <% else %>
   <% @stories.each do |story| %>
-    <%= render 'panels/body', :panel => story.panel, :author => @author %>
+    <% if story.panel -%>
+      <%= render 'panels/body', :panel => story.panel, :author => @author %>
+    <% end %>
     <%= render 'footer', :story => story, :author => @author %>
   <% end %>
   <%= render 'licensed_pictures', :licensed_pictures => Story.licensed_pictures(@stories) %>
index 4f901e6..d835c6d 100644 (file)
@@ -5,9 +5,19 @@ ja:
     invalid_t: コマ要素の話順が不正です。
     not_convert: Gif画像へのコンバートに失敗しました。
     invalid_image: 画像として読み込めませんでした。
+  flash:
+    notice:
+      created: '%{model}が作成されました。'
+      updated: '%{model}が更新されました。'
+      destroyed: '%{model}が削除されました。'
+      not_created: '%{model}の作成に失敗しました。'
+      not_updated: '%{model}の更新に失敗しました。'
+      not_destroyed: '%{model}の削除に失敗しました。'
   activerecord:
     models:
       user: ユーザ
+      admin: 管理者
+      demand_user: 借手
       comic: コミック
       story: ストーリー
       panel: コマ
@@ -44,6 +54,13 @@ ja:
         current_password: 現在のパスワード
         remember_me: 次回から自動でログイン
         authentication_token: 認証トークン
+      admin:
+        email: メールアドレス
+        password: パスワード
+        password_confirmation: 確認パスワード
+        current_password: 現在のパスワード
+        remember_me: 次回から自動でログイン
+        authentication_token: 認証トークン
       demand_user:
         email: メールアドレス
         password: パスワード
@@ -319,6 +336,54 @@ ja:
     forgot:
       title: パスワードを忘れてしまった
       reset: 新しいパスワードを発行する
+  admins:
+    shared:
+      signin: ログイン
+      signup: 新規入会
+      forgot: パスワードを忘れた
+    signup:
+      title: 管理者登録
+      signup: 登録する
+    signin:
+      title: ログイン
+      signin: ログイン
+    edit:
+      title: アカウントの設定変更
+    forgot:
+      title: パスワードを忘れてしまった
+      reset: 新しいパスワードを発行する
+  users:
+    shared:
+      signin: ログイン
+      signup: 新規入会
+      forgot: パスワードを忘れた
+    signup:
+      title: ユーザ登録
+      signup: 登録する
+    signin:
+      title: ログイン
+      signin: ログイン
+    edit:
+      title: アカウントの設定変更
+    forgot:
+      title: パスワードを忘れてしまった
+      reset: 新しいパスワードを発行する
+  demand_users:
+    shared:
+      signin: ログイン
+      signup: 新規入会
+      forgot: パスワードを忘れた
+    signup:
+      title: ユーザ登録
+      signup: 登録する
+    signin:
+      title: ログイン
+      signin: ログイン
+    edit:
+      title: アカウントの設定変更
+    forgot:
+      title: パスワードを忘れてしまった
+      reset: 新しいパスワードを発行する
   home:
     index:
       title: ホーム
@@ -668,6 +733,12 @@ ja:
     to_provider: 貸手に切り替える
     wait: 待機中の貸手の借受状況だけを表示する
     all: すべての貸手の借受状況を表示する
+    flash: 
+      notice: 
+        created: 借受を開始しました。
+        not_created: 借受を開始できませんでした。
+        stopped: 借受を停止しました。
+        not_stopped: 借受を停止できませんでした。
   demanders:
     index:
       title: 借手一覧
@@ -681,6 +752,13 @@ ja:
     edit:
       title: 借手編集
     status: 状態
+    flash: 
+      notice: 
+        not_found: サイトプロフィールを登録してください。
+        requested: 借受申請しました。
+        not_requested: 借受申請できませんでした。
+        stopped: 借受を停止しました。
+        not_stopped: 借受を停止できませんでした。
   demander_statuses:
     index:
       title: 貸与状況一覧
@@ -700,6 +778,12 @@ ja:
     open: 開く
     wait: 申請中の借手の貸与状況だけを表示する
     all: すべての借手の貸与状況を表示する
+    flash: 
+      notice: 
+        rejected: 貸与を否決しました。
+        not_rejected: 貸与を否決できませんでした。
+        approved: 貸与を承認しました。
+        not_approved: 貸与を承認できませんでした。
   provider_licenses:
     index:
       title: ライセンス対照表一覧
index 9c747d7..f1a1646 100644 (file)
@@ -782,6 +782,18 @@ describe Story do
       r[@pp.picture_id].should eq @p
       r[@pp2.picture_id].should eq @p2
     end
+    context 'コマが削除されているときき' do
+      before do
+        @panel2.destroy
+      end
+      it '削除されているコマは無視する' do
+        r = Story.licensed_pictures [@story, @story2]
+        r.is_a?(Hash).should be_true
+        r.should have(1).items
+        r[@pp.picture_id].should eq @p
+        r[@pp2.picture_id].should be_nil
+      end
+    end
   end
   
   describe 't補充値に於いて' do