-class PanelPicture < Peta::Content
- include Peta::Element
- include ElementInspire
+class PanelPicture < Peta::Element
+ load_manifest
belongs_to :panel
belongs_to :picture
validates :z, :presence => true, :numericality => {:greater_than => 0}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
- def self.owner_model
- Panel
- end
-
- def self.valid_encode_columns
- super + ['link', 'caption']
- end
-
- def self.colum_structures
- @@colum_structures ||= {
- :width => {
- :helper => 'panels/size_helper'
- },
- :height => {
- :helper => 'panels/size_helper'
+ def self.by_author_list_includes
+ {
+ :panel => {
+ :author => {}
}
}
end
true
end
- def visible? operators
- return false unless super
- self.owner_model.visible? operators
- end
-
def supply_default
self.x = 0
self.y = 0
def opt_img_tag spot = nil, opacity = 20
o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
- {: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 => "#{o}"}
+ self.tag_attributes(:img, {
+ :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 => "#{o}"
+ })
end
def tmb_opt_img_tag
self.picture.symbol_option
end
- def boost
- end
-
- def tag_element_type
- 'panel_picture'
- end
-
- def self.list_where
+ def self.public_list_where
'panels.publish > 0'
end