Method: Padrino::Helpers::AssetTagHelpers#mail_to
- Defined in:
- padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb
permalink #mail_to(email, caption = nil, mail_options = {}) ⇒ String
Creates a mail link element with given name and caption.
145 146 147 148 149 150 151 |
# File 'padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb', line 145 def mail_to(email, caption=nil, ={}) , = .partition{ |key,_| [:cc, :bcc, :subject, :body].include?(key) } mail_query = Rack::Utils.build_query(Hash[]).gsub(/\+/, '%20').gsub('%40', '@') mail_href = "mailto:#{email}" mail_href << "?#{mail_query}" unless mail_query.empty? link_to((caption || email), mail_href, Hash[]) end |