wco_models 3.1.0.90 → 3.1.0.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/wco/unsubscribes_controller.rb +40 -0
  3. data/app/mailers/wco_email/application_mailer.rb +15 -14
  4. data/app/models/wco/lead.rb +10 -0
  5. data/app/models/wco/leadset.rb +4 -0
  6. data/app/models/wco_email/context.rb +1 -1
  7. data/app/models/wco_email/email_template.rb +1 -1
  8. data/app/models/wco_email/message_stub.rb +2 -3
  9. data/app/views/wco_email/application_mailer/_footer_unsubscribe.html.erb +24 -0
  10. data/app/views/wco_email/application_mailer/_header_logo.html.erb +12 -0
  11. data/app/views/wco_email/email_layouts/_m20221201react.html.erb +1202 -0
  12. data/app/views/wco_email/email_layouts/_m20221222merryxmas.html.erb +766 -0
  13. data/app/views/wco_email/email_layouts/_m202309_feedback.html.erb +1161 -0
  14. data/app/views/wco_email/email_layouts/_m202309_ror4.html.erb +1068 -0
  15. data/app/views/wco_email/email_layouts/_marketing_node_1.html.erb +984 -0
  16. data/app/views/wco_email/email_layouts/_marketing_react_1.html +0 -0
  17. data/app/views/wco_email/email_layouts/_marketing_react_2.html.erb +749 -0
  18. data/app/views/wco_email/email_layouts/_marketing_react_3.html.erb +628 -0
  19. data/app/views/wco_email/email_layouts/_marketing_ror_1.html +751 -0
  20. data/app/views/wco_email/email_layouts/_marketing_ror_2.html.erb +755 -0
  21. data/app/views/wco_email/email_layouts/_marketing_ror_3.html.erb +25 -0
  22. data/app/views/wco_email/email_layouts/_marketing_ror_4.html.erb +25 -0
  23. data/app/views/wco_email/email_layouts/_marketing_ror_5.html.erb +17 -0
  24. data/app/views/wco_email/email_layouts/_marketing_wordpress_1.html +0 -0
  25. data/app/views/wco_email/email_layouts/_marketing_wordpress_2.html +0 -0
  26. data/app/views/wco_email/email_layouts/_piousbox_roundborders.html.erb +1007 -0
  27. data/app/views/wco_email/email_layouts/_plain.haml +18 -0
  28. data/app/views/wco_email/email_layouts/_rec_resume_shared_with_you.html.erb +39 -0
  29. data/app/views/wco_email/email_layouts/_slug-1.html.erb +0 -0
  30. data/app/views/wco_email/email_layouts/_slug-2.html.erb +0 -0
  31. data/app/views/wco_email/email_layouts/_slug-3.html.erb +0 -0
  32. data/app/views/wco_email/email_layouts/_test_tracking_footer.haml +12 -0
  33. data/app/views/wco_email/email_layouts/_wasyaco_roundborders.html.erb +686 -0
  34. data/app/views/wco_email/unsubscribes/_header.haml +4 -0
  35. data/app/views/wco_email/unsubscribes/_table.haml +22 -0
  36. data/config/routes.rb +2 -0
  37. metadata +29 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7d502c6769f16c3fee34412c86b5646aa84c22c9c399da8c56cc2b496aa96b4
4
- data.tar.gz: a4d4fef5edd8dea9656e2526b60b8c6b2a421e1955bc4c79dc1f04dfd4402d40
3
+ metadata.gz: c267b89943c2cb18139bdd044522d142fca56a81cadd7930b21eec7f6349d813
4
+ data.tar.gz: 42c005b73cdb2d15d3157b2d485a57166519a594383caf5a959400c18ae693cb
5
5
  SHA512:
