Sha256: 7bc8456c1bc01032c07a9e303437df87415fc7a39683f129f3c3f451ac70025c

Contents?: true

Size: 987 Bytes

Versions: 17

Compression:

Stored size: 987 Bytes

Contents

module Coco
  module UrlHelper
    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)

      href = Coco::ActionViewHelper.url_target(name, options)

      if block
        coco_link(href, **html_options.symbolize_keys!, &block)
      else
        coco_link(name, href, **html_options.symbolize_keys!)
      end
    end

    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::ButtonTo.new(action: options, type: :submit, **html_options)
      button = button.with_content(name) unless block
      render(button, &block)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
coveragebook_components-0.10.0 app/helpers/coco/url_helper.rb
coveragebook_components-0.9.1 app/helpers/coco/url_helper.rb
coveragebook_components-0.9.0 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.9 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.8 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.7 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.6 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.5 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.4 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.3 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.2 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.1 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.0 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.0.beta.3 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.0.beta.2 app/helpers/coco/url_helper.rb
coveragebook_components-0.8.0.beta.1 app/helpers/coco/url_helper.rb
coveragebook_components-0.7.10 app/helpers/coco/url_helper.rb