no_notifier_needed 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.4.1
@@ -65,19 +65,24 @@ class Notifier < ActionMailer::Base
65
65
  if link.match(/http:|https:\/\/[\w*\.]*\//i)
66
66
  root_link = link
67
67
  else
68
- splitter = NoNotifierNeeded.send(:host).split('/').last
69
-
70
- link_broken = link.split(splitter).last
71
- link_broken = link_broken.split('/').reject{|e| e.blank?}.join('/')
72
- if NoNotifierNeeded.send(:host).last == "/"
73
- root_link = NoNotifierNeeded.send(:host) + link_broken
74
- else
75
- root_link = NoNotifierNeeded.send(:host) + "/" + link_broken
76
- end
68
+ root_link = email_href_for(link)
77
69
  end
78
70
  "<a href='#{root_link}' #{html_opts(opts)}>#{title}</a>"
79
71
  end
80
72
 
73
+ def email_href_for(link)
74
+ splitter = NoNotifierNeeded.send(:host).split('/').last
75
+
76
+ link_broken = link.split(splitter).last
77
+ link_broken = link_broken.split('/').reject{|e| e.blank?}.join('/')
78
+ if NoNotifierNeeded.send(:host).last == "/"
79
+ root_link = NoNotifierNeeded.send(:host) + link_broken
80
+ else
81
+ root_link = NoNotifierNeeded.send(:host) + "/" + link_broken
82
+ end
83
+ root_link + utm_params
84
+ end
85
+
81
86
  def html_opts(opts)
82
87
  to_ret = []
83
88
  opts.each do |k,v|
@@ -86,4 +91,13 @@ class Notifier < ActionMailer::Base
86
91
  to_ret.join(" ")
87
92
  end
88
93
 
94
+ def utm_params(utm)
95
+ return "" unless @template.respond_to?(:utm_params)
96
+ utm = @template.utm_params
97
+ to_ret = utm if utm.is_a?(String)
98
+ to_ret = utm.join("&") if utm.is_a?(Array)
99
+ to_ret = utm.collect { |k,v| "#{k}=#{v}"}.join("&")
100
+ return "?" + to_ret
101
+ end
102
+
89
103
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "no_notifier_needed"
8
- s.version = "2.4.0"
8
+ s.version = "2.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robert R. Meyer"]
12
- s.date = "2013-07-19"
12
+ s.date = "2013-07-30"
13
13
  s.description = "A work in progress: Replace ActionMailer::Base class redundency. Temlating using haml or erb."
14
14
  s.email = "Blue.Dog.Archolite@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no_notifier_needed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml