wco_email 0.1.1.40 → 0.1.1.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47368100e817e5ef832785bd306770d27d89e26e8f29340c8169afa7d87685dc
4
- data.tar.gz: 11533cfb7d1d6e4f80ab1c1506388af0b352a5df45e92f9c1388b47b7f6c8d0b
3
+ metadata.gz: 0ad1cad321b6f5762c495974c75c8fc45e42d6f90e899fdd136305f90f57d2d2
4
+ data.tar.gz: 4b1343f28fd816cd700bd0b4c56f22a29246afaf7218b5a837b52d25386d979d
5
5
  SHA512:
6
- metadata.gz: b6f0201e0db85a6f2694142bfcec4e0f642a3e0655f17256788b3ee71f3ce605b2a4d73f2af88f982f0af18502688b31d8d5ee2af83af2ac7ac637b15843f335
7
- data.tar.gz: 879697c41150bce31d475c66b20ff807ab4c50fcba104d03c4d6c4203c958f086bf0e2b5b7467842f6c238689511067db9081ded1851afe02823361574dbd5af
6
+ metadata.gz: 4f5d78630cd5489588b99fbfeef67e10578d93daab74c03b63fc05999b87ab672f3b7b8e272514a60f944cfdcb332ed8e85dda587185e449f7059c50aa9ae5db
7
+ data.tar.gz: bc90516338dd6b3b16d265f5319b3785f207a68efefca61f93e681aac62d6ec5588c4a1c99774baa040f8f2c0dfc892473f8f484bbe481fad5754f58cb8899cd
@@ -1,13 +1,14 @@
1
1
 
2
- EC = WcoEmail::Conversation
3
- EF = WcoEmail::EmailFilter
4
- EM = WcoEmail::Message
5
- ET = WcoEmail::EmailTemplate
6
- MS = WcoEmail::MessageStub
7
- EMS = MS
8
- OA = Wco::OfficeAction
9
- OAT = Wco::OfficeActionTemplate
10
- Sch = WcoEmail::EmailAction
2
+ EC ||= WcoEmail::Conversation
3
+ EF ||= WcoEmail::EmailFilter
4
+ EM ||= WcoEmail::Message
5
+ ET ||= WcoEmail::EmailTemplate
6
+ MS ||= WcoEmail::MessageStub
7
+ EMS ||= MS
8
+ OA ||= Wco::OfficeAction
9
+ OAT ||= Wco::OfficeActionTemplate
10
+ OATT ||= Wco::OfficeActionTemplateTie
11
+ Sch ||= WcoEmail::EmailAction
11
12
 
12
13
  class WcoEmail::ApplicationController < Wco::ApplicationController
13
14
  # before_action :set_lists
@@ -44,18 +44,6 @@ class WcoEmail::ContextsController < WcoEmail::ApplicationController
44
44
  authorize! :edit, @ctx
45
45
  end
46
46
 
47
- def iframe_src
48
- @ctx = @email_context = WcoEmail::Context.find params[:id]
49
- authorize! :iframe_src, @ctx
50
-
51
- @tmpl = @email_template = @ctx.email_template
52
- @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
53
- @lead = @ctx.lead
54
- @body = @ctx.body
55
-
56
- render layout: false
57
- end
58
-
59
47
  def index
60
48
  authorize! :index, WcoEmail::Context