6
- metadata.gz: 4fbd26066c57cc0796a23dbb647b59816553fd87d6dbf87bc56bc0e6aa2d6039e017c6bd204519d4f4fff85c668a020e13558a52ec0e6d708941b9e369e5dd79
7
- data.tar.gz: 951707c1098329b6df362e3050c02e5d0310021e9ebc7b1bc50d41096d1ab7f79bce5382db6610875953ce12846a17b9b3db0e25f03ad7e7375fd17e0d606240
6
+ metadata.gz: 77f0973a4e5ecddd767b045a6c77a5ba6b1dc98eacef09931fbc71413143f5966a3104fa763526f61b0f4a96029b082b025918423146e8703c434469455e74a5
7
+ data.tar.gz: 564da09016bf7490ad15c0c394d15ffb1b453f610536dc4bd9f0cafb8fa8e855f6d7a66c999c5e7f75c4347157ec3a1cbe5e99d77a6dac1809555fe89757e6e0
@@ -0,0 +1,40 @@
1
+
2
+
3
+ class Wco::UnsubscribesController < WcoEmail::ApplicationController
4
+
5
+ def create
6
+ authorize! :open_permission, Wco
7
+ @lead = Wco::Lead.find params[:lead_id]
8
+
9
+ if( !params[:token] ||
10
+ @lead.unsubscribe_token != params[:token] )
11
+ render code: 400, message: "We're sorry, but something went wrong. Please try again later."
12
+ return
13
+ end
14
+
15
+ @unsubscribe = WcoEmail::Unsubscribe.find_or_create_by({
16
+ lead_id: params[:lead_id],
17
+ template_id: params[:template_id],
18
+ campaign_id: params[:campaign_id],
19
+ })
20
+ flag = @unsubscribe.update_attributes({
21
+ unsubscribed_at: Time.now,
22
+ })
23
+ if flag
24
+ flash_notice "You have been unsubscribed."
25
+ else
26
+ flash_alert "We're sorry, but something went wrong. Please try again later."
27
+ end
28
+
29
+ render layout: false
30
+ end
31
+
32
+ def index
33
+ authorize! :index, WcoEmail::Unsubscribe
34
+ @unsubscribes = WcoEmail::Unsubscribe.all
35
+
36
+ render '_table'
37
+ end
38
+
39
+ end
40
+
@@ -6,15 +6,6 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
6
6
 
7
7
  layout 'mailer'
8
8
 
9
- def self.renderer ctx:
10
- out = self.new
11
- out.instance_variable_set( :@ctx, ctx )
12
- out.instance_variable_set( :@lead, ctx.lead )
13
- out.instance_variable_set( :@utm_tracking_str, ctx.utm_tracking_str )
14
- out.instance_variable_set( :@unsubscribe_url, ctx.unsubscribe_url )
15
- out.instance_variable_set( :@config, ctx.config )
16
- return out
17
- end
18
9
 
19
10
  def forwarder_notify msg_id
20
11
  @msg = WcoEmail::Message.find msg_id
@@ -53,13 +44,11 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
53
44
  mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
54
45
  end
55
46
 
56
- ## 2023-04-02 _vp_ Continue.
57
- ## 2023-09-24 _vp_ Continue : )
58
- ## 2024-01-17 _vp_ Continue : )
47
+
59
48
  def send_context_email ctx_id
60
49
  @ctx = Ctx.find ctx_id
61
- renderer = self.class.renderer ctx: @ctx
62
- rendered_str = renderer.render_to_string("/wco_email/email_templates/_#{@ctx.tmpl.layout}")
50
+ @renderer = self.class.renderer ctx: @ctx
51
+ rendered_str = @renderer.render_to_string("/wco_email/email_layouts/_#{@ctx.tmpl.layout}")
63
52
  @ctx.update({
64
53
  rendered_str: rendered_str,
65
54
  })
@@ -73,4 +62,16 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
73
62
  content_type: "text/html" )
74
63
  end
75
64
 
65
+
66
+ def self.renderer ctx:
67
+ out = self.new
68
+ out.instance_variable_set( :@ctx, ctx )
69
+ out.instance_variable_set( :@lead, ctx.lead )
70
+ out.instance_variable_set( :@utm_tracking_str, ctx.utm_tracking_str )
71
+ out.instance_variable_set( :@unsubscribe_url, ctx.unsubscribe_url )
72
+ out.instance_variable_set( :@config, ctx.config )
73
+ out.instance_variable_set( :@renderer, out )
74
+ return out
75
+ end
76
+
76
77
  end
@@ -19,6 +19,16 @@ class Wco::Lead
19
19
  domain = email.split('@')[1]
