Method: Forma::Form#initialize
- Defined in:
- lib/forma/form.rb
#initialize(h = {}) ⇒ Form
Returns a new instance of Form.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/forma/form.rb', line 14 def initialize(h = {}) h = h.symbolize_keys # general @id = h[:id] # @theme = h[:theme] || 'blue' # title properties @title = h[:title] @icon = h[:icon] @collapsible = h[:collapsible] @collapsed = h[:collapsed] # submit options @url = h[:url] @submit = h[:submit] || 'Save' @wait_on_submit = h[:wait_on_submit].blank? ? true : (not not h[:wait_on_submit]) @method = h[:method] @auth_token = h[:auth_token] # tabs @tabs = h[:tabs] || [] @selected_tab = h[:selected_tab] || 0 # model, errors and editing options @model = h[:model] @errors = h[:errors] @edit = h[:edit] @model_name = h[:model_name] # actions @title_actions = h[:title_actions] || [] @bottom_actions = h[:bottom_actions] || [] @multipart = (not not h[:multipart]) end |