ish_manager 0.1.8.482 → 0.1.8.483
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ish_manager/email_contexts_controller.rb +7 -6
- data/app/controllers/ish_manager/email_templates_controller.rb +4 -13
- data/app/helpers/ish_manager/application_helper.rb +1 -1
- data/app/mailers/ish_manager/office_mailer.rb +7 -7
- data/app/views/ish_manager/email_actions/_form.haml +1 -0
- data/app/views/ish_manager/email_contexts/edit.haml +1 -0
- data/app/views/ish_manager/email_contexts/index.haml +5 -2
- data/app/views/ish_manager/email_templates/_footer_unsubscribe.html.erb +2 -2
- data/app/views/ish_manager/email_templates/_form.haml +4 -4
- data/app/views/ish_manager/email_templates/_index.haml +8 -7
- data/app/views/ish_manager/email_templates/_m202309_ror4.html.erb +3 -18
- data/lib/tasks/office_tasks.rake +17 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413d410c7b13b3474c6120e08fe190d3c784f278bd12799654ac5c349cf403ae
|
4
|
+
data.tar.gz: 678b35ebae9ab11be5e4836240361102b4fadc86fb449e5a61b7aeab0cc882a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c70237a28212e66ecc12d36f6debcb47d941595f1592278269cfc62e18307218e511e1a436a100a9b54bf812b9cea3fc9b16d27b6a9ee9dec8b16d94e95350c
|
7
|
+
data.tar.gz: 2c257330903133b0e1da36ed4c9c2de560e7ace007cce7a3aadd9aa33562a328ebd04c06a7a6cd8fb72edb7d78f292d6000cb33a82dff48abbe58d2e0fbc61c4
|
@@ -47,9 +47,10 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
47
47
|
@ctx = @email_context = Ish::EmailContext.find params[:id]
|
48
48
|
authorize! :iframe_src, @ctx
|
49
49
|
|
50
|
-
@tmpl
|
51
|
-
@
|
52
|
-
@
|
50
|
+
@tmpl = @email_template = @ctx.email_template
|
51
|
+
@tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
|
52
|
+
@lead = @ctx.lead
|
53
|
+
@body = @ctx.body
|
53
54
|
|
54
55
|
render layout: false
|
55
56
|
end
|
@@ -65,9 +66,9 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
65
66
|
@ctxs = @ctxs.where( lead_id: @lead.id )
|
66
67
|
else
|
67
68
|
if my_truthy? params[:sent]
|
68
|
-
@ctxs = @ctxs.
|
69
|
+
@ctxs = @ctxs.or({ :sent_at.ne => nil }, { :unsubscribed_at.ne => nil })
|
69
70
|
else
|
70
|
-
@ctxs = @ctxs.where( sent_at: nil )
|
71
|
+
@ctxs = @ctxs.where( sent_at: nil, unsubscribed_at: nil )
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
@@ -87,7 +88,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
87
88
|
def send_immediate
|
88
89
|
@ctx = ::Ish::EmailContext.find params[:id]
|
89
90
|
authorize! :do_send, @ctx
|
90
|
-
|
91
|
+
flash_notice 'Sent immediately.'
|
91
92
|
|
92
93
|
out = IshManager::OfficeMailer.send_context_email( @ctx[:id].to_s )
|
93
94
|
Rails.env.production? ? out.deliver_later : out.deliver_now
|
@@ -35,8 +35,9 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
|
|
35
35
|
Ish::EmailTemplate.find_by({ slug: params[:id] })
|
36
36
|
authorize! :iframe_src, @email_template
|
37
37
|
|
38
|
-
@lead
|
39
|
-
@ctx
|
38
|
+
@lead = Lead.find_by({ email: 'poxlovi@gmail.com' })
|
39
|
+
@ctx = Ctx.new({ email_template: @tmpl, lead_id: @lead.id })
|
40
|
+
@tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
|
40
41
|
|
41
42
|
@utm_tracking_str = {
|
42
43
|
'cid' => @ctx.lead_id,
|
@@ -45,21 +46,11 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
|
|
45
46
|
'utm_source' => @ctx.tmpl.slug,
|
46
47
|
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
47
48
|
|
48
|
-
|
49
|
+
@unsubscribe_url = Ishapi::Engine.routes.url_helpers.email_unsubscribes_url({
|
49
50
|
template_id: @ctx.tmpl.id,
|
50
51
|
lead_id: @lead.id,
|
51
52
|
token: @lead.unsubscribe_token,
|
52
53
|
})
|
53
|
-
obf = Office::ObfuscatedRedirect.find_or_create_by({ to: to })
|
54
|
-
@unsubscribe_url = Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
|
55
|
-
|
56
|
-
to = Ishapi::Engine.routes.url_helpers.users_dashboard_url({
|
57
|
-
lead_id: @lead.id,
|
58
|
-
})
|
59
|
-
obf = Office::ObfuscatedRedirect.find_or_create_by({ to: to })
|
60
|
-
@update_preferences_url = Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
|
61
|
-
|
62
|
-
eval( @ctx.tmpl.config_exe )
|
63
54
|
|
64
55
|
render layout: false
|
65
56
|
end
|
@@ -43,7 +43,7 @@ module IshManager
|
|
43
43
|
# return Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
|
44
44
|
# end
|
45
45
|
def obfuscate link
|
46
|
-
|
46
|
+
puts! link, 'obfuscate helper' if DEBUG
|
47
47
|
obf = Office::ObfuscatedRedirect.find_or_create_by({ to: link })
|
48
48
|
return Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
|
49
49
|
end
|
@@ -2,9 +2,11 @@
|
|
2
2
|
class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
3
3
|
|
4
4
|
## 2023-04-02 _vp_ Continue.
|
5
|
+
## 2023-09-24 _vp_ Continue : )
|
5
6
|
def send_context_email ctx_id
|
6
|
-
@ctx
|
7
|
-
@lead
|
7
|
+
@ctx = Ctx.find ctx_id
|
8
|
+
@lead = Lead.find @ctx.lead_id
|
9
|
+
@tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
|
8
10
|
|
9
11
|
@utm_tracking_str = {
|
10
12
|
'cid' => @ctx.lead_id,
|
@@ -13,11 +15,9 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
|
13
15
|
'utm_source' => @ctx.tmpl.slug,
|
14
16
|
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
15
17
|
|
16
|
-
@
|
17
|
-
@origin = "https://#{Rails.application.config.action_mailer.default_url_options[:host]}"
|
18
|
+
# @origin = "https://#{Rails.application.config.action_mailer.default_url_options[:host]}"
|
18
19
|
|
19
20
|
@unsubscribe_url = Ishapi::Engine.routes.url_helpers.email_unsubscribes_url({
|
20
|
-
host: 'text-host-3',
|
21
21
|
template_id: @ctx.tmpl.id,
|
22
22
|
lead_id: @lead.id,
|
23
23
|
token: @lead.unsubscribe_token,
|
@@ -28,13 +28,13 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
|
28
28
|
# renderer.send( :request, { host: 'test-host' } )
|
29
29
|
renderer = IshManager::ApplicationMailer.new
|
30
30
|
|
31
|
-
|
32
31
|
renderer.instance_variable_set( :@ctx, @ctx )
|
33
32
|
renderer.instance_variable_set( :@lead, @ctx.lead )
|
34
33
|
renderer.instance_variable_set( :@utm_tracking_str, @utm_tracking_str )
|
35
34
|
renderer.instance_variable_set( :@unsubscribe_url, @unsubscribe_url )
|
35
|
+
renderer.instance_variable_set( :@tmpl_config, @tmpl_config )
|
36
36
|
|
37
|
-
eval( @ctx.tmpl.config_exe )
|
37
|
+
# eval( @ctx.tmpl.config_exe )
|
38
38
|
|
39
39
|
if 'plain' == @ctx.tmpl.layout
|
40
40
|
rendered_str = ERB.new( @ctx.body ).result( @ctx.get_binding )
|
@@ -4,4 +4,5 @@
|
|
4
4
|
%h2.title
|
5
5
|
Edit email Context
|
6
6
|
= link_to "[view]", email_context_path( @ctx )
|
7
|
+
= button_to 'Send', send_immediate_email_context_path(@ctx), form_class: 'inline', :data => { :confirm => 'Are you sure?' }
|
7
8
|
= render 'ish_manager/email_contexts/form', ctx: @ctx, tmpl: @tmpl
|
@@ -19,7 +19,7 @@
|
|
19
19
|
.W0
|
20
20
|
= render 'paginate', resource: @ctxs, param_name: :ctxs_page, views_prefix: :ish_manager
|
21
21
|
|
22
|
-
%table.bordered
|
22
|
+
%table.bordered.data-table
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th.actions
|
@@ -29,11 +29,12 @@
|
|
29
29
|
%th.template Template
|
30
30
|
%th.send_at Send at
|
31
31
|
%th.sent_at Sent at
|
32
|
+
%th.unsubscribed_at Unsubscribed at
|
32
33
|
%tbody
|
33
34
|
- @ctxs.each do |ctx|
|
34
35
|
%tr
|
35
36
|
%td.actions.padded
|
36
|
-
- if ctx.sent_at
|
37
|
+
- if ctx.sent_at || ctx.unsubscribed_at
|
37
38
|
\--
|
38
39
|
- else
|
39
40
|
= link_to '[~]', edit_email_context_path(ctx)
|
@@ -53,6 +54,8 @@
|
|
53
54
|
.time= pp_time ctx.send_at
|
54
55
|
%td
|
55
56
|
.datetime.padded= pp_date ctx.sent_at
|
57
|
+
%td
|
58
|
+
.datetime.padded= pp_date ctx.unsubscribed_at
|
56
59
|
|
57
60
|
|
58
61
|
= render 'paginate', resource: @ctxs, param_name: :ctxs_page, views_prefix: :ish_manager
|
@@ -14,8 +14,8 @@
|
|
14
14
|
201 W 5th St 11th Floor, Austin, TX 78701<br><br>
|
15
15
|
|
16
16
|
Want to change how you receive these emails? You can
|
17
|
-
|
18
|
-
<%= link_to 'unsubscribe from this list', @unsubscribe_url %>.<br><br>
|
17
|
+
<% # link_to( 'update your preferences', obfuscate( user_dashboard_url ) ) + ' or ' %>
|
18
|
+
<%= link_to 'unsubscribe from this list', obfuscate( @unsubscribe_url ) %>.<br><br>
|
19
19
|
|
20
20
|
</td>
|
21
21
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
.col-md-4
|
16
16
|
.field
|
17
17
|
= f.label "From"
|
18
|
-
= f.select :from_email, options_for_select(Ish::EmailTemplate.from_email_list, selected: email_template.from_email)
|
18
|
+
= f.select :from_email, options_for_select(Ish::EmailTemplate.from_email_list, selected: email_template.from_email), {}, class: 'select2'
|
19
19
|
.field.field-subject
|
20
20
|
= f.label :subject
|
21
21
|
= f.text_field :subject
|
@@ -43,9 +43,9 @@
|
|
43
43
|
= f.label :config_json
|
44
44
|
= f.text_area :config_json
|
45
45
|
|
46
|
-
.field
|
47
|
-
|
48
|
-
|
46
|
+
-# .field
|
47
|
+
-# = f.label :config_exe
|
48
|
+
-# = f.text_area :config_exe
|
49
49
|
|
50
50
|
.actions
|
51
51
|
= f.submit 'Save'
|
@@ -6,13 +6,14 @@
|
|
6
6
|
= link_to '[+]', new_email_template_path
|
7
7
|
|
8
8
|
= paginate @templates, :param_name => :templates_page, :views_prefix => 'ish_manager'
|
9
|
-
.email-templates-index.
|
10
|
-
%table.bordered
|
11
|
-
%
|
12
|
-
%
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
.email-templates-index.maxwidth
|
10
|
+
%table.bordered.data-table
|
11
|
+
%thead
|
12
|
+
%tr
|
13
|
+
%th
|
14
|
+
%th Slug
|
15
|
+
%th Created
|
16
|
+
%th Updated
|
16
17
|
|
17
18
|
- @templates.each do |tmpl|
|
18
19
|
%tr
|
@@ -325,11 +325,6 @@
|
|
325
325
|
text-align: left;
|
326
326
|
}
|
327
327
|
|
328
|
-
/*
|
329
|
-
@tab Preheader
|
330
|
-
@section Preheader Link
|
331
|
-
@tip Set the styling for your email's preheader links. Choose a color that helps them stand out from your text.
|
332
|
-
*/
|
333
328
|
#templatePreheader .mcnTextContent a,
|
334
329
|
#templatePreheader .mcnTextContent p a {
|
335
330
|
/*@editable*/
|
@@ -385,11 +380,6 @@
|
|
385
380
|
text-align: left;
|
386
381
|
}
|
387
382
|
|
388
|
-
/*
|
389
|
-
@tab Header
|
390
|
-
@section Header Link
|
391
|
-
@tip Set the styling for your email's header links. Choose a color that helps them stand out from your text.
|
392
|
-
*/
|
393
383
|
#templateHeader .mcnTextContent a,
|
394
384
|
#templateHeader .mcnTextContent p a {
|
395
385
|
/*@editable*/
|
@@ -445,11 +435,6 @@
|
|
445
435
|
text-align: left;
|
446
436
|
}
|
447
437
|
|
448
|
-
/*
|
449
|
-
@tab Body
|
450
|
-
@section Body Link
|
451
|
-
@tip Set the styling for your email's body links. Choose a color that helps them stand out from your text.
|
452
|
-
*/
|
453
438
|
#templateBody .mcnTextContent a,
|
454
439
|
#templateBody .mcnTextContent p a {
|
455
440
|
/*@editable*/
|
@@ -1028,10 +1013,10 @@
|
|
1028
1013
|
|
1029
1014
|
|
1030
1015
|
<a class="mcnButton " title="Read More"
|
1031
|
-
href='<%= obfuscate "#{@
|
1016
|
+
href='<%= obfuscate "#{@tmpl_config[:button_link]}?#{@utm_tracking_str}" %>'
|
1032
1017
|
target="_blank"
|
1033
|
-
style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;"
|
1034
|
-
|
1018
|
+
style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;"
|
1019
|
+
>Learn More</a>
|
1035
1020
|
</td>
|
1036
1021
|
</tr>
|
1037
1022
|
</tbody>
|
data/lib/tasks/office_tasks.rake
CHANGED
@@ -10,12 +10,13 @@ namespace :office do
|
|
10
10
|
|
11
11
|
sch.send_and_roll
|
12
12
|
|
13
|
-
print '
|
13
|
+
print '.'
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
17
|
-
sleep
|
18
|
-
print '
|
16
|
+
duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
|
17
|
+
sleep duration
|
18
|
+
print '^'
|
19
|
+
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -51,25 +52,30 @@ namespace :office do
|
|
51
52
|
ctxs = ::Ish::EmailContext.scheduled.notsent
|
52
53
|
ctxs.map do |ctx|
|
53
54
|
|
54
|
-
unsub = Ish::EmailUnsubscribe.where({ lead_id: ctx.lead_id, template_id: ctx.
|
55
|
+
unsub = Ish::EmailUnsubscribe.where({ lead_id: ctx.lead_id, template_id: ctx.email_template_id }).first
|
55
56
|
if unsub
|
56
|
-
|
57
|
-
|
57
|
+
puts! 'This user is unsubscribed; the context cannot be sent.' if DEBUG
|
58
|
+
Office::AdminMessage.create({ message: "Lead `#{ctx.lead.full_name}` [mailto:#{ctx.lead.email}] has already unsubscribed from template `#{Ish::EmailTemplate.find( ctx.email_template_id ).slug}` ." })
|
59
|
+
email_action_ids = EAct.where({ email_template_id: ctx.email_template_id }).map(&:id)
|
58
60
|
schs = Sch.active.where({
|
59
61
|
lead_id: ctx.lead_id,
|
60
62
|
:email_action_id.in => email_action_ids,
|
61
63
|
})
|
62
64
|
schs.update({ state: Office::ScheduledEmailAction::STATE_UNSUBSCRIBED })
|
65
|
+
ctx.update({
|
66
|
+
unsubscribed_at: Time.now.to_s,
|
67
|
+
})
|
68
|
+
else
|
69
|
+
out = IshManager::OfficeMailer.send_context_email( ctx[:id].to_s )
|
70
|
+
Rails.env.production? ? out.deliver_later : out.deliver_now
|
63
71
|
end
|
64
72
|
|
65
|
-
|
66
|
-
Rails.env.production? ? out.deliver_later : out.deliver_now
|
67
|
-
print '^'
|
73
|
+
print '.'
|
68
74
|
end
|
69
75
|
|
70
76
|
duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
|
71
77
|
sleep duration
|
72
|
-
print '
|
78
|
+
print '^'
|
73
79
|
|
74
80
|
end
|
75
81
|
end
|