def opt_div_style spot = nil, opacity = 20
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; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
+ "position: absolute; width:#{self.get_panel.width}px; height:#{self.get_panel.height}px; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
+ end
+
+ def new_panel
+ @new_panel
+ end
+
+ def new_panel= v
+ @new_panel = v
+ end
+
+ def get_panel
+ self.panel || @new_panel
end
def tag_id c = nil
end
def tag_panel_id
- self.panel.new_record? ? '0' : self.panel.id.to_s
+ self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
end
def tag_element_id
def opt_div_style full_url, spot = nil, opacity = 20
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}"
+ "position: absolute; width:#{self.get_panel.width}px; height:#{self.get_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
{:src => self.picture.url, :width => tw, :height => th, :alt => self.caption}
end
+ def new_panel
+ @new_panel
+ end
+
+ def new_panel= v
+ @new_panel = v
+ end
+
+ def get_panel
+ self.panel || @new_panel
+ end
+
def tag_id c = nil
'panel' + tag_panel_id + 'ground_picture' + tag_element_id + c.to_s
end
end
def tag_panel_id
- self.panel.new_record? ? '0' : self.panel.id.to_s
+ self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
end
def tag_element_id
self.overwrite au
res = false
Panel.transaction do
+ self.panel_elements.each do |elm|
+ elm.new_panel = self
+ end
#self.publish = nil
res = self.save
unless validate_child
def copy
attr = self.copy_attributes
- attr.merge! PanelPicture.panelize(self.panel_pictures.map {|elm| elm.copy_attributes})
- attr.merge! SpeechBalloon.panelize(self.speech_balloons.map {|elm| elm.copy_attributes})
- attr.merge! GroundPicture.panelize(self.ground_pictures.map {|elm| elm.copy_attributes})
- attr.merge! GroundColor.panelize(self.ground_colors.map {|elm| elm.copy_attributes})
- p attr
+ Panel.each_element_class_names do |n|
+ attr.merge! Panel.class_name_to_class(n).panelize(self.elements_by_class_name(n).map {|elm| elm.copy_attributes})
+ end
attr
end
{:src => self.url, :width => tw, :height => th, :alt => self.caption}
end
+ def new_panel
+ @new_panel
+ end
+
+ def new_panel= v
+ @new_panel = v
+ end
+
+ def get_panel
+ self.panel || @new_panel
+ end
+
def tag_id c = nil
'panel' + tag_panel_id + 'panel_picture' + tag_element_id + c.to_s
end
end
def tag_panel_id
- self.panel.new_record? ? '0' : self.panel.id.to_s
+ self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
end
def tag_element_id
self.panel.visible? roles
end
+ def new_panel
+ @new_panel
+ end
+
+ def new_panel= v
+ @new_panel = v
+ end
+
+ def get_panel
+ self.panel || @new_panel
+ end
+
def tag_id c = nil
'panel' + tag_panel_id + 'speech_balloon' + tag_element_id + c.to_s
end
end
def tag_panel_id
- self.panel.new_record? ? '0' : self.panel.id.to_s
+ self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
end
def tag_element_id
<% end %>
<% end %>
<div id="<%= panel.tag_id -%>" panel_id="<%= panel.tag_panel_id -%>" class="pettanr-comic-panel" style="width:<%= panel.width %>px;height:<%= panel.height %>px;border-style: solid;border-width: <%= panel.border %>px;border-color:black; background-color:white;">
- <% unless panel.new_record? %>
<% panel.panel_elements.each do |elm| %>
<%= render elm.class.to_s.tableize + '/element', :elm => elm, :spot => spot %>
<% end %>
- <% end %>
</div>
</div>
<% end %>
</div>
-<% unless panel.new_record? %>
<div id="tabs-2">
<div id="elements-tabs">
<ul>
</ul>
</div>
</div>
-<% end %>
<div id="tabs-5">
<script>
<!--