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
22 if self.parent_model and self.parent_model.element?
23 self.parent_model.root_model
31 def visible? operators
32 return false unless super
36 def self.list_opt_for_panel
40 def self.show_opt_for_panel
44 def self.json_opt_for_panel
48 def self.panelize elements_attributes
49 elements_attributes = [elements_attributes] unless elements_attributes.is_a?(Array)
52 elements_attributes.each do |element_attributes|
53 hash[self.to_s.tableize + '_attributes'] ||= {}
54 n = if element_attributes['id']
55 element_attributes['id'].to_s
60 hash[self.to_s.tableize + '_attributes'][n] = element_attributes
81 def extend_element_name
82 self.extend_column ? self.attributes[extend_column] : self.element_name
85 def scenario_template with_engine = false
86 self.path_name(with_engine) + '/scenario'
89 def element_face_template with_engine = false
90 self.path_name(with_engine) + '/element_face'
93 def tag_attributes column = nil, opt = {}
95 r.merge({'data-parent_dom_id' => self.parent.dom_item_id}) if self.editize?
99 def merge_opacity s, opacity
101 'opacity' => opacity.to_f/100,
102 'filter' => "alpha(opacity=#{opacity})"
106 def copy_attributes opt = {}
110 r.delete 't' unless opt[:all]
111 r.delete 'z' unless opt[:all]
112 r.delete 'created_at'
113 r.delete 'updated_at'