2 def self.included(base)
3 base.extend(ClassMethods)
4 base.__send__ :include, InstanceMethods
12 def list_opt_for_panel
16 def show_opt_for_panel
20 def json_opt_for_panel
24 def path_name with_engine = false
30 module InstanceMethods
47 def has_helper? column_name
48 self.class.colum_structures[column_name] and self.class.colum_structures[column_name][:helper]
52 self.class.to_s.underscore
59 def extend_element_name
60 self.extend_column ? self.attributes[extend_column] : self.element_name
63 def find_configurations hash, key
64 if hash[key].is_a? String
65 self.find_configurations hash, hash[key]
88 self.panel || @new_panel
92 'panel' + self.tag_panel_id + self.tag_element_type + self.tag_element_id + c.to_s
100 self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
104 self.new_record? ? '0' : self.id.to_s
115 def path_name with_engine = false
116 self.class.path_name(with_engine)
119 def form_template with_engine = false
120 self.path_name(with_engine) + '/form'
123 def scenario_template with_engine = false
124 self.path_name(with_engine) + '/scenario'
127 def element_face_template with_engine = false
128 self.path_name(with_engine) + '/element_face'
131 def form_helper_template(colum_name)
132 self.class.colum_structures[colum_name][:helper]
135 def tag_attributes column = nil, opt = {}
137 :id => self.field_tag_id(column), :panel_id => self.tag_panel_id,
138 :element_id => self.tag_element_id, :element_type => self.tag_element_type
142 def field_tag_attributes column, no_attr, opt = {}
143 self.tag_attributes(column).merge(
144 {:column => column, :new_index => self.tag_new_index, :no_attr => no_attr}
148 #render element by body
149 def any_tag_attributes name = nil, opt = {}
150 r = self.tag_attributes(name)
152 {:new_index => self.tag_new_index}
157 def select_tag_attributes(selected, column, no_attr)
160 {:html => {:selected => selected}},
161 self.field_tag_attributes(column, no_attr)
165 def tag_attr column = nil, opt = {}
166 self.tag_attributes(column, opt).to_attr
169 def field_tag_attr column, no_attr, opt = {}
170 self.field_tag_attributes(column, no_attr, opt).to_attr
173 def any_tag_attr name = nil, opt = {}
174 self.any_tag_attributes(name, opt).to_attr