public
Created

  • Download Gist
tel_helper.rb
Ruby
1 2 3 4 5 6 7
module TelHelper
# Erstellt einen <a href="tel:..."> link.
def tel_to(telephone_number, name = nil, html_options = {})
href = html_escape telephone_number.to_s.strip.sub(/\A\+/, '00').gsub(/(\(.+\))/, '').gsub(/[^\d]/, '')
content_tag "a", name || telephone_number, html_options.stringify_keys.merge("href" => "tel:#{href}".html_safe)
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.