Class: Qadmin::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Includes:
Assets::FormBuilder
Defined in:
lib/qadmin/form_builder.rb

Instance Method Summary collapse

Methods included from Assets::FormBuilder

#asset_browser, #asset_selector

Instance Method Details

#content_form(form_name, options = {}) ⇒ Object



5
6
7
8
# File 'lib/qadmin/form_builder.rb', line 5

def content_form(form_name, options = {})
  locals = options.reverse_merge({:content_type => object_name, :content => object, :f => self, :options => options})
  @template.render(:partial => "content_forms/#{form_name}_form", :locals => locals)
end

#text_field_with_hint(method, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/qadmin/form_builder.rb', line 10

def text_field_with_hint(method, options = {})
  if object.send(method).blank?
    options[:class] = if options[:class]
      options[:class] << ' hinted'
    else 
      'hinted'
    end
    options[:value] = options.delete(:hint)
  end
  text_field(method, options)
end