validates :z, :presence => true, :numericality => {:greater_than => 0}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
- def self.by_author_list_includes
- {
- :panel => {
- :author => {}
- }
- }
+ def self.pickup_item_name
+ Picture.item_name
end
- def self.list_opt_for_panel
- {
- :panel_pictures => {
- :picture => {:artist => {}, :license => {}}
- }
- }
+ def self.pickup_column_name
+ self.pickup_item_name + '_id'
end
- def self.show_opt_for_panel
- {
- :panel_pictures => {
- :picture => {:artist => {}, :license => {}}
- }
- }
+ def pickup_id
+ # get :picture_id if head revision
+ self.attributes[self.pickup_column_name]
end
- def self.json_opt_for_panel
+ def y
+ self.attributes['y']
+ end
+
+ def self.by_author_list_includes
{
- :picture => {:artist => {}, :license => {}}
+ :panel => {
+ :author => {}
+ }
}
end
'panels.publish > 0'
end
- def self.list_order
- 'panel_pictures.updated_at desc'
- end
-
- def self.list_opt
- {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} }
- end
-
- def self.list_json_opt
- {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
- end
-
def self.show_opt
{:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
end
- def self.show_json_opt
- {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
- end
-
- def store operators
- if self.new_record?
- self.panel.panel_pictures.build(self.attributes)
- else
- self.panel.panel_pictures.each do |panel_picture|
- next unless panel_picture == self
- attr = self.attributes
- attr.delete 'id'
- panel_picture.attributes = attr
- break
- end
- end
- self.panel.store({}, operators)
- end
-
- def remove operators
- self.panel.remove_element(self, operators)
- end
-
def scenario
if caption.blank?
''