36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/phlexible/rails/button_to_concerns.rb', line 36
def view_template(&block)
action = url_for(@url)
@options = DEFAULT_OPTIONS.merge((@options || {}).symbolize_keys)
method = (@options.delete(:method).presence || method_for_options(@options)).to_s
form_method = method == 'get' ? 'get' : 'post'
form action: action, method: form_method, **form_attributes do
method_tag method
form_method == 'post' && token_input(action, method.empty? ? 'post' : method)
param_inputs
block_given? ? button(**button_attrs, &block) : button(**button_attrs) { @name }
end
end
|