Sha256: a8fbecf7a0892200fbb7a6e0856ff411deeef51c3a5a1768839b25d0a9c1884e

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

module WorkingHelpers
  include BootstrapBuilders::ApplicationHelpers

  def t(key)
    key
  end

  def link_to(*opts)
    title = opts.shift if !opts.first.is_a?(Hash) && ((opts.length == 2 && !opts.last.is_a?(Hash)) || (opts.length == 3))
    url = opts.shift unless opts.first.is_a?(Hash)
    title ||= yield if block_given?

    attrs = opts.shift || {}
    attrs[:href] = url

    classes = attrs.delete(:class)

    HtmlGen::Element.new(:a, classes: classes, attr: attrs, str_html: title).html
  end

  def content_tag(*opts)
    tag_name = opts.shift

    content = opts.shift if opts.length >= 2
    content = yield if block_given?

    attrs = opts.shift

    classes = attrs.delete(:class)

    HtmlGen::Element.new(tag_name, classes: classes, attr: attrs, str_html: content).html
  end
end

class String
  def html_safe
    self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_builders-0.0.3 spec/support/working_helpers.rb
bootstrap_builders-0.0.2 spec/support/working_helpers.rb