belongs_to :speech_balloon
belongs_to :system_picture
- validates :speech_balloon_id, :presence => true, :numericality => true, :existence => true
+# validates :speech_balloon_id, :presence => true, :numericality => true, :existence => true
validates :system_picture_id, :presence => true, :numericality => true, :existence => true
validates :x, :presence => true, :numericality => true
validates :y, :presence => true, :numericality => true
#更新する時にPanelIDをチェックしとかないと勝手に所属先を変えられるゾ!?
def store
+ self.speech_balloons
f = nil
f = Panel.find_t(self.comic_id, self.t) if self.t
if f
self.panel_pictures.each do |picture|
pe[picture.t] = picture
end
- self.balloons.each do |balloon|
- pe[balloon.t] = balloon
+ self.speech_balloons.each do |sb|
+ pe[sb.t] = sb
end
pe
end
if elm.kind_of?(PanelPicture)
res[elm.t] = elm.to_json({:include => :resource_picture})
end
- if elm.kind_of?(Balloon)
- res[elm.t] = elm.to_json({:include => :speeches})
+ if elm.kind_of?(SpeechBalloon)
+ res[elm.t] = elm.to_json({:include => {:balloons => {}, :speeches => {}}})
end
end
res
class Speech < ActiveRecord::Base
belongs_to :speech_balloon
- validates :speech_balloon_id, :presence => true, :numericality => true, :existence => true
+# validates :speech_balloon_id, :presence => true, :numericality => true, :existence => true
validates :x, :presence => true, :numericality => true
validates :y, :presence => true, :numericality => true
validates :width, :presence => true, :numericality => true, :natural_number => true
accepts_nested_attributes_for :balloons
accepts_nested_attributes_for :speeches
- validates :panel_id, :presence => true, :numericality => true, :existence => true
+# validates :panel_id, :presence => true, :numericality => true, :existence => true
validates :speech_balloon_template_id, :presence => true, :numericality => true, :existence => true
validates :classname, :presence => true, :length => {:maximum => 50}
validates :z, :presence => true, :numericality => {:greater_than => 0}
<% @balloons.each do |balloon| %>
<tr>
<td><%= balloon.id %></td>
- <td><%= link_to speech.speech_balloon_id, :controller => 'speech_balloons', :action => :browse, :id => speech.speech_balloon_id %></td>
+ <td><%= link_to balloon.speech_balloon_id, :controller => 'speech_balloons', :action => :browse, :id => balloon.speech_balloon_id %></td>
<td><%= link_to balloon.system_picture_id, :controller => 'system_pictures', :action => :browse, :id => balloon.system_picture_id %></td>
<td><%= balloon.x %></td>
<td><%= balloon.y %></td>
<img style=" position:absolute; width:<%= panel_picture.width -%>px; height:<%= panel_picture.height -%>px; " src="<%= panel_picture.url -%>">
</div>
<% end %>
- <% panel.balloons.each do |balloon| %>
- <div id="vballoon<%= balloon.id -%>" class="balloon" style="position:relative; top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= balloon.z -%>; ">
- <img style=" position:absolute; width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; " src="<%= balloon.system_picture.url -%>">
- <% balloon.speeches.each do |speech| %>
- <div style="position:relative; top:<%= speech.y -%>px; left:<%= speech.x -%>px;width:<%= speech.width -%>px; height:<%= speech.height -%>px; top:1px; left:1px; z-index:1; ">
- <%= h speech.content -%>
- </div>
- <% end %>
- </div>
+ <% (panel.speech_balloons || []).each do |sb| %>
+ <% (sb.balloons || []).each do |balloon| %>
+ <% end %>
+ <% (sb.speeches || []).each do |speech| %>
+ <% end %>
<% end %>
</div>
<%= h panel.author.name %> <%= panel.updated_at %>
+++ /dev/null
-<p id="notice"><%= notice %></p>
-
-<p>
- <b>Name:</b>
- <%= h @speech_balloon.name %>
-</p>
-
-<p>
- <b>Tail count:</b>
- <%= @speech_balloon.tail_count %>
-</p>
-
-<p>
- <b>size count:</b>
- <%= @speech_balloon.size_count %>
-</p>
-
-<p>
- <b>t:</b>
- <%= @speech_balloon.t %>
-</p>
-<% @speech_balloon.balloon_templates.each do |balloon_template| -%>\r
- <div>\r
- <p>\r
- Tail:<%= balloon_template.tail -%>\r
- Size:<%= balloon_template.size -%>\r
- </p>\r
- <img src="<%= balloon_template.system_picture.url -%>" />\r
- </div>\r
-<% end -%>\r
-<%= link_to 'Back', :action => :list %>
<table>
<tr>
<th>id</th>
- <th>Name</th>
- <th>Tail count</th>
- <th>size count</th>
+ <th>panel_id</th>
+ <th>sbt id</th>
+ <th>classname</th>
+ <th>z</th>
<th>t</th>
+ <th>settings</th>
<th>created_at</th>
<th>updated_at</th>
<th></th>
<% @speech_balloons.each do |speech_balloon| %>
<tr>
<td><%= link_to speech_balloon.id, :action => :browse, :id => speech_balloon.id %></td>
- <td><%= h speech_balloon.name %></td>
- <td><%= speech_balloon.tail_count %></td>
- <td><%= speech_balloon.size_count %></td>
+ <td><%= speech_balloon.panel_id %></td>
+ <td><%= speech_balloon.speech_balloon_template_id %></td>
+ <td><%= speech_balloon.classname %></td>
+ <td><%= speech_balloon.z %></td>
<td><%= speech_balloon.t %></td>
+ <td><%= speech_balloon.settings %></td>
<td><%= speech_balloon.created_at %></td>
<td><%= speech_balloon.updated_at %></td>
<td>