module ThinMan::AjaxHelper

Public Instance Methods

ajax_delete(name, options, html_options, target, sub_class: nil, replace_response: false, no_confirm: false, custom_progress: nil, no_mouse_click: nil) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 71
def ajax_delete(name, options, html_options, target, sub_class: nil, replace_response: false, no_confirm: false, custom_progress: nil, no_mouse_click: nil)
  ajax_options = {
    'data-ajax-delete' => true,
    'data-ajax-target' => target
  }
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
  ajax_options.merge!('data-replace-response' => true) if replace_response
  ajax_options.merge!('data-no-confirm' => true) if no_confirm
  ajax_options.merge!('data-custom-progress' => custom_progress) if custom_progress.present?
  ajax_options.merge!('data-no-mouse-click' => no_mouse_click) if no_mouse_click.present?
  link_to(name,
          options,
          html_options.merge(ajax_options))
end
ajax_form_attrs(target, sub_class: nil, insert_method: nil, error_target: nil, remove_on_success: nil, empty_on_success: nil, reset_on_success: nil, no_mouse_click: nil, progress_target: nil, progress_color: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil, mask_target: nil, mask_message: nil ) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 142
def ajax_form_attrs(target, sub_class: nil,
  insert_method: nil, error_target: nil, remove_on_success: nil,
  empty_on_success: nil, reset_on_success: nil, no_mouse_click: nil,
  progress_target: nil, progress_color: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil,
  mask_target: nil, mask_message: nil )
  data_attrs = "data-ajax-form=true data-ajax-target=#{target}"
  data_attrs += " data-insert-method=#{insert_method}" if insert_method
  data_attrs += " data-sub-type=#{sub_class}" if sub_class
  data_attrs += " data-empty-on-success=#{empty_on_success}" if empty_on_success
  data_attrs += " data-remove-on-success=#{remove_on_success}" if remove_on_success
  data_attrs += " data-reset-on-success=#{reset_on_success}" if reset_on_success
  data_attrs += " data-error-target=#{error_target}" if error_target
  data_attrs += " data-no-mouse-click=#{no_mouse_click}" if no_mouse_click
  data_attrs += " data-progress-target=#{progress_target}" if progress_target
  data_attrs += " data-progress-color=#{progress_color}" if progress_color
  data_attrs += " data-mask-target=#{mask_target}" if mask_target
  data_attrs += " data-mask-message=#{mask_message}" if mask_message
  data_attrs += " data-scroll-to=#{scroll_to}" if scroll_to
  data_attrs += " data-scroll-center=true" if scroll_center
  data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
  data_attrs += " data-push-path=#{push_path}" if push_path
  data_attrs
end
ajax_form_hash(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil, container: nil, custom_progress: nil, no_mouse_click: nil, mask_target: nil, mask_message: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil, progress_target: nil, progress_color: nil) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 86
def ajax_form_hash(target, sub_class: nil, insert_method: nil,
  error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
  container: nil, custom_progress: nil, no_mouse_click: nil,
  mask_target: nil, mask_message: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil,
  progress_target: nil, progress_color: nil)
  ajax_options = {
    'data-ajax-form' => true,
    'data-ajax-target' => target
  }
  ajax_options.merge!('data-insert-method' => insert_method) if insert_method.present?
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
  ajax_options.merge!('data-container' => container) if container.present?
  ajax_options.merge!('data-error-target' => error_target) if error_target.present?
  ajax_options.merge!('data-empty-on-success' => empty_on_success) if empty_on_success.present?
  ajax_options.merge!('data-remove-on-success' => remove_on_success) if remove_on_success.present?
  ajax_options.merge!('data-reset-on-success' => reset_on_success) if reset_on_success.present?
  ajax_options.merge!('data-custom-progress' => custom_progress) if custom_progress.present?
  ajax_options.merge!('data-no-mouse-click' => no_mouse_click) if no_mouse_click.present?
  ajax_options.merge!('data-progress-target' => progress_target) if progress_target.present?
  ajax_options.merge!('data-progress-color' => progress_color) if progress_color.present?
  ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
  ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
  ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
  ajax_options.merge!('data-scroll-center' => true) if scroll_center.present?
  ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
  ajax_options.merge!('data-push-path' => push_path) if push_path.present?
  ajax_options
end
ajax_form_now(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil, container: nil, custom_progress: nil, mask_target: nil, mask_message: nil, replacement_path: nil, push_path: nil, progress_target: nil, progress_color: nil) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 115
def ajax_form_now(target, sub_class: nil,
  insert_method: nil, error_target: nil,
  empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
  container: nil, custom_progress: nil,
  mask_target: nil, mask_message: nil, replacement_path: nil, push_path: nil,
  progress_target: nil, progress_color: nil)
  ajax_options = {
    'data-ajax-form-now' => true,
    'data-ajax-target' => target
  }
  ajax_options.merge!('data-insert-method' => insert_method) if insert_method.present?
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
  ajax_options.merge!('data-container' => container) if container.present?
  ajax_options.merge!('data-error-target' => error_target) if error_target.present?
  ajax_options.merge!('data-empty-on-success' => empty_on_success) if empty_on_success.present?
  ajax_options.merge!('data-remove-on-success' => remove_on_success) if remove_on_success.present?
  ajax_options.merge!('data-reset-on-success' => reset_on_success) if reset_on_success.present?
  ajax_options.merge!('data-custom-progress' => custom_progress) if custom_progress.present?
  ajax_options.merge!('data-progress-target' => progress_target) if progress_target.present?
  ajax_options.merge!('data-progress-color' => progress_color) if progress_color.present?
  ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
  ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
  ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
  ajax_options.merge!('data-push-path' => push_path) if push_path.present?
  ajax_options
end
ajax_form_now_attrs(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil, progress_target: nil, progress_color: nil, replacement_path: nil, push_path: nil, mask_target: nil, mask_message: nil ) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 166
def ajax_form_now_attrs(target, sub_class: nil,
  insert_method: nil, error_target: nil,
  empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
  progress_target: nil, progress_color: nil, replacement_path: nil, push_path: nil,
  mask_target: nil, mask_message: nil )
  data_attrs = "data-ajax-form-now=true data-ajax-target=#{target}"
  data_attrs += " data-insert-method=#{insert_method}" if insert_method
  data_attrs += " data-sub-type=#{sub_class}" if sub_class
  data_attrs += " data-empty-on-success=#{empty_on_success}" if empty_on_success
  data_attrs += " data-remove-on-success=#{remove_on_success}" if remove_on_success
  data_attrs += " data-reset-on-success=#{reset_on_success}" if reset_on_success
  data_attrs += " data-error-target=#{error_target}" if error_target
  data_attrs += " data-progress-target=#{progress_target}" if progress_target
  data_attrs += " data-progress-color=#{progress_color}" if progress_color
  data_attrs += " data-mask-target=#{mask_target}" if mask_target
  data_attrs += " data-mask-message=#{mask_message}" if mask_message
  data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
  data_attrs += " data-push-path=#{push_path}" if push_path
  data_attrs
end
dom_target(resource, label = nil) click to toggle source
# File lib/thin_man/ajax_helper.rb, line 237
def dom_target(resource, label = nil)
  '#' + dom_id(resource, label)
end