Sha256: dcfcc4f31a615826c761b71eef9ccf3c7d337f6992b0a34254fb52dd51a8f19e

Contents?: true

Size: 714 Bytes

Versions: 8

Compression:

Stored size: 714 Bytes

Contents

module Qadmin
  class FormBuilder < ::ActionView::Helpers::FormBuilder
    include Qadmin::Assets::FormBuilder
    
    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
   
    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
   
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
quirkey-qadmin-0.2.0 lib/qadmin/form_builder.rb
quirkey-qadmin-0.2.1 lib/qadmin/form_builder.rb
quirkey-qadmin-0.2.2 lib/qadmin/form_builder.rb
quirkey-qadmin-0.2.3 lib/qadmin/form_builder.rb
qadmin-0.2.0 lib/qadmin/form_builder.rb
qadmin-0.2.2 lib/qadmin/form_builder.rb
qadmin-0.2.1 lib/qadmin/form_builder.rb
qadmin-0.2.3 lib/qadmin/form_builder.rb