20
20
  self.leadset ||= Wco::Leadset.find_or_create_by({ company_url: domain })
21
21
  end
22
+ before_validation :normalize_email, on: :create
23
+ def normalize_email
24
+ self[:email] = email.downcase
25
+ if email.index('+')
26
+ a = email
27
+ a.slice!( a[a.index('+')...a.index('@')] )
28
+ self[:email] = a
29
+ end
30
+ end
31
+
22
32
 
23
33
  has_one :photo, class_name: 'Wco::Photo'
24
34
 
@@ -8,6 +8,10 @@ class Wco::Leadset
8
8
  field :company_url
9
9
  validates :company_url, presence: true, uniqueness: true
10
10
  index({ company_url: 1 }, { unique: true, name: 'company_url' })
11
+ before_validation :normalize_company_url, on: :create
12
+ def normalize_company_url
13
+ company_url.downcase!
14
+ end
11
15
 
12
16
  field :email
13
17
  index({ email: 1 }, { name: 'email' })
@@ -123,7 +123,7 @@ class WcoEmail::Context
123
123
  end
124
124
 
125
125
  def unsubscribe_url
126
- WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
126
+ Wco::Engine.routes.url_helpers.unsubscribes_url({
127
127
  host: Rails.application.routes.default_url_options[:host],
128
128
  lead_id: lead_id,
129
129
  template_id: tmpl.id,
@@ -31,7 +31,7 @@ class WcoEmail::EmailTemplate
31
31
  marketing_wordpress_2
32
32
  piousbox_roundborders
33
33
  plain
34
- tracking_footer
34
+ test_tracking_footer
35
35
  wasyaco_roundborders |
36
36
 
37
37
  field :subject
@@ -87,8 +87,8 @@ class WcoEmail::MessageStub
87
87
  ## Leadset, Lead
88
88
  from = the_mail.from ? the_mail.from[0] : "nobody@unknown-doma.in"
89
89
  domain = from.split('@')[1]
90
- leadset = Wco::Leadset.where( company_url: domain ).first
91
- leadset ||= Wco::Leadset.create( company_url: domain, email: from )
90
+ leadset = Wco::Leadset.where( company_url: domain.downcase ).first
91
+ leadset ||= Wco::Leadset.create( company_url: domain.downcase, email: from.downcase )
92
92
  lead = Wco::Lead.find_or_create_by( email: from, leadset: leadset )
93
93
 
94
94
 
@@ -152,7 +152,6 @@ class WcoEmail::MessageStub
152
152
  puts! @message.errors.full_messages.join(", "), "Could not save @message"
153
153
  end
154
154
 
155
-
156
155
  conv.leads.push lead
157
156
  conv.save
158
157
 
@@ -0,0 +1,24 @@
1
+ <table align="left" border="0" cellpadding="0" cellspacing="0"
2
+ style="max-width:100%; min-width:100%;" width="100%"
3
+ class="mcnTextContentContainer">
4
+ <tbody>
5
+ <tr>
6
+
7
+ <td valign="top" class="mcnTextContent"
8
+ style="padding-top:0; padding-right:160px; padding-bottom:9px; padding-left:160px;">
9
+
10
+ <em>Copyright © Wasya Co</em><br><br>
11
+
12
+ <strong>Our mailing address is:</strong><br>
13
+
14
+ 201 W 5th St 11th Floor, Austin, TX 78701<br><br>
15
+
16
+ Want to change how you receive these emails? You can
17
+ <% # link_to( 'update your preferences', obfuscate( user_dashboard_url ) ) + ' or ' %>
18
+ <%= link_to 'unsubscribe from this list', obfuscate( @unsubscribe_url ) %>.<br><br>
19
+
20
+ </td>
21
+
22
+ </tr>
23
+ </tbody>
24
+ </table>
@@ -0,0 +1,12 @@
1
+
2
+ <table cellpadding="0" cellspacing="0" width="100%">
3
+ <tr>
4
+ <td align="center">
5
+ <br />
6
+ <img
7
+ src="https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2022/09/29185755/259x66-WasyaCo-Logo-YellowShadow.png"
8
+ alt="Wasya Co [logo]" />
9
+ </td>
10
+ </tr>
11
+ </table>
12
+ <br /><br />