From: yasushiito Date: Fri, 7 Jun 2013 10:05:06 +0000 (+0900) Subject: t#31524:fix spotting on panel X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=801c6dc963d36af1cab13a4d4e38186d89b37e6e t#31524:fix spotting on panel --- diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index c42bbe9c..848e4b24 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -117,7 +117,7 @@ class ComicsController < ApplicationController respond_to do |format| if @comic.destroy_with_story flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human) - format.html { redirect_to '/home/comic' } + format.html { redirect_to '/home/comics' } format.json { head :ok } else flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human) diff --git a/app/controllers/panels_controller.rb b/app/controllers/panels_controller.rb index e6648204..7ebd6c6e 100644 --- a/app/controllers/panels_controller.rb +++ b/app/controllers/panels_controller.rb @@ -132,7 +132,7 @@ class PanelsController < ApplicationController Panel.transaction do if @panel.destroy_with_elements flash[:notice] = I18n.t('flash.notice.destroyed', :model => Panel.model_name.human) - format.html { redirect_to '/home/panel' } + format.html { redirect_to '/home/panels' } format.json { head :ok } else flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Panel.model_name.human) diff --git a/app/models/ground_picture.rb b/app/models/ground_picture.rb index 086e5dd2..6ed5f982 100644 --- a/app/models/ground_picture.rb +++ b/app/models/ground_picture.rb @@ -31,8 +31,8 @@ class GroundPicture < ActiveRecord::Base end def opt_div_style full_url, spot = nil, opacity = 20 - o = spot and spot != self ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : '' - "width:#{self.panel.width}px; height:#{self.panel.height}px; z-index:#{self.z}; background-image: url(#{full_url}); background-repeat: #{self.repeat_text}; background-position: #{self.x}px, #{self.y}px; #{o}" + o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : '' + "position: absolute; width:#{self.panel.width}px; height:#{self.panel.height}px; top: 0px; left: 0px; z-index:#{self.z}; background-image: url(#{full_url}); background-repeat: #{self.repeat_text}; background-position: #{self.x}px, #{self.y}px; #{o}" end def tmb_opt_img_tag diff --git a/app/models/panel.rb b/app/models/panel.rb index dc8948a8..09479d27 100644 --- a/app/models/panel.rb +++ b/app/models/panel.rb @@ -184,7 +184,7 @@ class Panel < ActiveRecord::Base end def panel_elements - parts + grounds + (parts + grounds).compact end @@elm_json_opt = { diff --git a/app/models/panel_picture.rb b/app/models/panel_picture.rb index e960e3ea..b459e6f3 100644 --- a/app/models/panel_picture.rb +++ b/app/models/panel_picture.rb @@ -58,7 +58,7 @@ class PanelPicture < ActiveRecord::Base end def opt_img_tag spot = nil, opacity = 20 - o = spot and spot != self ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : '' + o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : '' {:src => self.url, :vPicture => self.id, :width => self.width.abs, :height => self.height.abs, :alt => self.caption, :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"} end diff --git a/app/views/ground_colors/_body.html.erb b/app/views/ground_colors/_body.html.erb deleted file mode 100644 index 41b40489..00000000 --- a/app/views/ground_colors/_body.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
- <% panel.panel_elements.each do |elm| %> - <% case elm.class.to_s %> - <% when 'PanelPicture' %> - <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 33)), elm.link) %> - <% when 'SpeechBalloon' %> - <% balloon = elm.balloons.first %> -
- <%= balloon.caption -%> - <% elm.speeches.each do |speech| %> -

- <%= h speech.content -%> -

- <% end %> -
- <% when 'GroundColor' %> -
;"> - -
- <% when 'GroundPicture' %> -
- -
- <% end %> - <% end %> -
diff --git a/app/views/ground_colors/_standard.html.erb b/app/views/ground_colors/_standard.html.erb index 47dee5de..35f438f6 100644 --- a/app/views/ground_colors/_standard.html.erb +++ b/app/views/ground_colors/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panel_pictures/body', :panel => panel, :author => author, :spot => spot %> +<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> <%= render 'panels/footer', :panel => panel, :author => author %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/ground_pictures/_body.html.erb b/app/views/ground_pictures/_body.html.erb deleted file mode 100644 index 41b40489..00000000 --- a/app/views/ground_pictures/_body.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
- <% panel.panel_elements.each do |elm| %> - <% case elm.class.to_s %> - <% when 'PanelPicture' %> - <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 33)), elm.link) %> - <% when 'SpeechBalloon' %> - <% balloon = elm.balloons.first %> -
- <%= balloon.caption -%> - <% elm.speeches.each do |speech| %> -

- <%= h speech.content -%> -

- <% end %> -
- <% when 'GroundColor' %> -
;"> - -
- <% when 'GroundPicture' %> -
- -
- <% end %> - <% end %> -
diff --git a/app/views/ground_pictures/_standard.html.erb b/app/views/ground_pictures/_standard.html.erb index 47dee5de..35f438f6 100644 --- a/app/views/ground_pictures/_standard.html.erb +++ b/app/views/ground_pictures/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panel_pictures/body', :panel => panel, :author => author, :spot => spot %> +<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> <%= render 'panels/footer', :panel => panel, :author => author %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/panel_pictures/_body.html.erb b/app/views/panel_pictures/_body.html.erb deleted file mode 100644 index 41b40489..00000000 --- a/app/views/panel_pictures/_body.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
- <% panel.panel_elements.each do |elm| %> - <% case elm.class.to_s %> - <% when 'PanelPicture' %> - <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 33)), elm.link) %> - <% when 'SpeechBalloon' %> - <% balloon = elm.balloons.first %> -
- <%= balloon.caption -%> - <% elm.speeches.each do |speech| %> -

- <%= h speech.content -%> -

- <% end %> -
- <% when 'GroundColor' %> -
;"> - -
- <% when 'GroundPicture' %> -
- -
- <% end %> - <% end %> -
diff --git a/app/views/panel_pictures/_standard.html.erb b/app/views/panel_pictures/_standard.html.erb index 47dee5de..35f438f6 100644 --- a/app/views/panel_pictures/_standard.html.erb +++ b/app/views/panel_pictures/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panel_pictures/body', :panel => panel, :author => author, :spot => spot %> +<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> <%= render 'panels/footer', :panel => panel, :author => author %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/panels/_body.html.erb b/app/views/panels/_body.html.erb index a73039ef..4827570d 100644 --- a/app/views/panels/_body.html.erb +++ b/app/views/panels/_body.html.erb @@ -2,7 +2,7 @@ <% panel.panel_elements.each do |elm| %> <% case elm.class.to_s %> <% when 'PanelPicture' %> - <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 20)), elm.link) %> + <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(spot)), elm.link) %> <% when 'SpeechBalloon' %> <% balloon = elm.balloons.first %>
@@ -14,7 +14,7 @@ <% end %>
<% when 'GroundPicture' %> -
+
<% when 'GroundColor' %>