class PanelPicture < ActiveRecord::Base
+ include Element
+ include ElementInspire
belongs_to :panel
belongs_to :picture
end
end
+ def self.list_opt_for_panel
+ {
+ :panel_pictures => {
+ :picture => {:artist => {}, :license => {}}
+ }
+ }
+ end
+
+ def self.show_opt_for_panel
+ {
+ :panel_pictures => {
+ :picture => {:artist => {}, :license => {}}
+ }
+ }
+ end
+
+ def self.json_opt_for_panel
+ {
+ :picture => {:artist => {}, :license => {}}
+ }
+ end
+
+ def self.has_picture?
+ true
+ end
+
def visible? roles
if MagicNumber['run_mode'] == 0
return false unless guest_role_check(roles)
end
end
- def overwrite
+ def overwrite pid
+ self.panel_id = pid
end
def flip
end
def opt_div_style
- "z-index:#{self.z}; "
+ "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; position: absolute;"
end
def opt_img_tag spot = nil, opacity = 20
{:id => self.tag_id(:img), :panel_id => self.tag_panel_id, :element_id => self.tag_element_id, :element_type => self.tag_element_type,
:class => "panel-picture", :vPicture => self.id,
:src => self.url, :width => self.width.abs, :height => self.height.abs, :picture_id => self.picture_id, :ext => self.picture.ext, :alt => self.caption,
- :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"}
+ :style => "#{o}"}
end
def tmb_opt_img_tag
end
def remove au
- d = false
- panel_pictures_attributes = {}
- self.panel.panel_pictures.each do |panel_picture|
- attr = panel_picture.attributes
- if panel_picture == self
- attr['_destroy'] = true
- d = true
- else
- if d
- attr['t'] -= 1
- end
- end
- panel_pictures_attributes[panel_picture.id] = attr
- end
- self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
- self.panel.store({}, au)
+ self.panel.remove_element(self, au)
end
def scenario