2 class Element < ElementNestableContent
3 self.abstract_class = true
10 pm = Manifest.manifest.models[self.my_peta.parent_model_name].classify
11 define_singleton_method("parent_model") do
23 self.parent_model.root_model
29 def self.list_opt_for_panel
33 def self.show_opt_for_panel
37 def self.json_opt_for_panel
41 def self.panelize elements_attributes
42 elements_attributes = [elements_attributes] unless elements_attributes.is_a?(Array)
45 elements_attributes.each do |element_attributes|
46 hash[self.to_s.tableize + '_attributes'] ||= {}
47 n = if element_attributes['id']
48 element_attributes['id'].to_s
53 hash[self.to_s.tableize + '_attributes'][n] = element_attributes
74 def extend_element_name
75 self.extend_column ? self.attributes[extend_column] : self.element_name
78 def scenario_template with_engine = false
79 self.path_name(with_engine) + '/scenario'
82 def element_face_template with_engine = false
83 self.path_name(with_engine) + '/element_face'
86 def tag_attributes column = nil, opt = {}
88 r.merge({'data-parent_dom_id' => self.parent.dom_item_id}) if self.editize?
92 def merge_opacity s, opacity
94 'opacity' => opacity.to_f/100,
95 'filter' => "alpha(opacity=#{opacity})"
99 def copy_attributes opt = {}
103 r.delete 't' unless opt[:all]
104 r.delete 'z' unless opt[:all]
105 r.delete 'created_at'
106 r.delete 'updated_at'