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(content = 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(content = nil, options = nil, html_options = nil, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/coco/url_helper.rb', line 21 def (content = nil, = nil, = nil, &block) , = , content if block ||= {} ||= {} = Coco::App::Elements::FormButton.new(action: , **) = .with_content(content) 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 18 19 |
# 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.(, ) [:classes] = [:class] .delete(:class) href = Coco::ActionViewHelper.url_target(name, ) link = Coco::Link::Component.new(href: href, **) link = link.with_content(name) unless block render(link, &block) end |