Module: Qadmin::Assets::FormBuilder

Included in:
FormBuilder
Defined in:
lib/qadmin/assets/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#asset_browser(id, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/qadmin/assets/form_builder.rb', line 24

def asset_browser(id, options = {})
  options.reverse_merge!({
    :id => id,
    :label => false,
    :resize_type => ''
  })
  @template.render(:partial => 'shared/file_browser', :locals => options)
end

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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/qadmin/assets/form_builder.rb', line 5

def asset_selector(method, options = {})
  
  id = "#{object_name}_#{method}"
  form_name = "#{object_name}[#{method}]"

  options.reverse_merge!({
    :id => id,
    :form_name => form_name,
    :name => object_name,
    :method => method,
    :object => object,
    :current => object.send(method),
    :label => false,
    :resize_type => object_name.tableize,
    :multiple => true
  })
  @template.render(:partial => 'assets/asset_selector', :locals => options)
end