ish_manager 0.1.8.328 → 0.1.8.330
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ish_manager/email_contexts.js +16 -0
- data/app/controllers/ish_manager/application_controller.rb +0 -10
- data/app/controllers/ish_manager/email_campaign_leads_controller.rb +75 -0
- data/app/controllers/ish_manager/email_campaigns_controller.rb +6 -6
- data/app/controllers/ish_manager/email_contexts_controller.rb +14 -6
- data/app/controllers/ish_manager/leads_controller.rb +32 -12
- data/app/controllers/ish_manager/leadsets_controller.rb +54 -0
- data/app/jobs/ish_manager/application_job.rb +6 -3
- data/app/jobs/ish_manager/email_campaign_job.rb +30 -0
- data/app/mailers/ish_manager/office_mailer.rb +48 -0
- data/app/views/ish_manager/application/_main_header_admin.haml +8 -7
- data/app/views/ish_manager/email_campaign_leads/show.haml +4 -0
- data/app/views/ish_manager/email_contexts/_form.haml +15 -6
- data/app/views/ish_manager/email_contexts/index.haml +1 -0
- data/app/views/ish_manager/email_contexts/show.haml +24 -3
- data/app/views/ish_manager/email_templates/_marketing_ror_2.html.erb +753 -0
- data/app/views/ish_manager/leads/_form.haml +9 -32
- data/app/views/ish_manager/leads/index.haml +27 -37
- data/app/views/ish_manager/leadsets/_form.haml +42 -0
- data/app/views/ish_manager/leadsets/edit.haml +3 -0
- data/app/views/ish_manager/leadsets/index.haml +26 -0
- data/app/views/ish_manager/leadsets/new.haml +5 -0
- data/app/views/ish_manager/trash/email_campaigns-trash/_form.haml +46 -0
- data/app/views/ish_manager/{email_templates/_marketing_ror_2.html → trash/email_campaigns-trash/edit.haml} +0 -0
- data/app/views/ish_manager/trash/email_campaigns-trash/index.haml +4 -0
- data/app/views/ish_manager/trash/email_campaigns-trash/new.haml +2 -0
- data/config/routes.rb +6 -2
- metadata +15 -4
- data/app/views/ish_manager/email_campaigns/index.haml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8837f836ee7037d6459fed6da788325b1ab61e84f50382a5c688b1f33bd6df
|
4
|
+
data.tar.gz: b3b559b2a51bc73c84c49f2307806f56af9aa54e0e39d149f0dad37a7ecbe1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45013f135fbbde395b067d95ab84d9ac6e061edcfca0d6b52d30b1e339c5b822eba55365d28843da1b0d99d7fd592c9f62fe912f486cf789e989d52531069b3e
|
7
|
+
data.tar.gz: eb63ccc14ff4a8a5739b958d47aae5b2e047dcbfe9c1c4131160ed3a2cbe05bc680d9c64cb386d43c48728dc9dbe504f55371aaf41247494078c6cc188478149
|
@@ -10,6 +10,22 @@ $(document).ready(() => {
|
|
10
10
|
const val = ev.target.value
|
11
11
|
window.location.href = AppRouter.new_email_context_with(val)
|
12
12
|
})
|
13
|
+
|
14
|
+
$("#ish_email_context_type").on('change', (ev) => {
|
15
|
+
const val = ev.target.value
|
16
|
+
if (val == 'TYPE_CAMPAIGN') {
|
17
|
+
$(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
|
18
|
+
} else {
|
19
|
+
$(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
|
20
|
+
}
|
21
|
+
})
|
22
|
+
// on page load:
|
23
|
+
if ($("#ish_email_context_type").val() == 'TYPE_CAMPAIGN') {
|
24
|
+
$(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
|
25
|
+
} else {
|
26
|
+
$(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
|
27
|
+
}
|
28
|
+
|
13
29
|
}
|
14
30
|
|
15
31
|
})
|
@@ -26,16 +26,6 @@ module IshManager
|
|
26
26
|
@current_ability ||= ::IshManager::Ability.new( @current_profile )
|
27
27
|
end
|
28
28
|
|
29
|
-
# @TODO: obsolete, remove _vp_ 2022-10-15
|
30
|
-
def set_lists
|
31
|
-
# alphabetized! : )
|
32
|
-
@galleries_list = Gallery.all.list
|
33
|
-
@maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
|
34
|
-
@reports_list = Report.all.list
|
35
|
-
@user_profiles_list = Ish::UserProfile.list
|
36
|
-
@videos_list = Video.all.list
|
37
|
-
end
|
38
|
-
|
39
29
|
def access_denied exception
|
40
30
|
store_location_for :user, request.path
|
41
31
|
redirect_to user_signed_in? ? root_path : Rails.application.routes.url_helpers.new_user_session_path, :alert => exception.message
|
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
class ::IshManager::EmailCampaignLeadsController < IshManager::ApplicationController
|
3
|
+
|
4
|
+
# before_action :set_lists
|
5
|
+
|
6
|
+
## alphabetized : )
|
7
|
+
|
8
|
+
# def bulkop
|
9
|
+
# authorize! :bulkop, ::Lead
|
10
|
+
# case params[:a]
|
11
|
+
# when 'add_to_campaign'
|
12
|
+
# c = EmailCampaign.find params[:email_campaign_id]
|
13
|
+
# params[:lead_ids].each do |lead_id|
|
14
|
+
# c_lead = EmailCampaignLead.new( lead_id: lead_id, email_campaign_id: c.id )
|
15
|
+
# flag = c_lead.save
|
16
|
+
# if !flag
|
17
|
+
# puts! c_lead.errors.full_messages.join(", ")
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# flash[:notice] = 'Done acted; See logs.'
|
21
|
+
# redirect_to action: :index
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
|
25
|
+
# def create
|
26
|
+
# @lead = ::Lead.new params[:lead].permit!
|
27
|
+
# authorize! :create, @lead
|
28
|
+
# if @lead.save
|
29
|
+
# flash[:notice] = "created lead"
|
30
|
+
# else
|
31
|
+
# flash[:alert] = "Cannot create lead: #{@lead.errors.messages}"
|
32
|
+
# end
|
33
|
+
# redirect_to :action => 'index'
|
34
|
+
# end
|
35
|
+
|
36
|
+
# def edit
|
37
|
+
# @lead = ::Lead.find params[:id]
|
38
|
+
# authorize! :edit, @lead
|
39
|
+
# end
|
40
|
+
|
41
|
+
# def index
|
42
|
+
# authorize! :index, ::Lead
|
43
|
+
# @leads = ::Lead.all.includes( :leadset )
|
44
|
+
# end
|
45
|
+
|
46
|
+
# def new
|
47
|
+
# @new_lead = ::Lead.new
|
48
|
+
# authorize! :new, @new_lead
|
49
|
+
# end
|
50
|
+
|
51
|
+
def show
|
52
|
+
@c_lead = ::EmailCampaignLead.find params[:id]
|
53
|
+
authorize! :show, @c_lead
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
# def update
|
58
|
+
# @lead = ::Lead.find params[:id]
|
59
|
+
# authorize! :update, @lead
|
60
|
+
# if @lead.update_attributes params[:lead].permit!
|
61
|
+
# flash[:notice] = 'Successfully updated lead.'
|
62
|
+
# else
|
63
|
+
# flash[:alert] = "Cannot update lead: #{@lead.errors.messages}"
|
64
|
+
# end
|
65
|
+
# redirect_to :action => 'index'
|
66
|
+
# end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
# def set_lists
|
71
|
+
# @leadsets_list = [ [nil,nil] ] + ::Leadset.all.map { |k| [ k.name, k.id ] }
|
72
|
+
# @email_campaigns_list = [ [nil,nil] ] + Ish::EmailContext.all_campaigns.map { |k| [ k.slug, k.id ] }
|
73
|
+
# end
|
74
|
+
|
75
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
|
3
3
|
|
4
4
|
def index
|
5
|
-
authorize! :index, Ish::
|
6
|
-
@campaigns = Ish::
|
5
|
+
authorize! :index, Ish::EmailCampaign
|
6
|
+
@campaigns = Ish::EmailCampaign.where( :profile => @current_profile, :is_trash => false )
|
7
7
|
if params[:is_done]
|
8
8
|
@campaigns = @campaigns.where( :is_done => true )
|
9
9
|
else
|
@@ -12,12 +12,12 @@ class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def new
|
15
|
-
@new_campaign = Ish::
|
15
|
+
@new_campaign = Ish::EmailCampaign.new
|
16
16
|
authorize! :new, @new_campaign
|
17
17
|
end
|
18
18
|
|
19
19
|
def create
|
20
|
-
@campaign = Ish::
|
20
|
+
@campaign = Ish::EmailCampaign.new params[:campaign].permit!
|
21
21
|
@campaign.profile = @current_profile
|
22
22
|
authorize! :create, @campaign
|
23
23
|
if @campaign.save
|
@@ -34,12 +34,12 @@ class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def edit
|
37
|
-
@campaign = Ish::
|
37
|
+
@campaign = Ish::EmailCampaign.find params[:id]
|
38
38
|
authorize! :edit, @campaign
|
39
39
|
end
|
40
40
|
|
41
41
|
def update
|
42
|
-
@campaign = Ish::
|
42
|
+
@campaign = Ish::EmailCampaign.find params[:id]
|
43
43
|
authorize! :update, @campaign
|
44
44
|
if @campaign.update_attributes params[:campaign].permit!
|
45
45
|
flash[:notice] = 'Successfully updated campaign.'
|
@@ -20,7 +20,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def destroy
|
23
|
-
@email_ctx = EmailContext.find params[:id]
|
23
|
+
@email_ctx = Ish::EmailContext.find params[:id]
|
24
24
|
authorize! :destroy, @email_ctx
|
25
25
|
flag = @email_ctx.destroy
|
26
26
|
if flag
|
@@ -32,9 +32,17 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def do_send
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
@ctx = ::Ish::EmailContext.find params[:id]
|
36
|
+
authorize! :do_send, @ctx
|
37
|
+
case @ctx.type
|
38
|
+
when ::Ish::EmailContext::TYPE_SINGLE
|
39
|
+
flash[:notice] = 'Scheduled a single send'
|
40
|
+
IshManager::OfficeMailer.send_context_email(params[:id]).deliver_later
|
41
|
+
when ::Ish::EmailContext::TYPE_CAMPAIGN
|
42
|
+
flash[:notice] = 'Scheduled campaign send'
|
43
|
+
IshManager::EmailCampaignJob.perform_later(params[:id])
|
44
|
+
end
|
45
|
+
|
38
46
|
redirect_to action: 'index'
|
39
47
|
end
|
40
48
|
|
@@ -44,7 +52,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
44
52
|
end
|
45
53
|
|
46
54
|
def iframe_src
|
47
|
-
@email_ctx = EmailContext.find params[:id]
|
55
|
+
@email_ctx = Ish::EmailContext.find params[:id]
|
48
56
|
authorize! :iframe_src, @email_ctx
|
49
57
|
@email_template = @email_ctx.email_template
|
50
58
|
case @email_template.type
|
@@ -53,7 +61,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
53
61
|
return
|
54
62
|
when 'plain'
|
55
63
|
@body = @email_template.body
|
56
|
-
@body.gsub!('{name}', @email_ctx.
|
64
|
+
@body.gsub!('{name}', @email_ctx.tmpl_name)
|
57
65
|
render 'ish_manager/email_templates/plain', layout: false
|
58
66
|
return
|
59
67
|
end
|
@@ -1,11 +1,29 @@
|
|
1
1
|
|
2
2
|
class ::IshManager::LeadsController < IshManager::ApplicationController
|
3
3
|
|
4
|
+
before_action :set_lists
|
5
|
+
|
4
6
|
## alphabetized : )
|
5
7
|
|
8
|
+
def bulkop
|
9
|
+
authorize! :bulkop, ::Lead
|
10
|
+
case params[:a]
|
11
|
+
when 'add_to_campaign'
|
12
|
+
c = EmailCampaign.find params[:email_campaign_id]
|
13
|
+
params[:lead_ids].each do |lead_id|
|
14
|
+
c_lead = EmailCampaignLead.new( lead_id: lead_id, email_campaign_id: c.id )
|
15
|
+
flag = c_lead.save
|
16
|
+
if !flag
|
17
|
+
puts! c_lead.errors.full_messages.join(", ")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
flash[:notice] = 'Done acted; See logs.'
|
21
|
+
redirect_to action: :index
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
6
25
|
def create
|
7
|
-
@lead =
|
8
|
-
@lead.profile = @current_profile
|
26
|
+
@lead = ::Lead.new params[:lead].permit!
|
9
27
|
authorize! :create, @lead
|
10
28
|
if @lead.save
|
11
29
|
flash[:notice] = "created lead"
|
@@ -16,22 +34,17 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
|
|
16
34
|
end
|
17
35
|
|
18
36
|
def edit
|
19
|
-
@lead =
|
37
|
+
@lead = ::Lead.find params[:id]
|
20
38
|
authorize! :edit, @lead
|
21
39
|
end
|
22
40
|
|
23
41
|
def index
|
24
|
-
authorize! :index,
|
25
|
-
@leads =
|
26
|
-
if params[:is_done]
|
27
|
-
@leads = @leads.where( :is_done => true )
|
28
|
-
else
|
29
|
-
@leads = @leads.where( :is_done => false )
|
30
|
-
end
|
42
|
+
authorize! :index, ::Lead
|
43
|
+
@leads = ::Lead.all.includes( :leadset )
|
31
44
|
end
|
32
45
|
|
33
46
|
def new
|
34
|
-
@new_lead =
|
47
|
+
@new_lead = ::Lead.new
|
35
48
|
authorize! :new, @new_lead
|
36
49
|
end
|
37
50
|
|
@@ -41,7 +54,7 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
|
|
41
54
|
end
|
42
55
|
|
43
56
|
def update
|
44
|
-
@lead =
|
57
|
+
@lead = ::Lead.find params[:id]
|
45
58
|
authorize! :update, @lead
|
46
59
|
if @lead.update_attributes params[:lead].permit!
|
47
60
|
flash[:notice] = 'Successfully updated lead.'
|
@@ -51,4 +64,11 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
|
|
51
64
|
redirect_to :action => 'index'
|
52
65
|
end
|
53
66
|
|
67
|
+
private
|
68
|
+
|
69
|
+
def set_lists
|
70
|
+
@leadsets_list = [ [nil,nil] ] + ::Leadset.all.map { |k| [ k.name, k.id ] }
|
71
|
+
@email_campaigns_list = [ [nil,nil] ] + Ish::EmailContext.all_campaigns.map { |k| [ k.slug, k.id ] }
|
72
|
+
end
|
73
|
+
|
54
74
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
class ::IshManager::LeadsetsController < IshManager::ApplicationController
|
3
|
+
|
4
|
+
## alphabetized : )
|
5
|
+
|
6
|
+
def create
|
7
|
+
@leadset = Leadset.new params[:leadset].permit!
|
8
|
+
@leadset.profile = @current_profile
|
9
|
+
authorize! :create, @leadset
|
10
|
+
if @leadset.save
|
11
|
+
flash[:notice] = "created leadset"
|
12
|
+
else
|
13
|
+
flash[:alert] = "Cannot create leadset: #{@leadset.errors.messages}"
|
14
|
+
end
|
15
|
+
redirect_to :action => 'index'
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
@leadset = Leadset.find params[:id]
|
20
|
+
authorize! :edit, @leadset
|
21
|
+
end
|
22
|
+
|
23
|
+
def index
|
24
|
+
authorize! :index, Leadset
|
25
|
+
@leadsets = Leadset.all # where( :profile => @current_profile, :is_trash => false )
|
26
|
+
# if params[:is_done]
|
27
|
+
# @leadsets = @leadsets.where( :is_done => true )
|
28
|
+
# else
|
29
|
+
# @leadsets = @leadsets.where( :is_done => false )
|
30
|
+
# end
|
31
|
+
end
|
32
|
+
|
33
|
+
def new
|
34
|
+
@new_leadset = Leadset.new
|
35
|
+
authorize! :new, @new_leadset
|
36
|
+
end
|
37
|
+
|
38
|
+
def show
|
39
|
+
authorize! :redirect, IshManager::Ability
|
40
|
+
redirect_to :action => :edit, :id => params[:id]
|
41
|
+
end
|
42
|
+
|
43
|
+
def update
|
44
|
+
@leadset = Leadset.find params[:id]
|
45
|
+
authorize! :update, @leadset
|
46
|
+
if @leadset.update_attributes params[:leadset].permit!
|
47
|
+
flash[:notice] = 'Successfully updated leadset.'
|
48
|
+
else
|
49
|
+
flash[:alert] = "Cannot update leadset: #{@leadset.errors.messages}"
|
50
|
+
end
|
51
|
+
redirect_to :action => 'index'
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
## EmailContext is mongoid
|
4
|
+
##
|
5
|
+
class IshManager::EmailCampaignJob < ApplicationJob
|
6
|
+
queue_as :mailers
|
7
|
+
|
8
|
+
def perform campaign_id
|
9
|
+
@ctx = @campaign = ::Ish::EmailContext.find campaign_id
|
10
|
+
print "Sending #{@campaign.slug}:"
|
11
|
+
|
12
|
+
if @ctx.email_template.type != 'partial'
|
13
|
+
raise "only `partial` template type is supported for campaigns."
|
14
|
+
end
|
15
|
+
|
16
|
+
if @ctx.sent_at
|
17
|
+
raise 'This campaign has already been sent!'
|
18
|
+
end
|
19
|
+
|
20
|
+
@ctx.campaign_leads.each do |campaign_lead|
|
21
|
+
IshManager::OfficeMailer.send_campaign_email( campaign_id, campaign_lead.id ).deliver_later
|
22
|
+
print '.'
|
23
|
+
end
|
24
|
+
|
25
|
+
@campaign.update_attributes({ sent_at: Time.now })
|
26
|
+
|
27
|
+
puts 'ok'
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -1,6 +1,54 @@
|
|
1
1
|
|
2
2
|
class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
3
3
|
|
4
|
+
def send_campaign_email campaign_id, c_lead_id
|
5
|
+
@ctx = @campaign = ::Ish::EmailContext.find campaign_id
|
6
|
+
@lead = EmailCampaignLead.find c_lead_id
|
7
|
+
|
8
|
+
if @lead.sent_at
|
9
|
+
raise "This campaign_lead #{@lead.id} has already been sent."
|
10
|
+
end
|
11
|
+
|
12
|
+
actl = ActionController::Base.new
|
13
|
+
actl.instance_variable_set( :@ctx, @ctx )
|
14
|
+
|
15
|
+
@pixel_tracking = {
|
16
|
+
'v' => 1,
|
17
|
+
'tid' => 'UA-53077236-2',
|
18
|
+
'cid' => @lead.cid,
|
19
|
+
't' => 'event',
|
20
|
+
'ec' => 'email',
|
21
|
+
'ea' => 'open',
|
22
|
+
'utm_source' => @campaign.slug,
|
23
|
+
'utm_medium' => 'email',
|
24
|
+
'utm_campaign' => @campaign.slug,
|
25
|
+
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
26
|
+
actl.instance_variable_set( :@pixel_tracking, @pixel_tracking )
|
27
|
+
|
28
|
+
@click_tracking = {
|
29
|
+
'cid' => @lead.cid,
|
30
|
+
't' => 'event',
|
31
|
+
'ec' => 'email',
|
32
|
+
'ea' => 'clk-ctct', # clicked contact us
|
33
|
+
'utm_source' => 'eror1',
|
34
|
+
'utm_medium' => 'email',
|
35
|
+
'utm_campaign' => 'eror1',
|
36
|
+
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
37
|
+
actl.instance_variable_set( :@click_tracking, @click_tracking )
|
38
|
+
|
39
|
+
actl.instance_variable_set( :@lead, @lead )
|
40
|
+
|
41
|
+
template = "render/_#{@ctx.email_template.slug}"
|
42
|
+
rendered_str = actl.render_to_string("ish_manager/email_templates/_#{@ctx.email_template.slug}")
|
43
|
+
@lead.update( rendered_str: rendered_str, sent_at: Time.now )
|
44
|
+
|
45
|
+
mail( from: @ctx.from_email,
|
46
|
+
to: @lead.email,
|
47
|
+
bcc: 'piousbox@gmail.com', # @TODO: change _vp_ 2022-11-21
|
48
|
+
subject: @ctx.subject,
|
49
|
+
template_name: template )
|
50
|
+
end
|
51
|
+
|
4
52
|
def send_context_email ctx_id
|
5
53
|
@email_ctx = ::Ish::EmailContext.find ctx_id
|
6
54
|
ac = ActionController::Base.new
|
@@ -52,17 +52,18 @@
|
|
52
52
|
%i.fa.fa-compress.collapse-expand#collapseHeaderOffice
|
53
53
|
Office
|
54
54
|
.namespace
|
55
|
+
-# %ul
|
56
|
+
-# %li= link_to 'Admin', '/admin'
|
57
|
+
-# %li= link_to 'A/Leads', '/admin/leads'
|
58
|
+
-# %li= link_to 'A/CampaignLeads', '/admin/email_campaign_leads'
|
55
59
|
%ul
|
56
|
-
%li= link_to 'Leads', leads_path
|
57
60
|
%li
|
58
61
|
= link_to 'Meetings', meetings_path
|
59
62
|
= link_to '[+]', new_meeting_path
|
60
63
|
%ul
|
61
|
-
%li
|
62
|
-
|
63
|
-
%li
|
64
|
-
|
65
|
-
%li
|
66
|
-
= link_to 'Email Campaigns', email_campaigns_path
|
64
|
+
%li= link_to 'Leads', leads_path
|
65
|
+
%li= link_to 'Leadsets', leadsets_path
|
66
|
+
%li= link_to 'Email Templates', email_templates_path
|
67
|
+
%li= link_to 'Contexts/Campaigns', email_contexts_path
|
67
68
|
%hr
|
68
69
|
|
@@ -8,23 +8,32 @@
|
|
8
8
|
- url = %w| index new create |.include?( params[:action] ) ? email_contexts_path : email_context_path(email_ctx)
|
9
9
|
= form_for email_ctx, url: url do |f|
|
10
10
|
.row
|
11
|
+
|
11
12
|
.col.s6
|
12
13
|
.field
|
13
14
|
= f.label :email_template_id
|
14
15
|
= f.select :email_template_id, options_for_select(@email_templates_list, selected: params[:email_template_id] || email_ctx.email_template&.id )
|
16
|
+
.field
|
17
|
+
= f.label :title
|
18
|
+
= f.text_field :title
|
15
19
|
|
16
20
|
.field
|
17
21
|
= f.label :from_email
|
18
22
|
= f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: email_ctx.from_email)
|
19
|
-
.field
|
20
|
-
= f.label :to_email
|
21
|
-
= f.text_field :to_email
|
22
23
|
|
23
24
|
.col.s6
|
24
|
-
%h5 Templating
|
25
25
|
.field
|
26
|
-
= f.label :
|
27
|
-
= f.
|
26
|
+
= f.label :type
|
27
|
+
= f.select :type, options_for_select(Ish::EmailContext.types_list, selected: email_ctx.type)
|
28
|
+
.TYPE_SINGLE
|
29
|
+
.field
|
30
|
+
= f.label :to_email
|
31
|
+
= f.text_field :to_email
|
32
|
+
%h5 Templating
|
33
|
+
.field
|
34
|
+
= f.label :tmpl_name
|
35
|
+
= f.text_field :tmpl_name
|
36
|
+
|
28
37
|
.field.field-subject
|
29
38
|
= f.label :subject
|
30
39
|
= f.text_field :subject
|
@@ -19,6 +19,7 @@
|
|
19
19
|
= link_to '~', edit_email_context_path(ctx)
|
20
20
|
= link_to email_context_path(ctx) do
|
21
21
|
view
|
22
|
+
= ctx.title
|
22
23
|
= button_to '[x]', email_context_path(ctx), method: :delete, form_class: :inline, data: { confirm: 'Are you sure?' }
|
23
24
|
-# = link_to 'iframe', email_context_iframe_path(ctx), target: :_blank do
|
24
25
|
|
@@ -2,18 +2,39 @@
|
|
2
2
|
.email-contexts-show
|
3
3
|
|
4
4
|
%ul
|
5
|
+
%li <b>Type:</b> #{@email_ctx.type}
|
6
|
+
%li <b>Title:</b> #{@email_ctx.title}
|
7
|
+
%li <b>Template:</b> #{@email_ctx.email_template.slug}
|
5
8
|
%li <b>From:</b> #{@email_ctx.from_email}
|
6
|
-
%li <b>To:</b> #{@email_ctx.to_email}
|
7
9
|
%li <b>Subject:</b> #{@email_ctx.subject}
|
8
|
-
|
10
|
+
- if @email_ctx.type == Ish::EmailContext::TYPE_SINGLE
|
11
|
+
%li <b>To:</b> #{@email_ctx.to_email}
|
12
|
+
%li <b>Template:</b> #{@email_ctx.email_template.slug} <b>Type:</b> #{@email_ctx.email_template.type}
|
13
|
+
|
14
|
+
-#
|
15
|
+
-# Yes sent
|
16
|
+
-#
|
9
17
|
- if @email_ctx.sent_at
|
18
|
+
- if @email_ctx.type == Ish::EmailContext::TYPE_CAMPAIGN
|
19
|
+
%li
|
20
|
+
<b>C_Leads (#{@email_ctx.campaign_leads.length}):</b>
|
21
|
+
- @email_ctx.campaign_leads&.each do |c_lead|
|
22
|
+
= c_lead.lead.email
|
23
|
+
= link_to '[view]', campaign_lead_path( c_lead )
|
24
|
+
,
|
25
|
+
|
10
26
|
%li <b>Sent at:</b> #{@email_ctx.sent_at.strftime('%Y-%m-%d %l:%M%P')}
|
11
|
-
|
27
|
+
|
28
|
+
- else # Draft
|
29
|
+
- if @email_ctx.type == Ish::EmailContext::TYPE_CAMPAIGN
|
30
|
+
%li <b>Leads (#{@email_ctx.leads.length}):</b> #{@email_ctx.leads.map { |p| p&.email }.join(", ") }
|
31
|
+
|
12
32
|
%li
|
13
33
|
= button_to 'Send', email_context_send_path(@email_ctx), form_class: 'inline', :data => { :confirm => 'Are you sure?' }
|
14
34
|
= link_to '[~]', edit_email_context_path(@email_ctx)
|
15
35
|
|
16
36
|
- if @email_ctx.sent_at
|
17
37
|
= raw @email_ctx.rendered_str
|
38
|
+
|
18
39
|
- else
|
19
40
|
%iframe{ src: email_context_iframe_path(@email_ctx), width: '100%', height: '100%' }
|