Class: Toolbox::ControlRenderer
- Defined in:
- lib/toolbox/rendering.rb
Instance Attribute Summary
Attributes inherited from Renderer
Instance Method Summary collapse
Methods inherited from Renderer
#initialize, #label, #translate_field, #value
Constructor Details
This class inherits a constructor from Toolbox::Renderer
Instance Method Details
#render_control(form, rec, has_error = false) ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/toolbox/rendering.rb', line 206 def render_control(form, rec, has_error = false) = {} [:class] = 'error' if has_error [:class] = ([:class] || '') + ' ' + @widget_config.css_class if @widget_config.css_class [:id] = "dialog_#{form.tag_id @widget_config.name}" if @dialog [:title] = @view.send(:h, @widget_config.info) if @widget_config.info [:disabled] = @widget_config.disabled if @widget_config.disabled and not @widget_config.disabled.is_a?(Proc) [:disabled] = @widget_config.disabled.call(rec) if @widget_config.disabled.is_a?(Proc) case @widget_config.type when :select render_select form, rec, when :collection_select render_collection_select form, rec, when :auto_complete render_autocomplete form, rec, when :radio render_radio form, rec, when :check_box render_checkbox form, rec, when :date render_date form, rec, when :textfield render_textfield form, rec, when :textarea render_textarea form, rec, when :filefield render_filefield form, rec, when :hidden render_hidden form, rec, else raise "Unkown control type #{@widget_config.type}" end end |