61
49
  @ctxs = WcoEmail::Context.all.order_by( sent_at: :desc, send_at: :desc
@@ -113,6 +101,20 @@ class WcoEmail::ContextsController < WcoEmail::ApplicationController
113
101
  authorize! :show, @ctx
114
102
  end
115
103
 
104
+ def show_iframe
105
+ @ctx = @email_context = WcoEmail::Context.find params[:id]
106
+ authorize! :iframe_src, @ctx
107
+
108
+ @tmpl = @email_template = @ctx.email_template
109
+ @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
110
+ @lead = @ctx.lead
111
+ @body = @ctx.body
112
+
113
+ @renderer = WcoEmail::ApplicationMailer.renderer ctx: @ctx
114
+
115
+ render layout: false
116
+ end
117
+
116
118
  def summary
117
119
  authorize! :summary, WcoEmail::Context
118
120
  @results = WcoEmail::Context.summary
@@ -87,28 +87,19 @@ class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
87
87
  end
88
88
 
89
89
  def show_iframe
90
- @tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
90
+ @tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
91
91
  @tmpl ||= WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
92
92
  authorize! :show, @tmpl
93
93
 
94
- @lead = Wco::Lead.find_by({ email: 'poxlovi@gmail.com' })
95
- @ctx = WcoEmail::Context.new({ email_template: @tmpl, lead: @lead, body: "Lorem Ipsum..." })
96
- @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
97
-
98
- @utm_tracking_str = {
99
- 'cid' => @ctx.lead_id,
100
- 'utm_campaign' => @ctx.tmpl.slug,
101
- 'utm_medium' => 'email',
102
- 'utm_source' => @ctx.tmpl.slug,
103
- }.map { |k, v| "#{k}=#{v}" }.join("&")
104
-
105
- @unsubscribe_url = WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
106
- template_id: @ctx.tmpl.id,
107
- lead_id: @lead.id,
108
- token: @lead.unsubscribe_token,
109
- host: Rails.application.routes.default_url_options[:host],
94
+ @ctx = WcoEmail::Context.new({
95
+ email_template: @tmpl,
96
+ lead: Wco::Lead.find_by({ email: 'poxlovi@gmail.com' }),
110
97
  })
111
98
 
99
+ @renderer = WcoEmail::ApplicationMailer.renderer ctx: @ctx
100
+ # @rendered_str = renderer.render_to_string("/wco_email/email_templates/_#{@ctx.tmpl.layout}")
101
+ # @rendered_str = renderer.render_to_string( inline: @ctx.body )
102
+
112
103
  render layout: false
113
104
  end
114
105
 
@@ -124,9 +115,4 @@ class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
124
115
  redirect_to action: :edit
125
116
  end
126
117
 
127
- ##
128
- ## private
129
- ##
130
- private
131
-
132
118
  end
@@ -27,7 +27,7 @@
27
27
 
28
28
  .flex-row
29
29
  = f.label :reply_to_message
30
- = f.select :reply_to_message_id, options_for_select([[ ctx.reply_to_message, ctx.reply_to_message_id ]], selected: ctx.reply_to_message_id), {}, class: 'w-100'
30
+ = f.select :reply_to_message_id, options_for_select([[ ctx.reply_to_message&.preview_str, ctx.reply_to_message_id ]], selected: ctx.reply_to_message_id), {}, class: 'w-100'
31
31
 
32
32
 
33
33
  .tab-labels.flex-row
@@ -41,7 +41,9 @@
41
41
  - if ctx.new_record?
42
42
  New record...
43
43
  - else
44
- %iframe{ src: context_iframe_path(ctx), width: '100%', height: '100%' }
44
+ %iframe{ src: context_iframe_path(ctx.id), width: '100%', height: '100%' }
45
+ .gray.mini= link_to context_iframe_path(ctx.id), context_iframe_path(ctx.id), target: :_blank
46
+
45
47
 
46
48
 
47
49
  .actions
@@ -17,6 +17,8 @@
17
17
  .flex-row
18
18
  %label Subject
19
19
  = f.text_field :subject, class: 'w-100'
20
+ .field
21
+ = f.text_area :body, class: 'tinymce'
20
22
  .flex-row
21
23
  .flex-row
22
24
  %label Respond inline?
@@ -28,8 +28,6 @@
28
28
  .maxwidth
29
29
  - if @ctx.sent_at
30
30
  = raw @ctx.rendered_str
31
- -# = @ctx.tmpl
32
31
 
33
32
  - else
34
- -# = link_to 'i-src', context_iframe_path(@ctx), target: :_blank
35
33
  %iframe.h-500px{ src: context_iframe_path(@ctx), width: '100%', height: '100%' }
@@ -0,0 +1,3 @@
1
+
2
+ = render "/wco_email/email_layouts/#{@tmpl.layout}"
3
+
@@ -0,0 +1,18 @@
1
+
2
+ -# %ul
3
+ -# %li= @lead.inspect
4
+ -# %li= @ctx.tmpl.inspect
5
+ -# %li= @ctx.reply_to_message.inspect
6
+ -# %li= @renderer.inspect
7
+
8
+ = @renderer.render( inline: @ctx.body )
9
+
10
+ -# = @ctx.utm_tracking_str
11
+ -# = @ctx.unsubscribe_url
12
+
13
+ - if @ctx.reply_to_message
14
+ %br
15
+ %br
16
+ .mini Your previous message is shown below.
17
+ %hr
18
+ = raw @ctx.reply_to_message.part_html_sanitized
@@ -28,10 +28,12 @@
28
28
  .label-save-preview= f.submit 'Save & Preview'
29
29
  .tabs
30
30
  .tab-raw
31
- = f.text_area :body # , class: 'tinymce'
31
+ -## No class tinymce, cannot have tinymce mess with my own templating.
32
+ = f.text_area :body
32
33
  .tab-preview
33
34
  - if email_template.persisted?
34
35
  %iframe{ src: email_template_iframe_path(email_template), width: '100%', height: '100%' }
36
+ .gray.mini= link_to email_template_iframe_path(email_template), email_template_iframe_path(email_template), target: :_blank
35
37
 
36
38
  .row
37
39
  .col-md-6
@@ -1,4 +1,10 @@
1
1
 
2
+ -# = @lead.inspect
3
+ -# = @tmpl.inspect
4
+ = @rendered_str
5
+
6
+
7
+ = raw @ctx.body
2
8
  = raw ERB.new( @ctx.body ).result
3
9
 
4
10
  -# = @ctx.reply_to_message.inspect
@@ -1,2 +1,4 @@
1
1
 
2
- = render "/wco_email/email_templates/#{@tmpl.layout}"
2
+ -# = @renderer.render "/wco_email/email_layouts/#{@tmpl.layout}"
3
+
4
+ = render "/wco_email/email_layouts/#{@tmpl.layout}"
data/config/routes.rb CHANGED
@@ -22,7 +22,7 @@ WcoEmail::Engine.routes.draw do
22
22
  resources :email_campaigns
23
23
  resources :email_layouts
24
24
 
25
- get 'contexts/iframe_src/:id', to: 'contexts#iframe_src', as: :context_iframe
25
+ get 'contexts/show_iframe/:id', to: 'contexts#show_iframe', as: :context_iframe
26
26
  get 'contexts/summary', to: 'contexts#summary'
27
27
  post 'contexts/send_immediate/:id', to: 'contexts#send_immediate', as: :send_context
28
28
  resources :contexts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.40
4
+ version: 0.1.1.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -365,10 +365,10 @@ files:
365
365
  - app/views/wco_email/contexts/_header.haml
366
366
  - app/views/wco_email/contexts/_index.haml
367
367
  - app/views/wco_email/contexts/edit.haml
368
- - app/views/wco_email/contexts/iframe_src.haml
369
368
  - app/views/wco_email/contexts/index.haml
370
369
  - app/views/wco_email/contexts/new.haml
371
370
  - app/views/wco_email/contexts/show.haml
371
+ - app/views/wco_email/contexts/show_iframe.haml
372
372
  - app/views/wco_email/contexts/summary.csv.erb
373
373
  - app/views/wco_email/contexts/summary.haml
374
374
  - app/views/wco_email/conversations/_actions.haml
@@ -401,6 +401,7 @@ files:
401
401
  - app/views/wco_email/email_filters/index.haml
402
402
  - app/views/wco_email/email_filters/new.haml
403
403
  - app/views/wco_email/email_filters/show.haml
404
+ - app/views/wco_email/email_layouts/_plain.haml
404
405
  - app/views/wco_email/email_templates/_form.haml
405
406
  - app/views/wco_email/email_templates/_form_mini.haml
406
407
  - app/views/wco_email/email_templates/_form_reply_mini.haml
@@ -1,3 +0,0 @@
1
-
2
- = render "/wco_email/email_templates/#{@tmpl.layout}"
3
-