ish_manager 0.1.8.327 → 0.1.8.328
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/application.js +2 -0
- data/app/assets/javascripts/ish_manager/email_contexts.js +16 -0
- data/app/assets/javascripts/ish_manager/{application_materialize.js → trash/application_materialize.js} +0 -0
- data/app/assets/javascripts/ish_manager/{materialize.js → trash/materialize.js} +0 -0
- data/app/assets/stylesheets/ish_manager/email_templates.scss +24 -1
- data/app/controllers/ish_manager/email_contexts_controller.rb +17 -2
- data/app/controllers/ish_manager/email_templates_controller.rb +17 -0
- data/app/mailers/ish_manager/office_mailer.rb +29 -7
- data/app/views/ish_manager/email_contexts/_form.haml +27 -11
- data/app/views/ish_manager/email_contexts/index.haml +3 -1
- data/app/views/ish_manager/email_contexts/show.haml +3 -2
- data/app/views/ish_manager/email_templates/_form.haml +12 -1
- data/app/views/ish_manager/email_templates/_form_mini.haml +9 -0
- data/app/views/ish_manager/email_templates/_index.haml +2 -1
- data/app/views/ish_manager/email_templates/_marketing_react_1.html +0 -0
- data/app/views/ish_manager/email_templates/edit.haml +2 -0
- data/app/views/ish_manager/email_templates/plain.html.erb +4 -0
- data/config/routes.rb +10 -8
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d4a0f293f7775d1cb692bd13e478037207e95d50cb0175b54f872d4c6f20ab6
|
4
|
+
data.tar.gz: 68b17421aff68e4fc2bef3d1e2e3aba4d5d0ad8120b48e6b201700689433b198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a236d6ad5f3ea044628697590553d5752ed21343582f32ef7e9b1a94f8639c8e2d7b0ffca016867567bc9a9dfd3b1e9612e2dc6275d6805fdafe1d433a6529d3
|
7
|
+
data.tar.gz: d333a3a14fcb5ff46e3c5c16e3549572e76145ab72233adab06e4a268b0cfe32eb3136d16b771bcd521ab337d26b1084e9118e6b52c93c2535374030be928187
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
AppRouter = {
|
3
|
+
new_email_context_with: (slug) => `/manager/email_contexts/new_with/${slug}`
|
4
|
+
}
|
5
|
+
|
6
|
+
$(document).ready(() => {
|
7
|
+
|
8
|
+
if ($(".email-contexts--form").length) {
|
9
|
+
$("#ish_email_context_email_template_id").on('change', (ev) => {
|
10
|
+
const val = ev.target.value
|
11
|
+
window.location.href = AppRouter.new_email_context_with(val)
|
12
|
+
})
|
13
|
+
}
|
14
|
+
|
15
|
+
})
|
16
|
+
|
File without changes
|
File without changes
|
@@ -35,7 +35,7 @@
|
|
35
35
|
}
|
36
36
|
|
37
37
|
|
38
|
-
.email-templates--form {
|
38
|
+
.email-templates--form-mini {
|
39
39
|
border: 1px solid red;
|
40
40
|
padding: 1em;
|
41
41
|
|
@@ -48,3 +48,26 @@
|
|
48
48
|
}
|
49
49
|
|
50
50
|
}
|
51
|
+
|
52
|
+
.email-contexts--form,
|
53
|
+
.email-templates--form {
|
54
|
+
|
55
|
+
.field-subject {
|
56
|
+
display: flex;
|
57
|
+
width: calc( 100% - 20px );
|
58
|
+
|
59
|
+
input[name='ish_email_context[subject]'],
|
60
|
+
input[name='ish_email_template[subject]'] {
|
61
|
+
margin-left: 5px;
|
62
|
+
flex-grow: 1;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
.body {
|
69
|
+
border: 1px solid red;
|
70
|
+
padding: 10px;
|
71
|
+
margin: 10px;
|
72
|
+
}
|
73
|
+
}
|
@@ -47,7 +47,16 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
47
47
|
@email_ctx = EmailContext.find params[:id]
|
48
48
|
authorize! :iframe_src, @email_ctx
|
49
49
|
@email_template = @email_ctx.email_template
|
50
|
-
|
50
|
+
case @email_template.type
|
51
|
+
when 'partial'
|
52
|
+
render 'ish_manager/email_templates/iframe_src', layout: false
|
53
|
+
return
|
54
|
+
when 'plain'
|
55
|
+
@body = @email_template.body
|
56
|
+
@body.gsub!('{name}', @email_ctx.name)
|
57
|
+
render 'ish_manager/email_templates/plain', layout: false
|
58
|
+
return
|
59
|
+
end
|
51
60
|
end
|
52
61
|
|
53
62
|
def index
|
@@ -61,7 +70,13 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
61
70
|
|
62
71
|
def new
|
63
72
|
authorize! :new, ::Ish::EmailContext
|
64
|
-
@
|
73
|
+
@template = Ish::EmailTemplate.where( slug: params[:template_slug] ).first
|
74
|
+
@template ||= Ish::EmailTemplate.where( id: params[:template_slug] ).first
|
75
|
+
attrs = {}
|
76
|
+
if @template
|
77
|
+
attrs = @template.attributes.slice( :subject, :body, :from_email )
|
78
|
+
end
|
79
|
+
@email_ctx = ::Ish::EmailContext.new( { email_template: @template }.merge(attrs) )
|
65
80
|
end
|
66
81
|
|
67
82
|
def show
|
@@ -23,6 +23,11 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
|
|
23
23
|
redirect_to action: :index
|
24
24
|
end
|
25
25
|
|
26
|
+
def edit
|
27
|
+
@template = Ish::EmailTemplate.where({ id: params[:id] }).first
|
28
|
+
authorize! :edit, @template
|
29
|
+
end
|
30
|
+
|
26
31
|
def iframe_src
|
27
32
|
authorize! :iframe_src, Ish::EmailTemplate
|
28
33
|
@email_template = Ish::EmailTemplate.where({ id: params[:id] }).first ||
|
@@ -45,5 +50,17 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
|
|
45
50
|
@email_ctx = EmailContext.new({ body: Ish::LoremIpsum.html })
|
46
51
|
end
|
47
52
|
|
53
|
+
def update
|
54
|
+
@template = Ish::EmailTemplate.where({ id: params[:id] }).first
|
55
|
+
authorize! :update, @template
|
56
|
+
flag = @template.update_attributes( params[:ish_email_template].permit! )
|
57
|
+
if flag
|
58
|
+
flash[:notice] = 'Success.'
|
59
|
+
redirect_to action: 'index'
|
60
|
+
else
|
61
|
+
flash[:alert] = "No luck. #{@template.errors.full_messages.join(', ')}"
|
62
|
+
render :edit
|
63
|
+
end
|
64
|
+
end
|
48
65
|
|
49
66
|
end
|
@@ -1,22 +1,44 @@
|
|
1
1
|
|
2
2
|
class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
3
|
-
default from: 'piousbox@gmail.com'
|
4
|
-
# layout 'mailer'
|
5
3
|
|
6
4
|
def send_context_email ctx_id
|
7
5
|
@email_ctx = ::Ish::EmailContext.find ctx_id
|
8
|
-
template = "render/_#{@email_ctx.email_template.slug}"
|
9
|
-
|
10
6
|
ac = ActionController::Base.new
|
11
7
|
ac.instance_variable_set( :@email_ctx, @email_ctx )
|
12
|
-
|
8
|
+
|
9
|
+
case @email_ctx.email_template.type
|
10
|
+
when 'partial'
|
11
|
+
template = "render/_#{@email_ctx.email_template.slug}"
|
12
|
+
rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@email_ctx.email_template.slug}")
|
13
|
+
when 'plain'
|
14
|
+
@body = @email_ctx.email_template.body
|
15
|
+
@body.gsub!('{name}', @email_ctx.name)
|
16
|
+
template = "render/plain"
|
17
|
+
rendered_str = ac.render_to_string("ish_manager/email_templates/plain")
|
18
|
+
end
|
19
|
+
|
13
20
|
@email_ctx.update( rendered_str: rendered_str, sent_at: Time.now )
|
14
21
|
|
15
|
-
mail(
|
22
|
+
mail( from: @email_ctx.from_email,
|
23
|
+
to: @email_ctx.to_email,
|
16
24
|
bcc: 'piousbox@gmail.com',
|
17
25
|
subject: @email_ctx.subject,
|
18
26
|
template_name: template )
|
19
|
-
|
20
27
|
end
|
21
28
|
|
22
29
|
end
|
30
|
+
|
31
|
+
|
32
|
+
## 2022-11-10 backup
|
33
|
+
# def send_context_email ctx_id
|
34
|
+
# @email_ctx = ::Ish::EmailContext.find ctx_id
|
35
|
+
# template = "render/_#{@email_ctx.email_template.slug}"
|
36
|
+
# ac = ActionController::Base.new
|
37
|
+
# ac.instance_variable_set( :@email_ctx, @email_ctx )
|
38
|
+
# rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@email_ctx.email_template.slug}")
|
39
|
+
# @email_ctx.update( rendered_str: rendered_str, sent_at: Time.now )
|
40
|
+
# mail( to: @email_ctx.to_email,
|
41
|
+
# bcc: 'piousbox@gmail.com',
|
42
|
+
# subject: @email_ctx.subject,
|
43
|
+
# template_name: template )
|
44
|
+
# end
|
@@ -2,23 +2,39 @@
|
|
2
2
|
.email-contexts--form
|
3
3
|
%h2
|
4
4
|
New Email Context
|
5
|
-
|
5
|
+
- if email_ctx.email_template
|
6
|
+
with template `#{email_ctx.email_template.slug}` type:#{email_ctx.email_template.type}.
|
6
7
|
|
7
8
|
- url = %w| index new create |.include?( params[:action] ) ? email_contexts_path : email_context_path(email_ctx)
|
8
9
|
= form_for email_ctx, url: url do |f|
|
9
|
-
.
|
10
|
-
|
11
|
-
|
10
|
+
.row
|
11
|
+
.col.s6
|
12
|
+
.field
|
13
|
+
= f.label :email_template_id
|
14
|
+
= f.select :email_template_id, options_for_select(@email_templates_list, selected: params[:email_template_id] || email_ctx.email_template&.id )
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
.field
|
17
|
+
= f.label :from_email
|
18
|
+
= 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
|
+
.col.s6
|
24
|
+
%h5 Templating
|
25
|
+
.field
|
26
|
+
= f.label :name
|
27
|
+
= f.text_field :name
|
28
|
+
.field.field-subject
|
17
29
|
= f.label :subject
|
18
30
|
= f.text_field :subject
|
19
|
-
.
|
20
|
-
|
21
|
-
|
31
|
+
- if 'plain' == email_ctx.email_template&.type
|
32
|
+
.body
|
33
|
+
= raw email_ctx.email_template.body
|
34
|
+
- else
|
35
|
+
.field
|
36
|
+
= f.label :body
|
37
|
+
= f.text_area :body, class: 'tinymce'
|
22
38
|
.actions
|
23
39
|
.left
|
24
40
|
= f.submit 'Preview'
|
@@ -22,4 +22,6 @@
|
|
22
22
|
= button_to '[x]', email_context_path(ctx), method: :delete, form_class: :inline, data: { confirm: 'Are you sure?' }
|
23
23
|
-# = link_to 'iframe', email_context_iframe_path(ctx), target: :_blank do
|
24
24
|
|
25
|
-
|
25
|
+
[ <b>tmpl:</b> #{ctx.email_template.slug} ]
|
26
|
+
[ <b>To:</b> #{ctx.to_email} ]
|
27
|
+
<u>#{ctx.subject}</u>
|
@@ -2,9 +2,10 @@
|
|
2
2
|
.email-contexts-show
|
3
3
|
|
4
4
|
%ul
|
5
|
+
%li <b>From:</b> #{@email_ctx.from_email}
|
5
6
|
%li <b>To:</b> #{@email_ctx.to_email}
|
6
7
|
%li <b>Subject:</b> #{@email_ctx.subject}
|
7
|
-
%li <b>Template:</b> #{@email_ctx.email_template.slug}
|
8
|
+
%li <b>Template:</b> #{@email_ctx.email_template.slug} <b>Type:</b> #{@email_ctx.email_template.type}
|
8
9
|
- if @email_ctx.sent_at
|
9
10
|
%li <b>Sent at:</b> #{@email_ctx.sent_at.strftime('%Y-%m-%d %l:%M%P')}
|
10
11
|
- else
|
@@ -13,6 +14,6 @@
|
|
13
14
|
= link_to '[~]', edit_email_context_path(@email_ctx)
|
14
15
|
|
15
16
|
- if @email_ctx.sent_at
|
16
|
-
=raw @email_ctx.rendered_str
|
17
|
+
= raw @email_ctx.rendered_str
|
17
18
|
- else
|
18
19
|
%iframe{ src: email_context_iframe_path(@email_ctx), width: '100%', height: '100%' }
|
@@ -3,9 +3,20 @@
|
|
3
3
|
|
4
4
|
.email-templates--form
|
5
5
|
= form_for email_template, url: url do |f|
|
6
|
-
|
6
|
+
.field
|
7
|
+
= f.label :type
|
8
|
+
= f.select :type, options_for_select(Ish::EmailTemplate.type_list, selected: email_template.type)
|
7
9
|
.field
|
8
10
|
= f.label :slug
|
9
11
|
= f.text_field :slug
|
12
|
+
.field
|
13
|
+
= f.label :from_email
|
14
|
+
= f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: email_template.from_email)
|
15
|
+
.field.field-subject
|
16
|
+
= f.label :subject
|
17
|
+
= f.text_field :subject
|
18
|
+
.field
|
19
|
+
= f.label :body
|
20
|
+
= f.text_area :body, class: 'tinymce'
|
10
21
|
.actions
|
11
22
|
= f.submit 'Submit'
|
@@ -3,11 +3,12 @@
|
|
3
3
|
Email Templates
|
4
4
|
.email-templates-index
|
5
5
|
|
6
|
-
= render 'ish_manager/email_templates/
|
6
|
+
= render 'ish_manager/email_templates/form_mini'
|
7
7
|
%ul
|
8
8
|
- @templates.each do |tmpl|
|
9
9
|
%li
|
10
10
|
= link_to 'Use', new_email_context_path({ email_template_id: tmpl.id })
|
11
|
+
= link_to 'Edit', edit_email_template_path({ id: tmpl })
|
11
12
|
= link_to 'View', email_template_path({ id: tmpl })
|
12
13
|
= link_to 'iFrame', email_template_iframe_path({ id: tmpl }), target: :_blank
|
13
14
|
= tmpl.slug
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -47,17 +47,19 @@ IshManager::Engine.routes.draw do
|
|
47
47
|
|
48
48
|
resources :email_campaigns, as: :email_campaigns
|
49
49
|
|
50
|
-
get
|
51
|
-
get
|
52
|
-
post 'email_contexts/send/:id',
|
53
|
-
get
|
54
|
-
get
|
50
|
+
get 'email_contexts/iframe_src/:id', to: 'email_contexts#iframe_src', as: :email_context_iframe
|
51
|
+
get 'email_contexts/new_with/:template_slug', to: 'email_contexts#new'
|
52
|
+
post 'email_contexts/send/:id', to: 'email_contexts#do_send', as: :email_context_send
|
53
|
+
get 'email_contexts', to: 'email_contexts#index', as: :email_contexts, defaults: { notsent: false }
|
54
|
+
get 'email_contexts/notsent', to: 'email_contexts#index', as: :notsent_email_contexts, defaults: { notsent: true }
|
55
55
|
resources :email_contexts
|
56
56
|
|
57
|
-
get
|
58
|
-
get
|
59
|
-
|
57
|
+
get 'email_templates/iframe_src/:id', to: 'email_templates#iframe_src', as: :email_template_iframe
|
58
|
+
get 'email_templates/show/:id', to: 'email_templates#show', as: :email_template
|
59
|
+
patch 'email_templates/show/:id', to: 'email_templates#update'
|
60
|
+
delete 'email_templates/show/:id', to: 'email_templates#destroy'
|
60
61
|
resources :email_templates
|
62
|
+
|
61
63
|
resources :email_unsubscribes
|
62
64
|
|
63
65
|
get 'leads', :to => 'leads#index', :defaults => { :is_done => false }, as: :leads
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.328
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -219,10 +219,10 @@ files:
|
|
219
219
|
- app/assets/images/ui-icons_ffffff_256x240.png
|
220
220
|
- app/assets/images/wait.gif
|
221
221
|
- app/assets/javascripts/ish_manager/application.js
|
222
|
-
- app/assets/javascripts/ish_manager/
|
222
|
+
- app/assets/javascripts/ish_manager/email_contexts.js
|
223
223
|
- app/assets/javascripts/ish_manager/maps.js
|
224
|
-
- app/assets/javascripts/ish_manager/materialize.js
|
225
224
|
- app/assets/javascripts/ish_manager/shared.js
|
225
|
+
- app/assets/javascripts/ish_manager/trash/application_materialize.js
|
226
226
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1.zip
|
227
227
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1/AUTHORS.txt
|
228
228
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1/LICENSE.txt
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1/jquery-ui.theme.css
|
244
244
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1/jquery-ui.theme.min.css
|
245
245
|
- app/assets/javascripts/ish_manager/trash/jquery-ui-1.12.1/package.json
|
246
|
+
- app/assets/javascripts/ish_manager/trash/materialize.js
|
246
247
|
- app/assets/javascripts/ish_manager/vendor/bootstrap.min.js
|
247
248
|
- app/assets/javascripts/ish_manager/vendor/jquery-3.2.1.min.js
|
248
249
|
- app/assets/javascripts/ish_manager/vendor/jquery-3.6.0.min.js
|
@@ -313,15 +314,19 @@ files:
|
|
313
314
|
- app/views/ish_manager/email_contexts/new.haml
|
314
315
|
- app/views/ish_manager/email_contexts/show.haml
|
315
316
|
- app/views/ish_manager/email_templates/_form.haml
|
317
|
+
- app/views/ish_manager/email_templates/_form_mini.haml
|
316
318
|
- app/views/ish_manager/email_templates/_index.haml
|
319
|
+
- app/views/ish_manager/email_templates/_marketing_react_1.html
|
317
320
|
- app/views/ish_manager/email_templates/_marketing_ror_1.html
|
318
321
|
- app/views/ish_manager/email_templates/_marketing_ror_2.html
|
319
322
|
- app/views/ish_manager/email_templates/_marketing_wordpress_1.html
|
320
323
|
- app/views/ish_manager/email_templates/_marketing_wordpress_2.html
|
321
324
|
- app/views/ish_manager/email_templates/_piousbox_roundborders.html.erb
|
322
325
|
- app/views/ish_manager/email_templates/_social.html.erb
|
326
|
+
- app/views/ish_manager/email_templates/edit.haml
|
323
327
|
- app/views/ish_manager/email_templates/iframe_src.haml
|
324
328
|
- app/views/ish_manager/email_templates/index.haml
|
329
|
+
- app/views/ish_manager/email_templates/plain.html.erb
|
325
330
|
- app/views/ish_manager/email_templates/show.haml
|
326
331
|
- app/views/ish_manager/email_unsubscribes/new.haml
|
327
332
|
- app/views/ish_manager/galleries/_form.haml
|