wco_models 3.1.0.89 → 3.1.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/utils.scss +5 -1
- data/app/controllers/wco/application_controller.rb +6 -0
- data/app/controllers/wco/leadsets_controller.rb +1 -1
- data/app/controllers/wco/unsubscribes_controller.rb +40 -0
- data/app/mailers/wco_email/application_mailer.rb +15 -27
- data/app/models/wco/lead.rb +10 -0
- data/app/models/wco/leadset.rb +4 -0
- data/app/models/wco_email/context.rb +26 -8
- data/app/models/wco_email/email_template.rb +1 -1
- data/app/models/wco_email/message_stub.rb +2 -3
- data/app/views/wco/application/tinymce.html.erb +33 -0
- data/app/views/wco_email/application_mailer/_footer_unsubscribe.html.erb +24 -0
- data/app/views/wco_email/application_mailer/_header_logo.html.erb +12 -0
- data/app/views/wco_email/email_layouts/_m20221201react.html.erb +1202 -0
- data/app/views/wco_email/email_layouts/_m20221222merryxmas.html.erb +766 -0
- data/app/views/wco_email/email_layouts/_m202309_feedback.html.erb +1161 -0
- data/app/views/wco_email/email_layouts/_m202309_ror4.html.erb +1068 -0
- data/app/views/wco_email/email_layouts/_marketing_node_1.html.erb +984 -0
- data/app/views/wco_email/email_layouts/_marketing_react_1.html +0 -0
- data/app/views/wco_email/email_layouts/_marketing_react_2.html.erb +749 -0
- data/app/views/wco_email/email_layouts/_marketing_react_3.html.erb +628 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_1.html +751 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_2.html.erb +755 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_3.html.erb +25 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_4.html.erb +25 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_5.html.erb +17 -0
- data/app/views/wco_email/email_layouts/_marketing_wordpress_1.html +0 -0
- data/app/views/wco_email/email_layouts/_marketing_wordpress_2.html +0 -0
- data/app/views/wco_email/email_layouts/_piousbox_roundborders.html.erb +1007 -0
- data/app/views/wco_email/email_layouts/_plain.haml +18 -0
- data/app/views/wco_email/email_layouts/_rec_resume_shared_with_you.html.erb +39 -0
- data/app/views/wco_email/email_layouts/_slug-1.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_slug-2.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_slug-3.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_test_tracking_footer.haml +12 -0
- data/app/views/wco_email/email_layouts/_wasyaco_roundborders.html.erb +686 -0
- data/app/views/wco_email/unsubscribes/_header.haml +4 -0
- data/app/views/wco_email/unsubscribes/_table.haml +22 -0
- data/config/routes.rb +2 -0
- metadata +31 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c267b89943c2cb18139bdd044522d142fca56a81cadd7930b21eec7f6349d813
|
|
4
|
+
data.tar.gz: 42c005b73cdb2d15d3157b2d485a57166519a594383caf5a959400c18ae693cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77f0973a4e5ecddd767b045a6c77a5ba6b1dc98eacef09931fbc71413143f5966a3104fa763526f61b0f4a96029b082b025918423146e8703c434469455e74a5
|
|
7
|
+
data.tar.gz: 564da09016bf7490ad15c0c394d15ffb1b453f610536dc4bd9f0cafb8fa8e855f6d7a66c999c5e7f75c4347157ec3a1cbe5e99d77a6dac1809555fe89757e6e0
|
|
@@ -37,7 +37,7 @@ class Wco::LeadsetsController < Wco::ApplicationController
|
|
|
37
37
|
authorize! :index, Leadset
|
|
38
38
|
@leadsets = Leadset.all.includes(:leads)
|
|
39
39
|
if params[:q].present?
|
|
40
|
-
@leadsets = @leadsets.where(
|
|
40
|
+
@leadsets = @leadsets.where({ company_url: /.*#{params[:q]}.*/i })
|
|
41
41
|
if @leadsets.length == 1
|
|
42
42
|
return redirect_to action: :show, id: @leadsets[0][:id]
|
|
43
43
|
end
|
|
@@ -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
|
+
|
|
@@ -44,35 +44,11 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
|
44
44
|
mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
## 2023-09-24 _vp_ Continue : )
|
|
47
|
+
|
|
49
48
|
def send_context_email ctx_id
|
|
50
49
|
@ctx = Ctx.find ctx_id
|
|
51
|
-
@
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
@utm_tracking_str = {
|
|
55
|
-
'cid' => @ctx.lead_id,
|
|
56
|
-
'utm_campaign' => @ctx.tmpl.slug,
|
|
57
|
-
'utm_medium' => 'email',
|
|
58
|
-
'utm_source' => @ctx.tmpl.slug,
|
|
59
|
-
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
60
|
-
|
|
61
|
-
@unsubscribe_url = WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
|
|
62
|
-
template_id: @ctx.tmpl.id,
|
|
63
|
-
lead_id: @lead.id,
|
|
64
|
-
token: @lead.unsubscribe_token,
|
|
65
|
-
host: Rails.application.routes.default_url_options[:host],
|
|
66
|
-
})
|
|
67
|
-
renderer = WcoEmail::ApplicationMailer.new
|
|
68
|
-
|
|
69
|
-
renderer.instance_variable_set( :@ctx, @ctx )
|
|
70
|
-
renderer.instance_variable_set( :@lead, @ctx.lead )
|
|
71
|
-
renderer.instance_variable_set( :@utm_tracking_str, @utm_tracking_str )
|
|
72
|
-
renderer.instance_variable_set( :@unsubscribe_url, @unsubscribe_url )
|
|
73
|
-
renderer.instance_variable_set( :@tmpl_config, @tmpl_config )
|
|
74
|
-
|
|
75
|
-
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}")
|
|
76
52
|
@ctx.update({
|
|
77
53
|
rendered_str: rendered_str,
|
|
78
54
|
})
|
|
@@ -86,4 +62,16 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
|
86
62
|
content_type: "text/html" )
|
|
87
63
|
end
|
|
88
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
|
+
|
|
89
77
|
end
|
data/app/models/wco/lead.rb
CHANGED
|
@@ -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
|
|
data/app/models/wco/leadset.rb
CHANGED
|
@@ -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' })
|
|
@@ -24,6 +24,7 @@ class WcoEmail::Context
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
field :body
|
|
27
|
+
## Looks good... 2024-01-17
|
|
27
28
|
def body
|
|
28
29
|
if self[:body].presence
|
|
29
30
|
return self[:body]
|
|
@@ -91,14 +92,9 @@ class WcoEmail::Context
|
|
|
91
92
|
attr_reader :tid
|
|
92
93
|
|
|
93
94
|
def get_binding
|
|
94
|
-
@lead
|
|
95
|
-
@utm_tracking_str =
|
|
96
|
-
|
|
97
|
-
'utm_campaign' => tmpl.slug,
|
|
98
|
-
'utm_medium' => 'email',
|
|
99
|
-
'utm_source' => tmpl.slug,
|
|
100
|
-
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
101
|
-
eval( tmpl.config_exe )
|
|
95
|
+
@lead = lead
|
|
96
|
+
@utm_tracking_str = utm_tracking_str
|
|
97
|
+
# eval( tmpl.config_exe ) ## @TODO: remove? 2024-01-17
|
|
102
98
|
binding()
|
|
103
99
|
end
|
|
104
100
|
|
|
@@ -113,6 +109,28 @@ class WcoEmail::Context
|
|
|
113
109
|
outs.to_a
|
|
114
110
|
end
|
|
115
111
|
|
|
112
|
+
def config
|
|
113
|
+
OpenStruct.new JSON.parse( tmpl[:config_json] )
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def utm_tracking_str
|
|
117
|
+
{
|
|
118
|
+
'cid' => lead_id,
|
|
119
|
+
'utm_campaign' => tmpl.slug,
|
|
120
|
+
'utm_medium' => 'email',
|
|
121
|
+
'utm_source' => tmpl.slug,
|
|
122
|
+
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def unsubscribe_url
|
|
126
|
+
Wco::Engine.routes.url_helpers.unsubscribes_url({
|
|
127
|
+
host: Rails.application.routes.default_url_options[:host],
|
|
128
|
+
lead_id: lead_id,
|
|
129
|
+
template_id: tmpl.id,
|
|
130
|
+
token: lead.unsubscribe_token,
|
|
131
|
+
})
|
|
132
|
+
end
|
|
133
|
+
|
|
116
134
|
end
|
|
117
135
|
Ctx = WcoEmail::Context
|
|
118
136
|
|
|
@@ -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,33 @@
|
|
|
1
|
+
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<!-- include libraries(jQuery, bootstrap) -->
|
|
5
|
+
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
|
|
6
|
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
7
|
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|
8
|
+
|
|
9
|
+
<!-- include codemirror (codemirror.css, codemirror.js, xml.js, formatting.js) -->
|
|
10
|
+
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.css">
|
|
11
|
+
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.css">
|
|
12
|
+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
|
|
13
|
+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.js"></script>
|
|
14
|
+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.js"></script>
|
|
15
|
+
|
|
16
|
+
<!-- include summernote css/js-->
|
|
17
|
+
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css">
|
|
18
|
+
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"></script>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<textarea class='tinymce'>
|
|
23
|
+
</textarea>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
$('.tinymce').summernote({
|
|
27
|
+
height: 150, //set editable area's height
|
|
28
|
+
codemirror: { // codemirror options
|
|
29
|
+
theme: 'monokai'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
</body></html>
|
|
@@ -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 />
|