app/helpers/coco/url_helper.rb in coveragebook_components-0.7.2 vs app/helpers/coco/url_helper.rb in coveragebook_components-0.7.3
- old
+ new
@@ -3,30 +3,24 @@
include ActionView::Helpers::UrlHelper
def coco_link_to(name = nil, options = nil, html_options = nil, &block)
html_options, options, name = options, name, block if block
options ||= {}
-
html_options = Coco::ActionViewHelper.convert_options_to_data_attributes(options, html_options)
- html_options[:classes] = html_options[:class]
- html_options.delete(:class)
href = Coco::ActionViewHelper.url_target(name, options)
- link = Coco::App::Elements::Link.new(href: href, **html_options.symbolize_keys!)
- link = link.with_content(name) unless block
-
- render(link, &block)
+ coco_link(name, href, **html_options.symbolize_keys!, &block)
end
- def coco_button_to(content = nil, options = nil, html_options = nil, &block)
- html_options, options = options, content if block
+ def coco_button_to(name = nil, options = nil, html_options = nil, &block)
+ html_options, options = options, name if block
options ||= {}
html_options ||= {}
+ html_options.symbolize_keys!
- button = Coco::App::Elements::FormButton.new(action: options, **html_options.symbolize_keys!)
- button = button.with_content(content) unless block
-
+ button = Coco::App::Elements::ButtonTo.new(action: options, type: :submit, **html_options)
+ button = button.with_content(name) unless block
render(button, &block)
end
end
end