class SheetPanel < Peta::Element
load_manifest
- belongs_to :author
belongs_to :panel
belongs_to :sheet
accepts_nested_attributes_for :panel, :allow_destroy => true
+ #alias_attribute :attr_y, :y
validates :sheet_id, :numericality => {:allow_blank => true}
validates :panel_id, :numericality => {:allow_blank => true}
- validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
validates :x, :presence => true, :numericality => true
validates :y, :presence => true, :numericality => true
validates :z, :presence => true, :numericality => {:greater_than => 0}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
- def attr_y
+ def y
self.attributes['y']
end
end
end
- def overwrite operators
- return false unless operators.author
- self.author_id = operators.author.id
- end
-
def self.by_author_list_includes
{
:sheet => {
def self.show_opt
{:include => {
- :author => {},
:sheet => {
:author => {}
},
def sheet_panel_as_json au
panel_include = if self.panel and self.panel.visible?(au)
- {:include => {:author => {}}, :methods => :elements}
+ {:include => {}, :methods => :elements}
else
- {:include => {:author => {}}}
+ {:include => {}}
end
- self.to_json({:include => {:sheet => {:include => {:author => {}}}, :author => {}, :panel => panel_include}})
+ self.to_json({:include => {:sheet => {:include => {:author => {}}}, :panel => panel_include}})
end
def self.list_as_json_text ary, au