Module: ThinMan::AjaxHelper

Defined in:
lib/thin_man/ajax_helper.rb

Instance Method Summary collapse

Instance Method Details

#ajax_hash(target, method = 'html') ⇒ Object



17
18
19
20
21
22
# File 'lib/thin_man/ajax_helper.rb', line 17

def ajax_hash(target, method='html')
  { data: {
    ajax_form: true,
    ajax_target: target,
    insert_method: method } }
end


3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/thin_man/ajax_helper.rb', line 3

def ajax_link(name, options, html_options, target, sub_class=nil, insert_method=nil)
  sub_class ||= 'true'
  insert_method ||= 'html'
  ajax_options = {
    'data-ajax-link' => true,
    'data-ajax-target' => target,
    'data-insert-method' => insert_method
  }
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
  link_to(name,
          options,
          html_options.merge(ajax_options))
end