Method: Skyline::ButtonHelper#submit_button_to

Defined in:
app/helpers/skyline/button_helper.rb

#submit_button_to(label, options = {}, html_options = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/helpers/skyline/button_helper.rb', line 48

def submit_button_to(label,options={},html_options={})
  
  html_options = html_options.stringify_keys
  disabled = html_options[:disabled]
  convert_boolean_attributes!(html_options, %w( disabled ))

  if method = html_options.delete('method')
    html_options["data-method"] = method
  else
    html_options["data-method"] = "post"
  end
  
  if confirm = html_options.delete("confirm")
    html_options["data-confirm"] = confirm
  end
  
  html_options["data-url"] = options.is_a?(String) ? options : self.url_for(options)
  
  html_options.reverse_merge! :type => "submit"
  
  ("button", button_text(label) ,html_options)
end