2 class Element < ElementNestableContent
3 self.abstract_class = true
10 self.my_manifest.associations.each_parent_model do |parent_model|
11 define_singleton_method("parent_model") do
24 self.parent_model.root_model
30 def self.list_opt_for_panel
34 def self.show_opt_for_panel
38 def self.json_opt_for_panel
42 def self.panelize elements_attributes
43 elements_attributes = [elements_attributes] unless elements_attributes.is_a?(Array)
46 elements_attributes.each do |element_attributes|
47 hash[self.to_s.tableize + '_attributes'] ||= {}
48 n = if element_attributes['id']
49 element_attributes['id'].to_s
54 hash[self.to_s.tableize + '_attributes'][n] = element_attributes
75 def extend_element_name
76 self.extend_column ? self.attributes[extend_column] : self.element_name
79 def scenario_template with_engine = false
80 self.path_name(with_engine) + '/scenario'
83 def element_face_template with_engine = false
84 self.path_name(with_engine) + '/element_face'
87 def tag_attributes column = nil, opt = {}
89 r.merge({'data-parent_dom_id' => self.parent.dom_item_id}) if self.editize?
93 def merge_opacity s, opacity
95 'opacity' => opacity.to_f/100,
96 'filter' => "alpha(opacity=#{opacity})"
100 def copy_attributes opt = {}
104 r.delete 't' unless opt[:all]
105 r.delete 'z' unless opt[:all]
106 r.delete 'created_at'
107 r.delete 'updated_at'