wco_email 0.1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.txt +129 -0
- data/Rakefile +5 -0
- data/app/assets/config/wco_email_manifest.js +7 -0
- data/app/assets/javascript/vendor-trash/jquery-ui.min.js +13 -0
- data/app/assets/javascript/vendor-trash/jquery.fileupload.js +1482 -0
- data/app/assets/javascript/vendor-trash/jquery.iframe-transport.js +224 -0
- data/app/assets/javascript/vendor-trash/jquery.ui.widget.js +572 -0
- data/app/assets/javascript/vendor-trash/summernote-bs4.min.js +3 -0
- data/app/assets/javascript/wco_email/application.js +11 -0
- data/app/assets/javascript/wco_email/contexts.js +19 -0
- data/app/assets/javascript/wco_email/conversations.js +177 -0
- data/app/assets/javascript/wco_email/file_upload.js-trash +32 -0
- data/app/assets/javascript/wco_email/shared.js +22 -0
- data/app/assets/stylesheets/wco_email/application.scss +29 -0
- data/app/assets/stylesheets/wco_email/contexts.scss +63 -0
- data/app/assets/stylesheets/wco_email/conversations.scss +16 -0
- data/app/assets/stylesheets/wco_email/tags.scss +6 -0
- data/app/controllers/wco_email/application_controller.rb +16 -0
- data/app/controllers/wco_email/contexts_controller.rb +156 -0
- data/app/controllers/wco_email/conversations_controller.rb +129 -0
- data/app/controllers/wco_email/email_action_templates_controller.rb +77 -0
- data/app/controllers/wco_email/email_actions_controller.rb +55 -0
- data/app/controllers/wco_email/email_campaigns_controller.rb +73 -0
- data/app/controllers/wco_email/email_filters_controller.rb +72 -0
- data/app/controllers/wco_email/email_layouts_controller.rb +13 -0
- data/app/controllers/wco_email/email_templates_controller.rb +124 -0
- data/app/controllers/wco_email/message_stubs_controller.rb +14 -0
- data/app/controllers/wco_email/messages_controller.rb +28 -0
- data/app/controllers/wco_email/obfuscated_redirects_controller.rb +20 -0
- data/app/controllers/wco_email/sessions_controller.rb +19 -0
- data/app/controllers/wco_email/unsubscribes_controller.rb +40 -0
- data/app/helpers/wco_email/application_helper.rb +20 -0
- data/app/jobs/wco_email/message_intake_job.rb +54 -0
- data/app/mailers/wco_email/application_mailer.rb +98 -0
- data/app/views/202212 Mailchimp Templates/202212 1col fixed-width.html +863 -0
- data/app/views/202212 Mailchimp Templates/202212 1col full-width.html +906 -0
- data/app/views/202212 Mailchimp Templates/202212 2col fixed-width 2.html +1003 -0
- data/app/views/202212 Mailchimp Templates/202212 2col fixed-width.html +1082 -0
- data/app/views/202212 Mailchimp Templates/202212 2col full-width 2.html +1053 -0
- data/app/views/202212 Mailchimp Templates/202212 2col full-width.html +1147 -0
- data/app/views/202212 Mailchimp Templates/202212 3col fixed-width.html +1087 -0
- data/app/views/202212 Mailchimp Templates/202212 3col full-width.html +1136 -0
- data/app/views/202212 Mailchimp Templates/202212 catalog various-colors-1.html +1223 -0
- data/app/views/202212 Mailchimp Templates/202212 educate.html +1080 -0
- data/app/views/202212 Mailchimp Templates/202212 follow up.html +1001 -0
- data/app/views/202212 Mailchimp Templates/202212 make an announcement.html +1048 -0
- data/app/views/202212 Mailchimp Templates/202212 sell-a-product.html +977 -0
- data/app/views/202212 Mailchimp Templates/202212 tell a story.html +1168 -0
- data/app/views/202212 Mailchimp Templates/202212 theme art-newsletter.html +1612 -0
- data/app/views/202212 Mailchimp Templates/202212 theme caribou-xmas.html +856 -0
- data/app/views/202212 Mailchimp Templates/202212 theme colorbox.html +1027 -0
- data/app/views/202212 Mailchimp Templates/202212 theme competition-invitation.html +918 -0
- data/app/views/202212 Mailchimp Templates/202212 theme event-veerle.html +1132 -0
- data/app/views/202212 Mailchimp Templates/202212 theme fall-colors.html +1407 -0
- data/app/views/202212 Mailchimp Templates/202212 theme gift-giving.html +787 -0
- data/app/views/202212 Mailchimp Templates/202212 theme giftgiving-snowmen.html +731 -0
- data/app/views/202212 Mailchimp Templates/202212 theme heart-of-flowers.html +795 -0
- data/app/views/202212 Mailchimp Templates/202212 theme hero-card.html +915 -0
- data/app/views/202212 Mailchimp Templates/202212 theme hero-image.html +1148 -0
- data/app/views/202212 Mailchimp Templates/202212 theme monthly-contest.html +967 -0
- data/app/views/202212 Mailchimp Templates/202212 theme multiple-event.html +1189 -0
- data/app/views/202212 Mailchimp Templates/202212 theme postcard.html +914 -0
- data/app/views/202212 Mailchimp Templates/202212 theme snowy-fields.html +733 -0
- data/app/views/202212 Mailchimp Templates/202212 theme soft.html +849 -0
- data/app/views/202212 Mailchimp Templates/202212 theme sophisticated.html +1079 -0
- data/app/views/202212 Mailchimp Templates/202212 theme subtle.html +1218 -0
- data/app/views/202212 Mailchimp Templates/202212 theme ticket.html +1015 -0
- data/app/views/202212 Mailchimp Templates/202212 theme whale.html +888 -0
- data/app/views/202310 Email Templates/_acknowledgement_of_document_receipt.html.erb +23 -0
- data/app/views/202310 Email Templates/_support_ticket_created.html.erb +26 -0
- data/app/views/layouts/wco_email/application.haml +64 -0
- data/app/views/layouts/wco_email/mailbox.haml-trash +62 -0
- data/app/views/wco_email/_analytics.erb +16 -0
- data/app/views/wco_email/_main_header.haml +31 -0
- data/app/views/wco_email/_sidebar.haml +10 -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/application_mailer/forwarder_notify.html.erb +17 -0
- data/app/views/wco_email/contexts/_form.haml +59 -0
- data/app/views/wco_email/contexts/_form_reply.haml +27 -0
- data/app/views/wco_email/contexts/_header.haml +22 -0
- data/app/views/wco_email/contexts/_index.haml +8 -0
- data/app/views/wco_email/contexts/edit.haml +8 -0
- data/app/views/wco_email/contexts/iframe_src.haml +3 -0
- data/app/views/wco_email/contexts/index.haml +51 -0
- data/app/views/wco_email/contexts/new.haml +5 -0
- data/app/views/wco_email/contexts/show.haml +34 -0
- data/app/views/wco_email/contexts/summary.csv.erb +4 -0
- data/app/views/wco_email/contexts/summary.haml +16 -0
- data/app/views/wco_email/conversations/_actions.haml +21 -0
- data/app/views/wco_email/conversations/_search.haml +14 -0
- data/app/views/wco_email/conversations/index.haml +43 -0
- data/app/views/wco_email/conversations/show.haml +27 -0
- data/app/views/wco_email/email_action_templates/_form.haml +45 -0
- data/app/views/wco_email/email_action_templates/_header.haml +8 -0
- data/app/views/wco_email/email_action_templates/edit.haml +7 -0
- data/app/views/wco_email/email_action_templates/index.haml +36 -0
- data/app/views/wco_email/email_action_templates/new.haml +9 -0
- data/app/views/wco_email/email_action_templates/show.haml +11 -0
- data/app/views/wco_email/email_actions/_form.haml +24 -0
- data/app/views/wco_email/email_actions/_form_mini.haml-trash +28 -0
- data/app/views/wco_email/email_actions/_header.haml +8 -0
- data/app/views/wco_email/email_actions/edit.haml +4 -0
- data/app/views/wco_email/email_actions/index.haml +31 -0
- data/app/views/wco_email/email_actions/new.haml +4 -0
- data/app/views/wco_email/email_actions/show.haml +0 -0
- data/app/views/wco_email/email_campaigns/_form.haml +33 -0
- data/app/views/wco_email/email_campaigns/_header.haml +5 -0
- data/app/views/wco_email/email_campaigns/edit.haml +5 -0
- data/app/views/wco_email/email_campaigns/index.haml +14 -0
- data/app/views/wco_email/email_campaigns/new.haml +5 -0
- data/app/views/wco_email/email_campaigns/show.haml +17 -0
- data/app/views/wco_email/email_filters/_form.haml +40 -0
- data/app/views/wco_email/email_filters/_header.haml +5 -0
- data/app/views/wco_email/email_filters/edit.haml +5 -0
- data/app/views/wco_email/email_filters/index.haml +48 -0
- data/app/views/wco_email/email_filters/new.haml +5 -0
- data/app/views/wco_email/email_templates/_form.haml +48 -0
- data/app/views/wco_email/email_templates/_form_mini.haml +9 -0
- data/app/views/wco_email/email_templates/_form_reply_mini.haml +8 -0
- data/app/views/wco_email/email_templates/_form_schedule_mini.haml +11 -0
- data/app/views/wco_email/email_templates/_header.haml +6 -0
- data/app/views/wco_email/email_templates/_index.haml +26 -0
- data/app/views/wco_email/email_templates/_index_expanded.haml +13 -0
- data/app/views/wco_email/email_templates/_m20221201react.html.erb +1202 -0
- data/app/views/wco_email/email_templates/_m20221222merryxmas.html.erb +766 -0
- data/app/views/wco_email/email_templates/_m202309_feedback.html.erb +1161 -0
- data/app/views/wco_email/email_templates/_m202309_ror4.html.erb +1068 -0
- data/app/views/wco_email/email_templates/_marketing_node_1.html.erb +984 -0
- data/app/views/wco_email/email_templates/_marketing_react_1.html +0 -0
- data/app/views/wco_email/email_templates/_marketing_react_2.html.erb +749 -0
- data/app/views/wco_email/email_templates/_marketing_react_3.html.erb +628 -0
- data/app/views/wco_email/email_templates/_marketing_ror_1.html +751 -0
- data/app/views/wco_email/email_templates/_marketing_ror_2.html.erb +755 -0
- data/app/views/wco_email/email_templates/_marketing_ror_3.html.erb +25 -0
- data/app/views/wco_email/email_templates/_marketing_ror_4.html.erb +25 -0
- data/app/views/wco_email/email_templates/_marketing_ror_5.html.erb +17 -0
- data/app/views/wco_email/email_templates/_marketing_wordpress_1.html +0 -0
- data/app/views/wco_email/email_templates/_marketing_wordpress_2.html +0 -0
- data/app/views/wco_email/email_templates/_meta.haml +6 -0
- data/app/views/wco_email/email_templates/_piousbox_roundborders.html.erb +1007 -0
- data/app/views/wco_email/email_templates/_piousbox_social.html.erb +181 -0
- data/app/views/wco_email/email_templates/_plain.haml +15 -0
- data/app/views/wco_email/email_templates/_rec_resume_shared_with_you.html.erb +39 -0
- data/app/views/wco_email/email_templates/_slug-1.html.erb +0 -0
- data/app/views/wco_email/email_templates/_slug-2.html.erb +0 -0
- data/app/views/wco_email/email_templates/_slug-3.html.erb +0 -0
- data/app/views/wco_email/email_templates/_tracking_footer.html.erb +13 -0
- data/app/views/wco_email/email_templates/_wasyaco_roundborders.html.erb +686 -0
- data/app/views/wco_email/email_templates/_wasyaco_social.html.erb +181 -0
- data/app/views/wco_email/email_templates/edit.haml +6 -0
- data/app/views/wco_email/email_templates/new.haml +6 -0
- data/app/views/wco_email/email_templates/show.haml +11 -0
- data/app/views/wco_email/email_templates/show_iframe.haml +2 -0
- data/app/views/wco_email/lead_action_templates/_header.haml +7 -0
- data/app/views/wco_email/lead_actions/_header.haml +8 -0
- data/app/views/wco_email/message_stubs/_index.haml +10 -0
- data/app/views/wco_email/messages/_form_reply.haml-trash +17 -0
- data/app/views/wco_email/messages/_meta.haml +30 -0
- data/app/views/wco_email/messages/show.haml +13 -0
- data/app/views/wco_email/messages/show_iframe.haml +5 -0
- data/app/views/wco_email/sessions/new.html.erb +4 -0
- data/app/views/wco_email/unsubscribes/_header.haml +4 -0
- data/app/views/wco_email/unsubscribes/_table.haml +22 -0
- data/config/initializers/assets.rb +10 -0
- data/config/routes.rb +49 -0
- data/lib/tasks/bjjcollective/sitemap.rb +50 -0
- data/lib/tasks/db_tasks.rake +12 -0
- data/lib/tasks/direct_mail_tasks.rake +35 -0
- data/lib/tasks/infinite_shelter/sitemap.rb +25 -0
- data/lib/tasks/piousbox/sitemap.rb +80 -0
- data/lib/tasks/publish2_wordpress_tasks.rake +54 -0
- data/lib/tasks/scrape_reddit_tasks.rake-bk +23 -0
- data/lib/tasks/trash/email_tasks.rake-trash +126 -0
- data/lib/tasks/trash/sitemap_tasks.rake-trash +146 -0
- data/lib/tasks/wasya_co/sitemap.rb +281 -0
- data/lib/tasks/wco_email_tasks.rake +117 -0
- data/lib/wco_email/README_email_actions.rb +7 -0
- data/lib/wco_email/README_email_contexts.rb +7 -0
- data/lib/wco_email/engine.rb +8 -0
- data/lib/wco_email.rb +19 -0
- metadata +493 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
class WcoEmail::EmailActionTemplatesController < WcoEmail::ApplicationController
|
3
|
+
|
4
|
+
before_action :set_lists
|
5
|
+
|
6
|
+
## Alphabetized : )
|
7
|
+
|
8
|
+
def destroy
|
9
|
+
@act = @email_action = WcoEmail::EmailAction.find( params[:id] )
|
10
|
+
authorize! :delete, @act
|
11
|
+
@act.update_attributes({ deleted_at: Time.now })
|
12
|
+
flash_notice 'Probably success'
|
13
|
+
redirect_to action: :index
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@act = @email_action = WcoEmail::EmailAction.find( params[:id] )
|
18
|
+
# @act.ties.push WcoEmail::EmailActionTie.new( next_email_action_id: nil )
|
19
|
+
authorize! :edit, @act
|
20
|
+
end
|
21
|
+
|
22
|
+
def index
|
23
|
+
@email_actions = WcoEmail::EmailAction.where({ :deleted_at => nil })
|
24
|
+
|
25
|
+
authorize! :index, @new_email_action
|
26
|
+
end
|
27
|
+
|
28
|
+
def new
|
29
|
+
authorize! :new, @new_email_action
|
30
|
+
end
|
31
|
+
|
32
|
+
def show
|
33
|
+
@act = @email_action = WcoEmail::EmailAction.find( params[:id] )
|
34
|
+
authorize! :show, @act
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
if params[:id]
|
39
|
+
@act = @email_action = WcoEmail::EmailAction.find( params[:id] )
|
40
|
+
else
|
41
|
+
@act = @email_action = WcoEmail::EmailAction.new
|
42
|
+
end
|
43
|
+
authorize! :upsert, @act
|
44
|
+
|
45
|
+
if params[:email_action][:ties_attributes]
|
46
|
+
params[:email_action][:ties_attributes].each do |k, v|
|
47
|
+
if !v[:next_email_action_id].present?
|
48
|
+
params[:email_action][:ties_attributes].delete( k )
|
49
|
+
end
|
50
|
+
if v[:to_delete] == "1"
|
51
|
+
EActie.find( v[:id] ).delete
|
52
|
+
params[:email_action][:ties_attributes].delete( k )
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
flag = @act.update_attributes( params[:email_action].permit! )
|
58
|
+
if flag
|
59
|
+
flash[:notice] = 'Success'
|
60
|
+
redirect_to action: 'index'
|
61
|
+
else
|
62
|
+
flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}. #{@act.ties.map { |t| t.errors.full_messages.join(', ') }.join(' | ') }"
|
63
|
+
render action: 'edit'
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
## private
|
70
|
+
##
|
71
|
+
private
|
72
|
+
|
73
|
+
def set_lists
|
74
|
+
@new_email_action = WcoEmail::EmailAction.new
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
Sch = WcoEmail::EmailAction
|
3
|
+
|
4
|
+
class WcoEmail::EmailActionsController < WcoEmail::ApplicationController
|
5
|
+
|
6
|
+
before_action :set_lists
|
7
|
+
|
8
|
+
def create
|
9
|
+
@sch = Sch.new( params[:sch].permit! )
|
10
|
+
authorize! :create, @sch
|
11
|
+
|
12
|
+
flag = @sch.save
|
13
|
+
if flag
|
14
|
+
flash[:notice] = 'Success'
|
15
|
+
else
|
16
|
+
flash[:alert] = "No luck: #{@sch.errors.full_messages.join(', ')}"
|
17
|
+
end
|
18
|
+
redirect_to request.referrer ? request.referrer : leadsets_path
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
@sch = Sch.find params[:id]
|
23
|
+
authorize! :edit, @sch
|
24
|
+
end
|
25
|
+
|
26
|
+
def index
|
27
|
+
@schs = Sch.all
|
28
|
+
authorize! :index, @schs
|
29
|
+
end
|
30
|
+
|
31
|
+
def new
|
32
|
+
@sch = Sch.new
|
33
|
+
authorize! :new, @sch
|
34
|
+
end
|
35
|
+
|
36
|
+
def show
|
37
|
+
@sch = Sch.find params[:id]
|
38
|
+
authorize! :show, @sch
|
39
|
+
redirect_to action: 'edit'
|
40
|
+
end
|
41
|
+
|
42
|
+
def update
|
43
|
+
@sch = Sch.find params[:id]
|
44
|
+
authorize! :update, @sch
|
45
|
+
flag = @sch.update_attributes( params[:sch].permit! )
|
46
|
+
if flag
|
47
|
+
flash[:notice] = "Success."
|
48
|
+
else
|
49
|
+
flash[:alert] = "No luck: #{@sch.errors.full_messages.join(',')}."
|
50
|
+
end
|
51
|
+
render action: 'edit'
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
EmailCampaign = WcoEmail::Campaign
|
3
|
+
|
4
|
+
##
|
5
|
+
## Campaigns send individual contexts to leads.
|
6
|
+
##
|
7
|
+
class WcoEmail::EmailCampaignsController < WcoEmail::ApplicationController
|
8
|
+
|
9
|
+
before_action :set_lists
|
10
|
+
|
11
|
+
def create
|
12
|
+
@campaign = EmailCampaign.new params[:campaign].permit!
|
13
|
+
authorize! :create, @campaign
|
14
|
+
if @campaign.save
|
15
|
+
flash[:notice] = "created campaign"
|
16
|
+
else
|
17
|
+
flash[:alert] = "Cannot create campaign: #{@campaign.errors.messages}"
|
18
|
+
end
|
19
|
+
redirect_to :action => 'index'
|
20
|
+
end
|
21
|
+
|
22
|
+
def do_send
|
23
|
+
@campaign = EmailCampaign.find params[:id]
|
24
|
+
authorize! :send, @campaign
|
25
|
+
@campaign.do_send
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit
|
29
|
+
@campaign = EmailCampaign.find params[:id]
|
30
|
+
authorize! :edit, @campaign
|
31
|
+
end
|
32
|
+
|
33
|
+
def index
|
34
|
+
authorize! :index, EmailCampaign
|
35
|
+
@campaigns = EmailCampaign.all
|
36
|
+
end
|
37
|
+
|
38
|
+
def new
|
39
|
+
@campaign = EmailCampaign.new
|
40
|
+
authorize! :new, @campaign
|
41
|
+
end
|
42
|
+
|
43
|
+
def show
|
44
|
+
@campaign = EmailCampaign.find params[:id]
|
45
|
+
authorize! :show, @campaign
|
46
|
+
@leads = @campaign.leads
|
47
|
+
if params[:q].present?
|
48
|
+
@leads = @leads.where(" email LIKE ? ", "%#{params[:q]}%" )
|
49
|
+
end
|
50
|
+
@leads = @leads.page( params[:leads_page ] ).per( current_profile.per_page )
|
51
|
+
end
|
52
|
+
|
53
|
+
def update
|
54
|
+
@campaign = EmailCampaign.find params[:id]
|
55
|
+
authorize! :update, @campaign
|
56
|
+
if @campaign.update_attributes params[:campaign].permit!
|
57
|
+
flash[:notice] = 'Successfully updated campaign.'
|
58
|
+
else
|
59
|
+
flash[:alert] = "Cannot update campaign: #{@campaign.errors.messages}"
|
60
|
+
end
|
61
|
+
redirect_to :action => 'index'
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
## private
|
66
|
+
##
|
67
|
+
private
|
68
|
+
|
69
|
+
def set_lists
|
70
|
+
@email_templates_list = WcoEmail::EmailTemplate.list
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
|
3
|
+
|
4
|
+
before_action :set_lists
|
5
|
+
|
6
|
+
def create
|
7
|
+
authorize! :create, WcoEmail::EmailFilter
|
8
|
+
@email_filter = WcoEmail::EmailFilter.create params[:email_filter].permit!
|
9
|
+
if @email_filter.persisted?
|
10
|
+
flash[:notice] = 'Success'
|
11
|
+
else
|
12
|
+
flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
|
13
|
+
end
|
14
|
+
redirect_to action: 'index'
|
15
|
+
end
|
16
|
+
|
17
|
+
def destroy
|
18
|
+
@email_filter = WcoEmail::EmailFilter.find params[:id]
|
19
|
+
authorize! :destroy, @email_filter
|
20
|
+
flag = @email_filter.destroy
|
21
|
+
if flag
|
22
|
+
flash[:notice] = 'Success'
|
23
|
+
else
|
24
|
+
flash[:alert] = 'Error'
|
25
|
+
end
|
26
|
+
redirect_to action: 'index'
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@email_filter = WcoEmail::EmailFilter.find params[:id]
|
31
|
+
authorize! :edit, @email_filter
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
authorize! :index, WcoEmail::EmailFilter.new
|
36
|
+
@email_filter = WcoEmail::EmailFilter.new
|
37
|
+
@email_filters = WcoEmail::EmailFilter.active
|
38
|
+
end
|
39
|
+
|
40
|
+
def new
|
41
|
+
@email_filter = WcoEmail::EmailFilter.new
|
42
|
+
authorize! :new, @email_filter
|
43
|
+
end
|
44
|
+
|
45
|
+
def update
|
46
|
+
@email_filter = WcoEmail::EmailFilter.find params[:id]
|
47
|
+
authorize! :update, @email_filter
|
48
|
+
flag = @email_filter.update_attributes( params[:email_filter].permit! )
|
49
|
+
if flag
|
50
|
+
flash[:notice] = 'Success'
|
51
|
+
else
|
52
|
+
flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
|
53
|
+
end
|
54
|
+
redirect_to action: 'index'
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
## private
|
59
|
+
##
|
60
|
+
private
|
61
|
+
|
62
|
+
def set_lists
|
63
|
+
super
|
64
|
+
@email_templates_list = WcoEmail::EmailTemplate.list
|
65
|
+
@email_actions_list = WcoEmail::EmailAction.list
|
66
|
+
@email_action_templates_list = WcoEmail::EmailActionTemplate.list
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,124 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
|
4
|
+
|
5
|
+
# before_action :set_lists, only: %i| new |
|
6
|
+
|
7
|
+
def create
|
8
|
+
authorize! :create, WcoEmail::EmailTemplate
|
9
|
+
@template = WcoEmail::EmailTemplate.create params[:template].permit!
|
10
|
+
if @template.persisted?
|
11
|
+
flash[:notice] = 'Success.'
|
12
|
+
else
|
13
|
+
flash[:alert] = "Could not create an email template: #{@template.errors.full_messages.join(', ')}."
|
14
|
+
end
|
15
|
+
redirect_to action: :index
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy
|
19
|
+
authorize! :destroy, WcoEmail::EmailTemplate
|
20
|
+
@template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first || WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
|
21
|
+
if @template.destroy
|
22
|
+
flash[:notice] = 'Success.'
|
23
|
+
else
|
24
|
+
flash[:alert] = 'Cannot destroy this template.'
|
25
|
+
end
|
26
|
+
redirect_to action: :index
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@tmpl = @email_template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
|
31
|
+
authorize! :edit, @tmpl
|
32
|
+
end
|
33
|
+
|
34
|
+
def iframe_src
|
35
|
+
@tmpl = @email_template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first ||
|
36
|
+
WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
|
37
|
+
authorize! :iframe_src, @email_template
|
38
|
+
|
39
|
+
@lead = Lead.find_by({ email: 'poxlovi@gmail.com' })
|
40
|
+
@ctx = Ctx.new({ email_template: @tmpl, lead_id: @lead.id })
|
41
|
+
@tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
|
42
|
+
|
43
|
+
@utm_tracking_str = {
|
44
|
+
'cid' => @ctx.lead_id,
|
45
|
+
'utm_campaign' => @ctx.tmpl.slug,
|
46
|
+
'utm_medium' => 'email',
|
47
|
+
'utm_source' => @ctx.tmpl.slug,
|
48
|
+
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
49
|
+
|
50
|
+
@unsubscribe_url = WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
|
51
|
+
template_id: @ctx.tmpl.id,
|
52
|
+
lead_id: @lead.id,
|
53
|
+
token: @lead.unsubscribe_token,
|
54
|
+
})
|
55
|
+
|
56
|
+
render layout: false
|
57
|
+
end
|
58
|
+
|
59
|
+
def index
|
60
|
+
authorize! :index, WcoEmail::EmailTemplate
|
61
|
+
@templates = WcoEmail::EmailTemplate.all.order_by( slug: :asc
|
62
|
+
).page( params[:templates_page]
|
63
|
+
).per( current_profile.per_page
|
64
|
+
)
|
65
|
+
render params[:template] || '_index'
|
66
|
+
end
|
67
|
+
|
68
|
+
def new
|
69
|
+
@new_email_template = WcoEmail::EmailTemplate.new
|
70
|
+
authorize! :new, WcoEmail::EmailTemplate
|
71
|
+
end
|
72
|
+
|
73
|
+
def show
|
74
|
+
@tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
|
75
|
+
@tmpl ||= WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
|
76
|
+
authorize! :show, @tmpl
|
77
|
+
|
78
|
+
@ctx = @email_context = WcoEmail::Context.new
|
79
|
+
end
|
80
|
+
|
81
|
+
def show_iframe
|
82
|
+
@tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
|
83
|
+
@tmpl ||= WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
|
84
|
+
authorize! :show, @tmpl
|
85
|
+
|
86
|
+
@lead = Wco::Lead.find_by({ email: 'poxlovi@gmail.com' })
|
87
|
+
@ctx = WcoEmail::Context.new({ email_template: @tmpl, lead: @lead, body: "Lorem Ipsum..." })
|
88
|
+
@tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
|
89
|
+
|
90
|
+
@utm_tracking_str = {
|
91
|
+
'cid' => @ctx.lead_id,
|
92
|
+
'utm_campaign' => @ctx.tmpl.slug,
|
93
|
+
'utm_medium' => 'email',
|
94
|
+
'utm_source' => @ctx.tmpl.slug,
|
95
|
+
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
96
|
+
|
97
|
+
@unsubscribe_url = WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
|
98
|
+
template_id: @ctx.tmpl.id,
|
99
|
+
lead_id: @lead.id,
|
100
|
+
token: @lead.unsubscribe_token,
|
101
|
+
host: Rails.application.routes.default_url_options[:host],
|
102
|
+
})
|
103
|
+
|
104
|
+
render layout: false
|
105
|
+
end
|
106
|
+
|
107
|
+
def update
|
108
|
+
@template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
|
109
|
+
authorize! :update, @template
|
110
|
+
flag = @template.update_attributes( params[:template].permit! )
|
111
|
+
if flag
|
112
|
+
flash[:notice] = 'Success.'
|
113
|
+
else
|
114
|
+
flash[:alert] = "No luck. #{@template.errors.full_messages.join(', ')}"
|
115
|
+
end
|
116
|
+
redirect_to action: :edit
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
## private
|
121
|
+
##
|
122
|
+
private
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
class WcoEmail::MessageStubsController < WcoEmail::ApplicationController
|
3
|
+
|
4
|
+
def churn
|
5
|
+
@stub = WcoEmail::MessageStub.find params[:id]
|
6
|
+
authorize! :churn, @stub
|
7
|
+
WcoEmail::MessageIntakeJob.perform_async( @stub.id.to_s )
|
8
|
+
flash_notice "Schedueld to churn 1 stub."
|
9
|
+
redirect_to request.referrer
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
class WcoEmail::MessagesController < WcoEmail::ApplicationController
|
3
|
+
|
4
|
+
before_action :set_lists, except: %i| show_iframe |
|
5
|
+
|
6
|
+
def show
|
7
|
+
@message = WcoEmail::Message.find params[:id]
|
8
|
+
authorize! :show, @message
|
9
|
+
end
|
10
|
+
|
11
|
+
def show_iframe
|
12
|
+
@message = WcoEmail::Message.find params[:id]
|
13
|
+
authorize! :show, @message
|
14
|
+
render layout: false
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
## private
|
19
|
+
##
|
20
|
+
private
|
21
|
+
|
22
|
+
def set_lists
|
23
|
+
@email_templates_list = WcoEmail::EmailTemplate.list
|
24
|
+
@leads_list = Wco::Lead.list
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class WcoEmail::ObfuscatedRedirectsController < WcoEmail::ApplicationController
|
4
|
+
|
5
|
+
def show
|
6
|
+
@obf = Office::ObfuscatedRedirect.find params[:id]
|
7
|
+
# puts! @obf, '@obf'
|
8
|
+
authorize! :show, @obf
|
9
|
+
visit_time = Time.now
|
10
|
+
@obf.update_attributes({
|
11
|
+
visited_at: visit_time,
|
12
|
+
visits: @obf.visits + [ visit_time ],
|
13
|
+
})
|
14
|
+
# render and return if DEBUG
|
15
|
+
redirect_to @obf.to
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
class WcoEmail::SessionsController < Wco::ApplicationController
|
3
|
+
|
4
|
+
skip_before_action :verify_authenticity_token, only: :create
|
5
|
+
|
6
|
+
def new
|
7
|
+
render :new
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
puts! params, '#create'
|
12
|
+
|
13
|
+
user_info = request.env['omniauth.auth']
|
14
|
+
puts! user_info, 'user_info'
|
15
|
+
|
16
|
+
render json: { status: :ok }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class WcoEmail::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
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module WcoEmail::ApplicationHelper
|
3
|
+
|
4
|
+
def pretty_date date
|
5
|
+
# date.to_s[0, 10]
|
6
|
+
date&.strftime('%Y-%m-%d')
|
7
|
+
end
|
8
|
+
def pp_date a; pretty_date a; end
|
9
|
+
|
10
|
+
def pp_datetime date
|
11
|
+
date&.strftime('%Y-%m-%d %l:%M%P %z')
|
12
|
+
end
|
13
|
+
|
14
|
+
def pp_time date
|
15
|
+
return nil if !date
|
16
|
+
# return date.strftime('%l:%M%P %z')
|
17
|
+
return date.in_time_zone( Rails.application.config.time_zone ).strftime('%l:%M%P')
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
require 'aws-sdk-s3'
|
3
|
+
require 'mail'
|
4
|
+
require 'sidekiq'
|
5
|
+
|
6
|
+
##
|
7
|
+
## 2023-02-26 _vp_ Let's go
|
8
|
+
## 2023-03-07 _vp_ Continue
|
9
|
+
## 2023-12-28 _vp_ Continue
|
10
|
+
##
|
11
|
+
## class_name EIJ
|
12
|
+
##
|
13
|
+
class WcoEmail::MessageIntakeJob
|
14
|
+
include Sidekiq::Job
|
15
|
+
# include Sidekiq::Util
|
16
|
+
|
17
|
+
sidekiq_options queue: 'wco_email_rb'
|
18
|
+
|
19
|
+
=begin
|
20
|
+
|
21
|
+
## Mongo::Error::MaxBSONSize: The document exceeds maximum allowed BSON object size after serialization (on 10.138.2.145)
|
22
|
+
object_key = 'k9n9qo03fii2in3ocj977nac0vj5djn07e110bg1'
|
23
|
+
|
24
|
+
object_key = 'hlbg24s1ov5k7irgmqsrjp0kl95vpik8t1esvs81'
|
25
|
+
MsgStub.where({ object_key: object_key }).delete
|
26
|
+
|
27
|
+
stub = MsgStub.create!({ object_key: object_key })
|
28
|
+
id = stub.id
|
29
|
+
|
30
|
+
Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
|
31
|
+
|
32
|
+
=end
|
33
|
+
def perform id
|
34
|
+
stub = WcoEmail::MessageStub.find id
|
35
|
+
puts "+++ +++ Performing WcoEmail::MessageIntakeJob for object_key `#{stub.object_key}`."
|
36
|
+
|
37
|
+
if stub.status != WcoEmail::MessageStub::STATUS_PENDING
|
38
|
+
raise "This stub has already been processed: #{stub.id.to_s}."
|
39
|
+
return
|
40
|
+
end
|
41
|
+
|
42
|
+
begin
|
43
|
+
stub.do_process
|
44
|
+
rescue => err
|
45
|
+
puts! err, "WcoEmail::MessageIntakeJob error"
|
46
|
+
ExceptionNotifier.notify_exception(
|
47
|
+
err,
|
48
|
+
data: { stub: stub }
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
EIJ = WcoEmail::MessageIntakeJob
|