aboutsummaryrefslogtreecommitdiff
path: root/source/_helpers.rb
diff options
context:
space:
mode:
authorB Mathis <brandon@imathis.com>2009-11-12 14:13:51 -0600
committerB Mathis <brandon@imathis.com>2009-11-12 14:13:51 -0600
commitc51a1be7f9d186f4d5ebd4fd390526c9ace64abe (patch)
tree4f58ff599441610afb766b492d4ef1750c4fad64 /source/_helpers.rb
parent0ac4eca1d49103b17d1dc2a37e1c6c6f7845ef9d (diff)
downloadmy_new_personal_website-c51a1be7f9d186f4d5ebd4fd390526c9ace64abe.tar.xz
my_new_personal_website-c51a1be7f9d186f4d5ebd4fd390526c9ace64abe.zip
cleaned up helpers
Diffstat (limited to '')
-rw-r--r--source/_helpers.rb52
1 files changed, 0 insertions, 52 deletions
diff --git a/source/_helpers.rb b/source/_helpers.rb
index e7987dc5..2eca937c 100644
--- a/source/_helpers.rb
+++ b/source/_helpers.rb
@@ -85,49 +85,6 @@ module Helpers
content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
end
- def mail_to(email_address, name = nil, html_options = {})
- html_options = html_options.stringify_keys
- encode = html_options.delete("encode").to_s
- cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
-
- string = ''
- extras = ''
- extras << "cc=#{CGI.escape(cc).gsub("+", "%20")}&" unless cc.nil?
- extras << "bcc=#{CGI.escape(bcc).gsub("+", "%20")}&" unless bcc.nil?
- extras << "body=#{CGI.escape(body).gsub("+", "%20")}&" unless body.nil?
- extras << "subject=#{CGI.escape(subject).gsub("+", "%20")}&" unless subject.nil?
- extras = "?" << extras.gsub!(/&?$/,"") unless extras.empty?
-
- email_address = email_address.to_s
-
- email_address_obfuscated = email_address.dup
- email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.has_key?("replace_at")
- email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.has_key?("replace_dot")
-
- if encode == "javascript"
- "document.write('#{content_tag("a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');".each_byte do |c|
- string << sprintf("%%%x", c)
- end
- "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>"
- elsif encode == "hex"
- email_address_encoded = ''
- email_address_obfuscated.each_byte do |c|
- email_address_encoded << sprintf("&#%d;", c)
- end
-
- protocol = 'mailto:'
- protocol.each_byte { |c| string << sprintf("&#%d;", c) }
-
- email_address.each_byte do |c|
- char = c.chr
- string << (char =~ /\w/ ? sprintf("%%%x", c) : char)
- end
- content_tag "a", name || email_address_encoded, html_options.merge({ "href" => "#{string}#{extras}" })
- else
- content_tag "a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" })
- end
- end
-
private
def cdata_section(content)
@@ -156,15 +113,6 @@ module Helpers
# My added helpers
- def to_html_email(address)
- email = string_to_html(address)
- "<a href=\"#{string_to_html('mailto:')}#{email}\">#{email}</a>"
- end
-
- def string_to_html(s)
- s.strip.unpack("C*").map{|ch| "&#" + ch.to_s + ";" }.to_s
- end
-
def show_part (file)
data = ''
f = File.open(Dir.pwd+"/source/"+file)