# This module provides a Rails helper that will create tel: style # anchor tags in a similar fashion as to how the link_to Rails # helper operates # # Copyright (C) 2014 Turn4 LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . module PhoneLinkHelper def link_to_phone(text, options = {}, &blk) return "" if text.blank? number = number_to_phone(text, delimiter: options.fetch(:delimiter, '-')) href = "tel:#{number_to_phone(text, country_code:1)}" if block_given? link_to href, &blk else link_to number, href end end end