ish_manager 0.1.8.386 → 0.1.8.387
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/ish_manager/application.scss +1 -1
- data/app/assets/stylesheets/ish_manager/email.scss +2 -0
- data/app/assets/stylesheets/ish_manager/{scheduled_actions_emails.scss → scheduled_email_actions.scss} +21 -4
- data/app/controllers/ish_manager/application_controller.rb +21 -17
- data/app/controllers/ish_manager/email_actions_controller.rb +20 -33
- data/app/jobs/ish_manager/test_email_job.rb +2 -0
- data/app/mailers/ish_manager/application_mailer.rb +4 -0
- data/app/mailers/ish_manager/office_mailer.rb +5 -15
- data/app/views/ish_manager/application_mailer/test_email.html.erb +3 -0
- data/app/views/ish_manager/email_actions/_form.haml +4 -4
- data/app/views/ish_manager/email_actions/new.haml +2 -0
- data/app/views/ish_manager/email_actions/show.haml +9 -1
- data/app/views/ish_manager/email_contexts/iframe_src.haml +1 -1
- data/app/views/ish_manager/email_templates/_plain.haml +2 -1
- data/app/views/ish_manager/scheduled_email_actions/_form.haml +9 -15
- data/app/views/ish_manager/scheduled_email_actions/_form_mini.haml-trash +28 -0
- data/app/views/ish_manager/scheduled_email_actions/index.haml +3 -1
- data/config/routes.rb +1 -0
- data/lib/tasks/office_tasks.rake +4 -4
- metadata +6 -4
- /data/app/views/ish_manager/email_templates/{plain.html.erb → plain.html.erb-trash} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f00f3a091162a2aa2b6535f519bd2a9437984131334224bbd8936fe9bf0bac
|
4
|
+
data.tar.gz: d3272e499c6b92122a07cac2879f62fa38ea2f44a09562728b6adb7c89d1ab33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3f0866b54220116e7ebdac586f19a0333c973b1adfc819ab66ed03a10e691801a09a7dba0baced8cd10079b2078becb9c39c484c0724613177cb0350328818
|
7
|
+
data.tar.gz: e3a7dda50885710cb50c784e5d6185dd78c31c0c1fdc3779922ee4523efa073ef761e93c4fb553054d82db8da659f95ad1e516fa8afc29ae4935c1892cb324c8
|
@@ -18,7 +18,7 @@
|
|
18
18
|
*= require ish_manager/office
|
19
19
|
*= require ish_manager/pagination
|
20
20
|
*= require ish_manager/photos
|
21
|
-
*= require ish_manager/
|
21
|
+
*= require ish_manager/scheduled_email_actions
|
22
22
|
*= require ish_manager/tags
|
23
23
|
*= require ish_manager/user_profiles
|
24
24
|
*= require ish_manager/videos
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
.email-actions-edit,
|
4
4
|
.email-actions-index,
|
5
|
+
.email-actions-new,
|
5
6
|
.email-filters-index,
|
6
7
|
.email-templates-edit,
|
7
8
|
.email-templates-new,
|
@@ -13,6 +14,7 @@
|
|
13
14
|
.leads-edit,
|
14
15
|
.leads-index,
|
15
16
|
.leads-show,
|
17
|
+
.scheduled-email-actions--form,
|
16
18
|
.scheduled-emails-index {
|
17
19
|
.header {
|
18
20
|
display: flex;
|
@@ -4,8 +4,6 @@
|
|
4
4
|
}
|
5
5
|
|
6
6
|
.scheduled-emails-new {
|
7
|
-
|
8
|
-
|
9
7
|
border: 1px solid red;
|
10
8
|
border-radius: .5em;
|
11
9
|
padding: .5em;
|
@@ -18,13 +16,32 @@
|
|
18
16
|
|
19
17
|
}
|
20
18
|
|
21
|
-
.
|
22
|
-
|
19
|
+
.form-mini {
|
20
|
+
border: 1px solid blue;
|
23
21
|
background: #ccc;
|
24
22
|
|
23
|
+
display: inline-block;
|
24
|
+
}
|
25
|
+
|
26
|
+
.scheduled-email-actions--form {
|
27
|
+
|
25
28
|
form {
|
26
29
|
border: 1px solid blue;
|
30
|
+
border-radius: 0.5em;
|
31
|
+
padding: 0.5em;
|
32
|
+
|
33
|
+
background: #ccc;
|
34
|
+
display: inline-block;
|
35
|
+
}
|
27
36
|
|
37
|
+
.actions {
|
28
38
|
display: flex;
|
39
|
+
justify-content: flex-end;
|
40
|
+
padding-top: .5em;
|
29
41
|
}
|
42
|
+
|
43
|
+
.flex-row {
|
44
|
+
justify-content: space-between;
|
45
|
+
}
|
46
|
+
|
30
47
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
module IshManager
|
3
3
|
class ApplicationController < ActionController::Base
|
4
|
+
|
4
5
|
protect_from_forgery :with => :exception, :prepend => true
|
5
6
|
before_action :set_current_ability
|
6
7
|
before_action :set_changelog
|
@@ -9,7 +10,11 @@ module IshManager
|
|
9
10
|
check_authorization
|
10
11
|
rescue_from ::CanCan::AccessDenied, :with => :access_denied
|
11
12
|
|
12
|
-
|
13
|
+
before_action :basic_auth
|
14
|
+
def basic_auth
|
15
|
+
return if Rails.env.test?
|
16
|
+
http_basic_authenticate_or_request_with :name => BASIC_AUTH_NAME, :password => BASIC_AUTH_PASSWORD
|
17
|
+
end
|
13
18
|
|
14
19
|
def home
|
15
20
|
authorize! :home, IshManager::Ability
|
@@ -26,6 +31,11 @@ module IshManager
|
|
26
31
|
redirect_to user_signed_in? ? root_path : Rails.application.routes.url_helpers.new_user_session_path, :alert => exception.message
|
27
32
|
end
|
28
33
|
|
34
|
+
def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
|
35
|
+
payload[:exp] = exp.to_i
|
36
|
+
JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
|
37
|
+
end
|
38
|
+
|
29
39
|
def pp_errors err
|
30
40
|
err
|
31
41
|
end
|
@@ -51,23 +61,17 @@ module IshManager
|
|
51
61
|
@jwt_token = encode(user_profile_id: @current_user.profile.id.to_s)
|
52
62
|
end
|
53
63
|
|
54
|
-
def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
|
55
|
-
payload[:exp] = exp.to_i
|
56
|
-
JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
|
57
|
-
end
|
58
|
-
|
59
64
|
def set_lists
|
60
|
-
@galleries_list
|
61
|
-
@locations_list
|
62
|
-
@maps_list
|
63
|
-
@reports_list
|
64
|
-
@user_profiles_list
|
65
|
-
@videos_list
|
66
|
-
|
67
|
-
@
|
68
|
-
@
|
69
|
-
@
|
70
|
-
@email_templates_list = Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
|
65
|
+
@galleries_list = Gallery.all.list
|
66
|
+
@locations_list = ::Gameui::Map.list
|
67
|
+
@maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
|
68
|
+
@reports_list = Report.all.list
|
69
|
+
@user_profiles_list = Ish::UserProfile.list
|
70
|
+
@videos_list = Video.all.list
|
71
|
+
@leads_list = Lead.list
|
72
|
+
@leadsets_list = Leadset.list
|
73
|
+
@email_actions_list = [[nil,nil]] + Office::EmailAction.all.map { |a| [ a.slug, a.id ] }
|
74
|
+
@email_templates_list = [[nil,nil]] + Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
|
71
75
|
end
|
72
76
|
|
73
77
|
def set_title
|
@@ -5,28 +5,6 @@ class ::IshManager::EmailActionsController < IshManager::ApplicationController
|
|
5
5
|
|
6
6
|
## Alphabetized : )
|
7
7
|
|
8
|
-
def create
|
9
|
-
@act = @email_action = Office::EmailAction.new
|
10
|
-
authorize! :create, @act
|
11
|
-
|
12
|
-
next_ids = params[:email_action].delete(:next_email_actions)
|
13
|
-
next_ids.delete("")
|
14
|
-
Office::EmailAction.where(prev_email_action_id: params[:id] ).update_all(prev_email_action_id: nil)
|
15
|
-
next_ids.each do |next_id|
|
16
|
-
next_action = ::Office::EmailAction.find next_id
|
17
|
-
next_action.update_attribute( :prev_email_action_id, params[:id] )
|
18
|
-
end
|
19
|
-
|
20
|
-
flag = @act.update_attributes( params[:email_action].permit! )
|
21
|
-
if flag
|
22
|
-
flash[:notice] = 'Success'
|
23
|
-
else
|
24
|
-
flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}"
|
25
|
-
end
|
26
|
-
|
27
|
-
redirect_to action: 'index'
|
28
|
-
end
|
29
|
-
|
30
8
|
def edit
|
31
9
|
@act = @email_action = Office::EmailAction.find( params[:id] )
|
32
10
|
@act.ties.push Office::EmailActionTie.new( next_email_action_id: nil )
|
@@ -48,28 +26,37 @@ class ::IshManager::EmailActionsController < IshManager::ApplicationController
|
|
48
26
|
authorize! :show, @act
|
49
27
|
end
|
50
28
|
|
29
|
+
## def create; update; end
|
30
|
+
## def upsert; update; end
|
51
31
|
def update
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
32
|
+
if params[:id]
|
33
|
+
@act = @email_action = Office::EmailAction.find( params[:id] )
|
34
|
+
else
|
35
|
+
@act = @email_action = Office::EmailAction.new
|
36
|
+
end
|
37
|
+
authorize! :upsert, @act
|
38
|
+
|
39
|
+
if params[:email_action][:ties_attributes]
|
40
|
+
params[:email_action][:ties_attributes].each do |k, v|
|
41
|
+
if !v[:next_email_action_id].present?
|
42
|
+
params[:email_action][:ties_attributes].delete( k )
|
43
|
+
end
|
44
|
+
if v[:to_delete] == "1"
|
45
|
+
Actie.find( v[:id] ).delete
|
46
|
+
params[:email_action][:ties_attributes].delete( k )
|
47
|
+
end
|
62
48
|
end
|
63
49
|
end
|
64
50
|
|
65
51
|
flag = @act.update_attributes( params[:email_action].permit! )
|
66
52
|
if flag
|
67
53
|
flash[:notice] = 'Success'
|
54
|
+
redirect_to action: 'index'
|
68
55
|
else
|
69
56
|
flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}. #{@act.ties.map { |t| t.errors.full_messages.join(', ') }.join(' | ') }"
|
57
|
+
render action: 'edit'
|
70
58
|
end
|
71
59
|
|
72
|
-
redirect_to action: 'index'
|
73
60
|
end
|
74
61
|
|
75
62
|
##
|
@@ -56,28 +56,18 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def send_context_email ctx_id
|
59
|
-
@
|
59
|
+
@ctx = ::Ish::EmailContext.find ctx_id
|
60
60
|
ac = ActionController::Base.new
|
61
|
-
ac.instance_variable_set( :@
|
61
|
+
ac.instance_variable_set( :@ctx, @ctx )
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
# when 'partial'
|
66
|
-
# template = "render/_#{@email_ctx.email_template.slug}"
|
67
|
-
# rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@email_ctx.email_template.slug}")
|
68
|
-
# when 'plain'
|
69
|
-
# @body = @email_ctx.body_templated
|
70
|
-
# template = "render/plain"
|
71
|
-
# rendered_str = ac.render_to_string("ish_manager/email_templates/plain")
|
72
|
-
# end
|
73
|
-
|
74
|
-
@email_ctx.update( rendered_str: rendered_str, sent_at: Time.now.to_s )
|
63
|
+
rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@ctx.tmpl.slug}")
|
64
|
+
@ctx.update( rendered_str: rendered_str, sent_at: Time.now.to_s )
|
75
65
|
|
76
66
|
mail( from: @email_ctx.from_email,
|
77
67
|
to: @email_ctx.to_email,
|
78
68
|
bcc: 'piousbox@gmail.com',
|
79
69
|
subject: @email_ctx.subject,
|
80
|
-
template_name:
|
70
|
+
template_name: "render/_#{@ctx.tmpl.slug}" )
|
81
71
|
end
|
82
72
|
|
83
73
|
end
|
@@ -14,10 +14,10 @@
|
|
14
14
|
.field
|
15
15
|
%label Slug
|
16
16
|
= f.text_field :slug
|
17
|
-
.field
|
18
|
-
|
19
|
-
|
20
|
-
.field
|
17
|
+
-# .field
|
18
|
+
-# %label Descr
|
19
|
+
-# = f.text_area :descr
|
20
|
+
.field.flex-row
|
21
21
|
%label Template
|
22
22
|
= f.select :email_template_id, options_for_select( @email_templates_list, selected: act.email_template_id ), {}, class: 'select2'
|
23
23
|
|
@@ -1,3 +1,11 @@
|
|
1
1
|
|
2
2
|
.email-actions-show.max-width
|
3
|
-
|
3
|
+
.header
|
4
|
+
.title Email Action #{@act.id}
|
5
|
+
|
6
|
+
%ul
|
7
|
+
- @act.ties.map do |next_a|
|
8
|
+
%li
|
9
|
+
.a <b>Next act:</b> #{"(same)" if next_a.next_email_action.slug == @act.slug} #{next_a.next_email_action.slug}
|
10
|
+
.a <b>Next at exe:</b> #{next_a.next_at_exe}
|
11
|
+
.a <b>Eval'ed:</b> #{eval( next_a.next_at_exe )}
|
@@ -1,28 +1,22 @@
|
|
1
1
|
|
2
|
-
-#
|
3
|
-
-# scheduled_emails / _form
|
4
|
-
-#
|
5
|
-
|
6
2
|
- sch_a = scheduled_email_action
|
7
3
|
- url = sch_a.new_record? ? scheduled_email_actions_path : scheduled_email_action_path(sch_a.id)
|
8
4
|
|
9
5
|
.scheduled-email-actions--form
|
10
|
-
= form_for scheduled_email_action, url: url, as: :sch
|
6
|
+
= form_for scheduled_email_action, url: url, as: :sch do |f|
|
11
7
|
.header
|
12
8
|
%h5.title Schedule an email action
|
13
9
|
|
14
|
-
.
|
10
|
+
.flex-row
|
15
11
|
= f.label :lead
|
16
|
-
= f.select :lead_id, options_for_select(@leads_list, selected: sch_a[:lead_id]||params[:lead_id] ), class: 'select2'
|
17
|
-
.
|
12
|
+
= f.select :lead_id, options_for_select(@leads_list, selected: sch_a[:lead_id]||params[:lead_id] ), {}, class: 'select2'
|
13
|
+
.flex-row
|
18
14
|
%label State
|
19
|
-
= f.select :state, options_for_select(::Office::ScheduledEmailAction::STATES, selected: sch_a.state )
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
%br
|
25
|
-
.field
|
15
|
+
= f.select :state, options_for_select(::Office::ScheduledEmailAction::STATES, selected: sch_a.state )
|
16
|
+
.flex-row
|
17
|
+
= f.label :email_action
|
18
|
+
= f.select :email_action, options_for_select( @email_actions_list, selected: sch_a[:email_action_id] ), {}, class: 'select2'
|
19
|
+
.flex-row
|
26
20
|
= f.label :perform_at
|
27
21
|
= f.text_field :perform_at
|
28
22
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
-# unused, but maybe I should separate _form and _form_mini ?
|
3
|
+
|
4
|
+
- sch_a = scheduled_email_action
|
5
|
+
- url = sch_a.new_record? ? scheduled_email_actions_path : scheduled_email_action_path(sch_a.id)
|
6
|
+
|
7
|
+
.scheduled-email-actions--form
|
8
|
+
= form_for scheduled_email_action, url: url, as: :sch, html: { class: "form-mini" } do |f|
|
9
|
+
.header
|
10
|
+
%h5.title Schedule an email action
|
11
|
+
|
12
|
+
.flex-row
|
13
|
+
= f.label :lead
|
14
|
+
= f.select :lead_id, options_for_select(@leads_list, selected: sch_a[:lead_id]||params[:lead_id] ), {}, class: 'select2'
|
15
|
+
.field
|
16
|
+
%label State
|
17
|
+
= f.select :state, options_for_select(::Office::ScheduledEmailAction::STATES, selected: sch_a.state )
|
18
|
+
%br
|
19
|
+
.flex-row
|
20
|
+
= f.label :email_action
|
21
|
+
= f.select :email_action, options_for_select( @email_actions_list, selected: sch_a[:email_action_id] ), {}, class: 'select2'
|
22
|
+
%br
|
23
|
+
.field
|
24
|
+
= f.label :perform_at
|
25
|
+
= f.text_field :perform_at
|
26
|
+
|
27
|
+
.actions
|
28
|
+
= submit_tag 'Schedule'
|
@@ -6,6 +6,8 @@
|
|
6
6
|
-# (#{Sch.kept.count})
|
7
7
|
(#{Sch.all.count})
|
8
8
|
= link_to '[+]', new_scheduled_email_action_path
|
9
|
+
.header
|
10
|
+
Time now: #{Time.now.strftime('%Y-%m-%d %l:%M%P')}
|
9
11
|
|
10
12
|
.items
|
11
13
|
- @scheduled_email_actions.each do |sch|
|
@@ -19,4 +21,4 @@
|
|
19
21
|
%li <b>Tmpl:</b> #{sch.email_action.email_template.slug}
|
20
22
|
%li <b>Lead:</b> #{link_to sch.lead.email, lead_path(sch.lead) }
|
21
23
|
%li <b>State:</b> #{sch.state}
|
22
|
-
%li <b>Perform at:</b> #{sch.perform_at}
|
24
|
+
%li <b>Perform at:</b> #{sch.perform_at.in_time_zone}
|
data/config/routes.rb
CHANGED
data/lib/tasks/office_tasks.rake
CHANGED
@@ -27,11 +27,11 @@ namespace :office do
|
|
27
27
|
next_at = eval(tie.next_at_exe)
|
28
28
|
next_sch = Sch.find_or_initialize_by({
|
29
29
|
lead_id: sch.lead_id,
|
30
|
-
email_action_id:
|
30
|
+
email_action_id: next_act.id,
|
31
31
|
})
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
next_sch.perform_at = next_at
|
33
|
+
next_sch.state = Sch::STATE_ACTIVE
|
34
|
+
next_sch.save!
|
35
35
|
end
|
36
36
|
|
37
37
|
print '+'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.387
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -298,7 +298,7 @@ files:
|
|
298
298
|
- app/assets/stylesheets/ish_manager/office.scss
|
299
299
|
- app/assets/stylesheets/ish_manager/pagination.scss
|
300
300
|
- app/assets/stylesheets/ish_manager/photos.scss
|
301
|
-
- app/assets/stylesheets/ish_manager/
|
301
|
+
- app/assets/stylesheets/ish_manager/scheduled_email_actions.scss
|
302
302
|
- app/assets/stylesheets/ish_manager/tags.scss
|
303
303
|
- app/assets/stylesheets/ish_manager/trash/bootstrap.css
|
304
304
|
- app/assets/stylesheets/ish_manager/trash/materialize.css
|
@@ -393,6 +393,7 @@ files:
|
|
393
393
|
- app/views/ish_manager/application/_search.haml
|
394
394
|
- app/views/ish_manager/application/home.haml
|
395
395
|
- app/views/ish_manager/application_mailer/shared_galleries.html.erb
|
396
|
+
- app/views/ish_manager/application_mailer/test_email.html.erb
|
396
397
|
- app/views/ish_manager/application_mailer/welcome.html.erb
|
397
398
|
- app/views/ish_manager/categories/_subtree.haml
|
398
399
|
- app/views/ish_manager/categories/index.haml
|
@@ -447,7 +448,7 @@ files:
|
|
447
448
|
- app/views/ish_manager/email_templates/iframe_src.haml
|
448
449
|
- app/views/ish_manager/email_templates/index.haml
|
449
450
|
- app/views/ish_manager/email_templates/new.haml
|
450
|
-
- app/views/ish_manager/email_templates/plain.html.erb
|
451
|
+
- app/views/ish_manager/email_templates/plain.html.erb-trash
|
451
452
|
- app/views/ish_manager/email_templates/show.haml
|
452
453
|
- app/views/ish_manager/email_unsubscribes/new.haml
|
453
454
|
- app/views/ish_manager/galleries/_form.haml
|
@@ -539,6 +540,7 @@ files:
|
|
539
540
|
- app/views/ish_manager/reports/show.haml
|
540
541
|
- app/views/ish_manager/scheduled_actions/_form_mini.haml
|
541
542
|
- app/views/ish_manager/scheduled_email_actions/_form.haml
|
543
|
+
- app/views/ish_manager/scheduled_email_actions/_form_mini.haml-trash
|
542
544
|
- app/views/ish_manager/scheduled_email_actions/edit.haml
|
543
545
|
- app/views/ish_manager/scheduled_email_actions/index.haml
|
544
546
|
- app/views/ish_manager/scheduled_email_actions/new.haml
|
File without changes
|