Module: Coco::UrlHelper
- Includes:
- ActionView::Helpers::UrlHelper
- Included in:
- Helpers
- Defined in:
- app/helpers/coco/url_helper.rb
Instance Method Summary collapse
- #coco_button_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #coco_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
Instance Method Details
#coco_button_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/coco/url_helper.rb', line 19 def (name = nil, = nil, = nil, &block) , = , name if block ||= {} ||= {} .symbolize_keys! = Coco::App::Elements::ButtonTo.new(action: , type: :submit, **) = .with_content(name) unless block render(, &block) end |
#coco_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/coco/url_helper.rb', line 5 def coco_link_to(name = nil, = nil, = nil, &block) , , name = , name, block if block ||= {} = Coco::ActionViewHelper.(, ) href = Coco::ActionViewHelper.url_target(name, ) if block coco_link(href, **.symbolize_keys!, &block) else coco_link(name, href, **.symbolize_keys!) end end |