Sha256: 9d4e90895a3dab223c02106c607da27d2c801d51835ab5c830b1f401b5e20e73

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

require 'action_view/helpers'

module ActionView
  module Helpers
    # = Action View Telephone Link Helper
    module TelToHelper
      # Creates a telephone link tag of the given +name+ and +number+. If +nil+
      # is passed as the +number+ the value of the link itself will become the
      # +number+. +html_options+ will be same as +link_to+.
      def tel_to(name = nil, options = nil, html_options = nil, &block)
        number = block_given? ? name : (options || name)
        return if number.blank?
        if block_given?
          link_to("tel:#{number}", options, html_options, &block)
        else
          link_to(name, "tel:#{number}", html_options, &block)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tel_to_helper-0.1.1 lib/action_view/helpers/tel_to_helper.rb
tel_to_helper-0.1.0 lib/action_view/helpers/tel_to_helper.rb