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 if self.parent_model.element?
24 self.parent_model.root_model
36 pm = self.__send__ self.class.parent_model.item_name
44 def visible? operators
45 return false unless super
46 self.root.visible? operators
49 def self.list_opt_for_panel
53 def self.show_opt_for_panel
57 def self.json_opt_for_panel
61 def self.panelize elements_attributes
62 elements_attributes = [elements_attributes] unless elements_attributes.is_a?(Array)
65 elements_attributes.each do |element_attributes|
66 hash[self.to_s.tableize + '_attributes'] ||= {}
67 n = if element_attributes['id']
68 element_attributes['id'].to_s
73 hash[self.to_s.tableize + '_attributes'][n] = element_attributes
94 def extend_element_name
95 self.extend_column ? self.attributes[extend_column] : self.element_name
98 def scenario_template with_engine = false
99 self.path_name(with_engine) + '/scenario'
102 def element_face_template with_engine = false
103 self.path_name(with_engine) + '/element_face'
106 def tag_attributes column = nil, opt = {}
108 r.merge({'data-parent_dom_id' => self.parent.dom_item_id}) if self.editize?
112 def merge_opacity s, opacity
114 'opacity' => opacity.to_f/100,
115 'filter' => "alpha(opacity=#{opacity})"
119 def copy_attributes opt = {}
123 r.delete 't' unless opt[:all]
124 r.delete 'z' unless opt[:all]
125 r.delete 'created_at'
126 r.delete 'updated_at'