{:include => {:speech_balloon => {:include => {:panel => {:include => {:author => {} }}, :speech => {}, :speech_balloon_template => {} }}}}
end
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'speech_balloon_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
+ r
+ end
+
+ def self.panelize balloon_attributes
+ {'balloon_attributes' => balloon_attributes}
+ end
+
def scenario
end
self.panel.remove_element(self, au)
end
- def copy from_panel
- r = GroundColor.new self.attributes
- r.panel_id = from_panel.id
- r.t = r.panel.new_t
- r.z = r.panel.new_z
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'panel_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
r
end
+ def copy to_panel
+ new_ground_color = GroundColor.new self.copy_attributes
+ new_ground_color.t = to_panel.new_t
+ new_ground_color.z = to_panel.new_z
+ new_attr = GroundColor.panelize new_ground_color.copy_attributes
+ r = {} #Panel.panelize to_panel
+ r.merge! new_attr
+ r
+ end
+
+ def self.panelize ground_colors_attributes
+ ground_colors_attributes = [ground_colors_attributes] unless ground_colors_attributes.is_a?(Array)
+ hash = {}
+ index = 0
+ ground_colors_attributes.each do |ground_color_attributes|
+ n = if ground_color_attributes['id']
+ ground_color_attributes['id'].to_s
+ else
+ index += 1
+ 'new' + index.to_s
+ end
+ hash[n] = ground_color_attributes
+ end
+ {self.to_s.tableize + '_attributes' => hash}
+ end
+
def scenario
if caption.blank?
''
self.panel.remove_element(self, au)
end
- def copy from_panel
- r = GroundPicture.new self.attributes
- r.panel_id = from_panel.id
- r.t = r.panel.new_t
- r.z = r.panel.new_z
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'panel_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
r
end
+ def copy to_panel
+ new_ground_picture = GroundPicture.new self.copy_attributes
+ new_ground_picture.t = to_panel.new_t
+ new_ground_picture.z = to_panel.new_z
+ new_attr = GroundPicture.panelize new_ground_picture.copy_attributes
+ r = {} #Panel.panelize to_panel
+ r.merge! new_attr
+ r
+ end
+
+ def self.panelize ground_pictures_attributes
+ ground_pictures_attributes = [ground_pictures_attributes] unless ground_pictures_attributes.is_a?(Array)
+ hash = {}
+ index = 0
+ ground_pictures_attributes.each do |ground_picture_attributes|
+ n = if ground_picture_attributes['id']
+ ground_picture_attributes['id'].to_s
+ else
+ index += 1
+ 'new' + index.to_s
+ end
+ hash[n] = ground_picture_attributes
+ end
+ {self.to_s.tableize + '_attributes' => hash}
+ end
+
def scenario
if caption.blank?
''
res
end
+ def copy au
+ attr = self.attributes
+ attr.delete 'id'
+ self.panel_elements.each_with_index do |elm, index|
+ elm_attr = elm.attributes
+ elm_attr.delete 'id'
+ elm_attr.delete 'panel_id'
+ elm_attr.delete 'created_at'
+ elm_attr.delete 'updated_at'
+ case elm.class.to_s
+ when 'PanelPicture'
+ when 'SpeechBalloon'
+ balloon_attr = elm.balloon.attributes
+ balloon_attr.delete 'id'
+ balloon_attr.delete 'speech_balloon_id'
+ elm_attr['balloon_attributes'] = balloon_attr
+ speech_attr = elm.speech.attributes
+ speech_attr.delete 'id'
+ speech_attr.delete 'speech_balloon_id'
+ elm_attr['speech_attributes'] = speech_attr
+ when 'GroundPicture'
+ when 'GroundColor'
+ end
+ attr[elm.class.to_s.tableize + '_attributes'] ||= {}
+ attr[elm.class.to_s.tableize + '_attributes'][index] = elm_attr
+ end
+ end
+
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'author_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
+ r
+ end
+
+ def self.panelize panel
+ attr = panel.attributes
+ attr.delete 'id'
+ attr
+ end
+
+
=begin
def self.validate_id ary, pid
ary.map {|v|
self.panel.remove_element(self, au)
end
- def copy from_panel
- r = PanelPicture.new self.attributes
- r.panel_id = from_panel.id
- r.t = r.panel.new_t
- r.z = r.panel.new_z
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'panel_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
r
end
+ def copy to_panel
+ new_panel_picture = PanelPicture.new self.copy_attributes
+ new_panel_picture.t = to_panel.new_t
+ new_panel_picture.z = to_panel.new_z
+ new_attr = PanelPicture.panelize new_panel_picture.copy_attributes
+ r = {} #Panel.panelize to_panel
+ r.merge! new_attr
+ r
+ end
+
+ def self.panelize panel_pictures_attributes
+ panel_pictures_attributes = [panel_pictures_attributes] unless panel_pictures_attributes.is_a?(Array)
+ hash = {}
+ index = 0
+ panel_pictures_attributes.each do |panel_picture_attributes|
+ n = if panel_picture_attributes['id']
+ panel_picture_attributes['id'].to_s
+ else
+ index += 1
+ 'new' + index.to_s
+ end
+ hash[n] = panel_picture_attributes
+ end
+ {self.to_s.tableize + '_attributes' => hash}
+ end
+
def scenario
if caption.blank?
''
{:include => {:speech_balloon => {:include => {:panel => {:include => {:author => {} }}, :balloon => {}, :speech_balloon_template => {} }}}}
end
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'speech_balloon_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
+ r
+ end
+
+ def self.panelize speech_attributes
+ {'speech_attributes' => speech_attributes}
+ end
+
def scenario
ERB::Util.html_escape(self.content)
end
self.panel.remove_element(self, au)
end
- def copy from_panel
- sb = SpeechBalloon.new self.attributes
- sb.panel_id = from_panel.id
- sb.t = sb.panel.new_t
- sb.z = sb.panel.new_z
- b = sb.build_balloon(self.balloon.attributes)
- s = sb.build_speech(self.speech.attributes)
- sb.extend self.speech_balloon_template.engine_speech_balloon_module
- b.extend self.speech_balloon_template.engine_balloon_module
- s.extend self.speech_balloon_template.engine_speech_module
- b.new_speech_balloon = sb
- s.new_speech_balloon = sb
- sbe = sb.extend_speech_balloon
- be = b.extend_balloon
- se = s.extend_speech
- {:speech_balloon => sb, :balloon => b, :speech => s, :speech_balloon_extend => sbe, :balloon_extend => be, :speech_extend => se }
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'panel_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
+ new_balloon_attr = self.balloon ? Balloon.panelize(self.balloon.copy_attributes) : {}
+ new_speech_attr = self.speech ? Speech.panelize(self.speech.copy_attributes) : {}
+ r.merge! new_balloon_attr
+ r.merge! new_speech_attr
+ r
+ end
+
+ def copy to_panel
+ new_speech_balloon = SpeechBalloon.new self.copy_attributes
+ new_speech_balloon.t = to_panel.new_t
+ new_speech_balloon.z = to_panel.new_z
+ new_attr = SpeechBalloon.panelize new_speech_balloon.copy_attributes
+ r = {} #Panel.panelize to_panel
+ r.merge! new_attr
+ r
+ end
+
+ def self.panelize speech_balloons_attributes
+ speech_balloons_attributes = [speech_balloons_attributes] unless speech_balloons_attributes.is_a?(Array)
+ hash = {}
+ index = 0
+ speech_balloons_attributes.each do |speech_balloon_attributes|
+ n = if speech_balloon_attributes['id']
+ speech_balloon_attributes['id'].to_s
+ else
+ index += 1
+ 'new' + index.to_s
+ end
+ hash[n] = speech_balloon_attributes
+ end
+ {self.to_s.tableize + '_attributes' => hash}
end
def scenario
<% if author and author.working? -%>
- <h2><%= 'Copying my working panel' -%></h2>
+ <h2><%= t('ground_colors.show.copy') -%></h2>
<h3><%= t('home.index.catch') -%></h3>
<%= link_to panel_icon(:object => author.working_panel, :size => 25), panel_path(author.working_panel) %>
<%= link_to author.working_panel.caption, main_app.panel_path(author.working_panel) %>
- <%= render 'ground_colors/form', :ground_color => ground_color.copy(author.working_panel) %>
+ <%= form_for(author.working_panel) do |f| %>
+ <%= hidden_field_tag "json", ground_color.copy(author.working_panel).to_json %>
+ <div>
+ <%= submit_tag t('ground_colors.show.inspire') -%>
+ </div>
+ <% end %>
<% end -%>
<% if author and author.working? -%>
- <h2><%= 'Copying my working panel' -%></h2>
+ <h2><%= t('ground_pictures.show.copy') -%></h2>
<h3><%= t('home.index.catch') -%></h3>
<%= link_to panel_icon(:object => author.working_panel, :size => 25), panel_path(author.working_panel) %>
<%= link_to author.working_panel.caption, main_app.panel_path(author.working_panel) %>
- <%= render 'ground_pictures/form', :ground_picture => ground_picture.copy(author.working_panel) %>
+ <%= form_for(author.working_panel) do |f| %>
+ <%= hidden_field_tag "json", ground_picture.copy(author.working_panel).to_json %>
+ <div>
+ <%= submit_tag t('ground_pictures.show.inspire') -%>
+ </div>
+ <% end %>
<% end -%>
<% if author and author.working? -%>
- <h2><%= 'Copying my working panel' -%></h2>
+ <h2><%= t('panel_pictures.show.copy') -%></h2>
<h3><%= t('home.index.catch') -%></h3>
<%= link_to panel_icon(:object => author.working_panel, :size => 25), panel_path(author.working_panel) %>
<%= link_to author.working_panel.caption, main_app.panel_path(author.working_panel) %>
- <%= render 'panel_pictures/form', :panel_picture => panel_picture.copy(author.working_panel) %>
+ <%= form_for(author.working_panel) do |f| %>
+ <%= hidden_field_tag "json", panel_picture.copy(author.working_panel).to_json %>
+ <div>
+ <%= submit_tag t('panel_pictures.show.inspire') -%>
+ </div>
+ <% end %>
<% end -%>
<%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(spot)), elm.link) %>
</div>
<% when 'SpeechBalloon' %>
+ <% next unless elm.balloon or elm.speech %>
<div id="<%= elm.tag_id -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>" balloon_id="<%= elm.balloon.tag_element_id -%>" speech_id="<%= elm.speech.tag_element_id -%>" class="pettanr-comic-balloon" style="width:<%= elm.balloon.width -%>px; height:<%= elm.balloon.height -%>px; top:<%= elm.balloon.y -%>px; left:<%= elm.balloon.x -%>px; z-index:<%= elm.z -%>; ">
<img id="<%= elm.balloon.tag_id -%>" panel_id="<%= elm.balloon.tag_panel_id -%>" element_id="<%= elm.balloon.tag_element_id -%>" element_type="<%= elm.balloon.tag_element_type -%>" element_part_id="<%= elm.balloon.tag_element_part_id -%>" element_part_type="<%= elm.balloon.tag_element_part_type -%>" class="pettanr-balloon" src="<%= elm.balloon.system_picture.url -%>" alt="<%= elm.caption -%>">
<p style="top:<%= elm.speech.y -%>%; left:<%= elm.speech.x -%>%;width:<%= elm.speech.width -%>%; height:<%= elm.speech.height -%>%;">
<div id="<%= @panel.tag_id -%>wrapper" panel_id="<%= @panel.tag_panel_id -%>" class="pettanr-panel-wrapper" editable="true">
<%= render 'panels/body', :panel => @panel, :author => @author, :spot => nil %>
- <%= render 'form' %>
+ <%= render 'form', :panel => @panel %>
</div>
<%= link_to t('link.destroy'), panel_path(@panel), :method => :delete %>
<%= render 'panels/licensed_pictures', :licensed_pictures => @panel.licensed_pictures %>
<div id="<%= @panel.tag_id -%>wrapper" panel_id="<%= @panel.tag_panel_id -%>" class="pettanr-panel-wrapper" editable="true">
<%= render 'panels/body', :panel => @panel, :author => @author, :spot => nil %>
- <%= render 'form' %>
+ <%= render 'form', :panel => @panel %>
</div>
<%= render 'append_comic', :panel => @panel, :comic => comic, :author => @author %>
<% end %>
</table>
+<h2><%= t('panels.show.copy') -%></h2>
+<%= form_for(Panel.new, :html => {:jqform => 'pettanr-panel-form'}) do |f| %>
+
+ <%= hidden_field_tag "json", @panel.copy(@author).to_json %>
+ <div>
+ <%= submit_tag t('panels.show.inspire') -%>
+ </div>
+<% end %>
<% if author and author.working? -%>
- <h2><%= 'Copying my working panel' -%></h2>
+ <h2><%= t('speech_balloons.show.copy') -%></h2>
<h3><%= t('home.index.catch') -%></h3>
<%= link_to panel_icon(:object => author.working_panel, :size => 25), panel_path(author.working_panel) %>
<%= link_to author.working_panel.caption, main_app.panel_path(author.working_panel) %>
- <% sbset = speech_balloon.copy(author.working_panel) -%>
- <%= render speech_balloon.speech_balloon_template.engine_name + '/speech_balloons/form', :speech_balloon => sbset[:speech_balloon], :balloon => sbset[:balloon], :speech => sbset[:speech], :speech_balloon_extend => sbset[:speech_balloon_extend], :balloon_extend => sbset[:balloon_extend], :speech_extend => sbset[:speech_extend] %>
+ <%= form_for(author.working_panel) do |f| %>
+ <%= hidden_field_tag "json", speech_balloon.copy(author.working_panel).to_json %>
+ <div>
+ <%= submit_tag t('speech_balloons.show.inspire') -%>
+ </div>
+ <% end %>
<% end -%>
<%= link_to(h(truncate(speech_balloon.caption, :length => 12)), speech_balloon_path(speech_balloon)) %>
</td>
<td>
- <%= h(truncate(speech_balloon.speech.content, :length => 12)) %>
+ <%= h(truncate(speech_balloon.speech.content, :length => 12)) if speech_balloon.speech %>
</td>
<td>
- <%= tag(:img, speech_balloon.balloon.system_picture.tmb_opt_img_tag) %>
+ <%= tag(:img, speech_balloon.balloon.system_picture.tmb_opt_img_tag) if speech_balloon.balloon %>
<%= link_to(h(truncate(speech_balloon.speech_balloon_template.caption, :length => 12)), speech_balloon_template_path(speech_balloon.speech_balloon_template)) %>
</td>
<td>
<%= @speech_balloon.t %>
</p>
-<p>
- <b><%= t_m 'Balloon.x' -%>:</b>
- <%= @speech_balloon.balloon.x %>
-</p>
-
-<p>
- <b><%= t_m 'Balloon.y' -%>:</b>
- <%= @speech_balloon.balloon.y %>
-</p>
-
-<p>
- <b><%= t_m 'Balloon.width' -%>:</b>
- <%= @speech_balloon.balloon.width %>
-</p>
-
-<p>
- <b><%= t_m 'Balloon.height' -%>:</b>
- <%= @speech_balloon.balloon.height %>
-</p>
-
-<p>
- <b><%= t_m 'Balloon.r' -%>:</b>
- <%= @speech_balloon.balloon.r %>
-</p>
-
-<p>
- <b><%= t_m 'Speech.content' -%>:</b>
- <%= @speech_balloon.speech.content %>
-</p>
-
-<p>
- <b><%= t_m 'Speech.x' -%>:</b>
- <%= @speech_balloon.speech.x %>
-</p>
-
-<p>
- <b><%= t_m 'Speech.y' -%>:</b>
- <%= @speech_balloon.speech.y %>
-</p>
-
-<p>
- <b><%= t_m 'Speech.width' -%>:</b>
- <%= @speech_balloon.speech.width %>
-</p>
-
-<p>
- <b><%= t_m 'Speech.height' -%>:</b>
- <%= @speech_balloon.speech.height %>
-</p>
+<% if @speech_balloon.balloon %>
+ <p>
+ <b><%= t_m 'Balloon.x' -%>:</b>
+ <%= @speech_balloon.balloon.x %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Balloon.y' -%>:</b>
+ <%= @speech_balloon.balloon.y %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Balloon.width' -%>:</b>
+ <%= @speech_balloon.balloon.width %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Balloon.height' -%>:</b>
+ <%= @speech_balloon.balloon.height %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Balloon.r' -%>:</b>
+ <%= @speech_balloon.balloon.r %>
+ </p>
+<% end %>
+
+<% if @speech_balloon.speech %>
+ <p>
+ <b><%= t_m 'Speech.content' -%>:</b>
+ <%= @speech_balloon.speech.content %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Speech.x' -%>:</b>
+ <%= @speech_balloon.speech.x %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Speech.y' -%>:</b>
+ <%= @speech_balloon.speech.y %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Speech.width' -%>:</b>
+ <%= @speech_balloon.speech.width %>
+ </p>
+
+ <p>
+ <b><%= t_m 'Speech.height' -%>:</b>
+ <%= @speech_balloon.speech.height %>
+ </p>
+<% end %>
<p>
<b><%= t_m 'SpeechBalloon.created_at' -%>:</b>
append: このコミックに追加する
new_comics: 最近作成したコミック
fresh_comics: 最近更新したコミック
+ copy: コマをコピーしたい
+ inspire: インスパイヤ
new:
title: コマ作成
edit:
title: コマ絵一覧
show:
title: コマ絵詳細
+ copy: コマ絵をつかんでいるコマにコピーしたい
+ inspire: インスパイヤ
new:
title: コマ絵作成
edit:
title: フキダシ一覧
show:
title: フキダシ詳細
+ copy: セリフをつかんでいるコマにコピーしたい
+ inspire: インスパイヤ
new:
title: フキダシ作成
edit:
title: 絵地一覧
show:
title: 絵地詳細
+ copy: 絵地をつかんでいるコマにコピーしたい
+ inspire: インスパイヤ
new:
title: 絵地作成
edit:
title: 色地一覧
show:
title: 色地詳細
+ copy: 色地をつかんでいるコマにコピーしたい
+ inspire: インスパイヤ
new:
title: 色地作成
edit: