app/helpers/bmc/button_helper.rb in bmc-1.4.3 vs app/helpers/bmc/button_helper.rb in bmc-1.5.0
- old
+ new
@@ -7,10 +7,18 @@
end
def default_style
@default_style ||= :outline_primary
end
+
+ def confirm_attribute
+ @confirm_attribute ||= :"data-turbo-confirm"
+ end
+
+ def method_attribute
+ @method_attribute ||= :"data-turbo-method"
+ end
end
def bs_button( # rubocop:disable Metrics/ParameterLists
url,
method: :get,
@@ -28,11 +36,16 @@
text = ta(action) if text.nil? && action
content = fa_s(icon).concat(" ").concat(tag.span(text, class: "text"))
if method != :get
- options[:method] = method
+ if helper == :link_to
+ options[BMC::ButtonHelper.method_attribute] = method
+ options[:rel] = "nofollow"
+ elsif helper == :button_to
+ options[:method] = method
+ end
confirm = true if confirm.nil?
end
unless options[:class]
options[:class] = [
@@ -46,10 +59,10 @@
options[:title] = title
unless confirm.nil?
confirm = ta(:confirm) if confirm == true
- options.deep_merge!(data: {confirm: confirm})
+ options[BMC::ButtonHelper.confirm_attribute] = confirm
end
public_send(helper, content, url, options.sort.to_h)
end