ish_manager 0.1.8.374 → 0.1.8.377

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ish_manager/application.js +0 -1
  3. data/app/assets/stylesheets/ish_manager/application.scss +19 -7
  4. data/app/assets/stylesheets/ish_manager/email.scss +5 -2
  5. data/app/assets/stylesheets/ish_manager/email_contexts.scss +12 -11
  6. data/app/assets/stylesheets/ish_manager/email_conversations.scss +12 -0
  7. data/app/assets/stylesheets/ish_manager/scheduled_actions_emails.scss +6 -5
  8. data/app/controllers/ish_manager/application_controller.rb +1 -1
  9. data/app/controllers/ish_manager/email_contexts_controller.rb +8 -9
  10. data/app/controllers/ish_manager/email_conversations_controller.rb +0 -2
  11. data/app/controllers/ish_manager/email_templates_controller.rb +0 -3
  12. data/app/controllers/ish_manager/leads_controller.rb +5 -4
  13. data/app/controllers/ish_manager/leadsets_controller.rb +0 -2
  14. data/app/controllers/ish_manager/scheduled_email_actions_controller.rb +23 -2
  15. data/app/helpers/ish_manager/application_helper.rb +2 -1
  16. data/app/views/ish_manager/application/_main_header_admin.haml +15 -13
  17. data/app/views/ish_manager/application/_paginate.haml +4 -1
  18. data/app/views/ish_manager/email_actions/_form.haml +11 -7
  19. data/app/views/ish_manager/email_actions/index.haml +2 -2
  20. data/app/views/ish_manager/email_actions/new.haml +1 -1
  21. data/app/views/ish_manager/email_contexts/_form_reply.haml +17 -0
  22. data/app/views/ish_manager/email_contexts/index.haml +32 -23
  23. data/app/views/ish_manager/email_contexts/show.haml +1 -1
  24. data/app/views/ish_manager/email_conversations/show.haml +9 -13
  25. data/app/views/ish_manager/email_templates/_form.haml +5 -7
  26. data/app/views/ish_manager/email_templates/_index.haml +4 -11
  27. data/app/views/ish_manager/email_templates/_plain.html.erb +4 -0
  28. data/app/views/ish_manager/email_templates/iframe_src.haml +2 -4
  29. data/app/views/ish_manager/email_templates/new.haml +4 -3
  30. data/app/views/ish_manager/email_templates/plain.html.erb +1 -1
  31. data/app/views/ish_manager/leads/_index_rows.haml +11 -0
  32. data/app/views/ish_manager/leads/index.haml +11 -10
  33. data/app/views/ish_manager/leads/show.haml +48 -0
  34. data/app/views/ish_manager/scheduled_email_actions/_form.haml +1 -1
  35. data/app/views/ish_manager/scheduled_email_actions/edit.haml +4 -0
  36. data/app/views/ish_manager/scheduled_email_actions/index.haml +13 -6
  37. data/app/views/layouts/ish_manager/application.haml +4 -6
  38. data/app/views/layouts/ish_manager/{application_fullwidth.haml → done/20230316 application.haml } +6 -4
  39. data/lib/tasks/office_tasks.rake +37 -1
  40. metadata +23 -5
  41. data/app/views/ish_manager/email_templates/_form_reply_2_mini.haml +0 -15
  42. /data/lib/{tasks/done → tasks-done}/migrate.rake +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b64d928f290a56cb8566d6e3e41883fbdffa45342900d55cc86d2ac650b01f
4
- data.tar.gz: f6c64a2bf55a68bfe3ececa0d03ae3b89761db23b29fcb0ebcf1a5fc445b4eec
3
+ metadata.gz: 5421ad5b4dc558f6e168566d8bacc5db35ab266e1701abf9cfc5e7fefe605fd1
4
+ data.tar.gz: fdd493de49a5ace572f87d31f3c61d607bf205c793998f9136ec77a08ae1c7c8
5
5
  SHA512:
6
- metadata.gz: 1b871f0b6e1c35d5dae63efbd7c92f940bfb4cca42e0d0fa132448276db4789594d8644d94ac92f09a4f9d75001c34eac080de100eebf0147a15880df9f29214
7
- data.tar.gz: 726aded514ecd4998a7be06d37488afa6688020fe4f28d1b3feb5dfcaa3f31ae7e00f1580225ccbb404123f7e16d909dc422a6148b1e32fca6c0c69a6d3fe5cc
6
+ metadata.gz: 1ebe7d90b2bca5b0f029dd7e462ca72c338a61fd513f120ec2e645cd589c17572cdf9650c84a6404be263a74fe74e672fbfc2d7aa412813d6ef3f57fab6fc61d
7
+ data.tar.gz: 896955dcb964096acd99ddf8ef71e019ba213bf917b5291378d07584b203966dad014c30ea798e73fbd16c650b8c5d9a7916a9faa28125ed0ddbb2a7d874a261
@@ -106,7 +106,6 @@ $(function () {
106
106
  pageLength: 10,
107
107
  lengthMenu: [[10, 25, 100, -1], [10, 25, 100, 'All']],
108
108
  lengthChange: true,
109
- "aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]]
110
109
  }
111
110
  $('#dataTable').DataTable(_props)
112
111
  $('.data-table').DataTable(_props)
@@ -25,11 +25,15 @@
25
25
  **/
26
26
 
27
27
  a[target='_blank'] {
28
+ display: flex;
29
+
28
30
  &::before {
29
- content: '[ '
31
+ content: '[ ';
32
+ display: inline;
30
33
  }
31
34
  &::after {
32
35
  content: ' ^]';
36
+ display: inline;
33
37
  // content: ' ^]' !important;
34
38
  // font-size: .5em;
35
39
  }
@@ -74,6 +78,10 @@ ul:not(.browser-default).bullets, {
74
78
  // border: 1px solid red !important;
75
79
  // display: none !important;
76
80
  }
81
+ .expand-hide {
82
+ display: none;
83
+ position: absolute;
84
+ }
77
85
 
78
86
  .alert {
79
87
  border: 1px solid red;
@@ -162,8 +170,8 @@ table.bordered {
162
170
  /* D */
163
171
 
164
172
  table.dataTable {
165
- border: 1px solid red;
166
- padding: 1em;
173
+ // border: 1px solid red;
174
+ // padding: 1em;
167
175
  border-radius: 5px;
168
176
  box-sizing: border-box;
169
177
  background: white;
@@ -179,6 +187,14 @@ table.dataTable {
179
187
 
180
188
 
181
189
  /* E */
190
+ .eg {
191
+ font-size: 0.8em;
192
+
193
+ &:before {
194
+ content: "e.g. ";
195
+ }
196
+ }
197
+
182
198
  .error_explanation {
183
199
  border: 1px solid red;
184
200
  padding: .8em;
@@ -217,10 +233,6 @@ table.dataTable {
217
233
  .hide, .hidden {
218
234
  display: none !important;
219
235
  }
220
- .hide-expand {
221
- display: none;
222
- position: absolute;
223
- }
224
236
 
225
237
  /* I */
226
238
  img.img-400 {
@@ -4,12 +4,15 @@
4
4
  .email-actions-index,
5
5
  .email-filters-index,
6
6
  .email-templates-edit,
7
+ .email-templates-new,
7
8
  .email-templates-show,
8
9
  .email-contexts-edit,
9
10
  .email-contexts-show,
10
11
  .emails-ns, // emails namespace
11
12
  .leads-edit,
12
- .leads-index {
13
+ .leads-index,
14
+ .leads-show,
15
+ .scheduled-emails-index {
13
16
  .header {
14
17
  display: flex;
15
18
  justify-content: center;
@@ -24,7 +27,7 @@
24
27
  // display: flex;
25
28
  // flex-direction: column;
26
29
 
27
- max-width: 400px;
30
+ // max-width: 400px; // @TODO: where is this used?!
28
31
 
29
32
  margin-left: 20px;
30
33
 
@@ -56,20 +56,21 @@
56
56
 
57
57
  .email-contexts-index {
58
58
 
59
- > .collapse-expand {
59
+ > .header {
60
60
  display: flex;
61
61
  justify-content: center;
62
62
 
63
- .header {
64
- a {
65
- &:before {
66
- content: '[';
67
- }
68
- &:after {
69
- content: ']';
70
- }
71
- }
72
- }
63
+ // .title {
64
+ // a {
65
+ // &:before {
66
+ // content: '[';
67
+ // }
68
+ // &:after {
69
+ // content: ']';
70
+ // }
71
+ // }
72
+ // }
73
+
73
74
  }
74
75
 
75
76
 
@@ -65,6 +65,13 @@
65
65
  }
66
66
  }
67
67
 
68
+ .leads {
69
+ .item {
70
+ border: 1px solid green;
71
+ // background: cyan;
72
+ }
73
+ }
74
+
68
75
  // these are inside a conversation. _vp_ 2023-02-28
69
76
  .messages {
70
77
  // border: 1px solid red;
@@ -149,6 +156,11 @@
149
156
  border: 1px solid cyan;
150
157
  }
151
158
 
159
+ .subject {
160
+ margin: 0 1em;
161
+ font-weight: bold;
162
+ }
163
+
152
164
  .tags {
153
165
  display: flex;
154
166
  flex-direction: column;
@@ -1,9 +1,9 @@
1
1
 
2
- .scheduled-email-actions--form {
3
- display: none;
4
- position: absolute;
5
- min-width: 250px;
6
- }
2
+ // .scheduled-email-actions--form {
3
+ // display: none;
4
+ // position: absolute;
5
+ // min-width: 250px;
6
+ // }
7
7
 
8
8
  .scheduled-emails-new {
9
9
 
@@ -22,6 +22,7 @@
22
22
 
23
23
  .scheduled-actions--form-mini {
24
24
  display: inline-block;
25
+ background: #ccc;
25
26
 
26
27
  form {
27
28
  border: 1px solid blue;
@@ -11,7 +11,7 @@ module IshManager
11
11
 
12
12
  def home
13
13
  authorize! :home, IshManager::Ability
14
- render 'home', layout: 'ish_manager/application_fullwidth'
14
+ render 'home'
15
15
  end
16
16
 
17
17
  #
@@ -1,15 +1,19 @@
1
1
 
2
2
  class ::IshManager::EmailContextsController < ::IshManager::ApplicationController
3
3
 
4
- # alphabetized : )
4
+ # Alphabetized : )
5
5
 
6
6
  before_action :set_lists
7
7
 
8
8
  def create
9
- authorize! :create, ::Ish::EmailContext
10
9
  pparams = params[:ish_email_context].permit!
11
- pparams[:tmpl] = JSON.parse(pparams[:tmpl])
12
- @ctx = ::Ish::EmailContext.new pparams
10
+ @ctx = ::Ish::EmailContext.new pparams
11
+ @tmpl = ::Ish::EmailTemplate.find @ctx.email_template_id
12
+
13
+ @ctx.from_email ||= @tmpl.from_email
14
+ @ctx.subject ||= @tmpl.subject
15
+
16
+ authorize! :create, @ctx
13
17
  if @ctx.save
14
18
  flash[:notice] = 'Saved.'
15
19
  redirect_to action: 'show', id: @ctx.id
@@ -55,7 +59,6 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
55
59
  authorize! :iframe_src, @ctx
56
60
  @tmpl = @email_template = @ctx.email_template
57
61
  @lead = @ctx.lead
58
- # @body = @ctx.body_templated
59
62
  render "ish_manager/email_templates/_#{@tmpl.layout}", layout: false
60
63
  end
61
64
 
@@ -71,10 +74,6 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
71
74
  @lead = Lead.find params[:lead_id]
72
75
  @ctxs = @ctxs.where( to_email: @lead.email )
73
76
  end
74
-
75
- @ctxs = @ctxs.page( params[Ish::EmailContext::PAGE_PARAM_NAME] )
76
-
77
- render layout: 'ish_manager/application_fullwidth'
78
77
  end
79
78
 
80
79
  def new
@@ -1,8 +1,6 @@
1
1
 
2
2
  class ::IshManager::EmailConversationsController < IshManager::ApplicationController
3
3
 
4
- layout 'ish_manager/application_fullwidth'
5
-
6
4
  before_action :set_lists
7
5
 
8
6
  def index
@@ -28,9 +28,6 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
28
28
  def edit
29
29
  @tmpl = @email_template = Ish::EmailTemplate.where({ id: params[:id] }).first
30
30
  authorize! :edit, @tmpl
31
-
32
- # @ctx = @email_context = Ish::EmailContext.new
33
- render layout: 'ish_manager/application_fullwidth'
34
31
  end
35
32
 
36
33
  def iframe_src
@@ -3,8 +3,6 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
- layout 'ish_manager/application_fullwidth'
7
-
8
6
  ## alphabetized : )
9
7
 
10
8
  def bulkop
@@ -127,8 +125,11 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
127
125
  end
128
126
 
129
127
  def show
130
- authorize! :redirect, IshManager::Ability
131
- redirect_to :action => :edit, :id => params[:id]
128
+ @lead = Lead.find params[:id]
129
+ authorize! :show, @lead
130
+ @schs = Sch.where( lead_id: @lead.id )
131
+ @ctxs = Ctx.where( lead_id: @lead.id )
132
+ @msgs = Msg.where( from: @lead.email )
132
133
  end
133
134
 
134
135
  def update
@@ -42,8 +42,6 @@ class ::IshManager::LeadsetsController < IshManager::ApplicationController
42
42
  # else
43
43
  # @leadsets = @leadsets.where( :is_done => false )
44
44
  # end
45
-
46
- render layout: 'ish_manager/application_fullwidth'
47
45
  end
48
46
 
49
47
  def new
@@ -3,8 +3,6 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
3
3
 
4
4
  before_action :set_lists
5
5
 
6
- layout 'ish_manager/application_fullwidth'
7
-
8
6
  def create
9
7
  puts! params, 'params'
10
8
 
@@ -24,6 +22,11 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
24
22
  redirect_to request.referrer ? request.referrer : leadsets_path
25
23
  end
26
24
 
25
+ def edit
26
+ @sch = Sch.find params[:id]
27
+ authorize! :edit, @sch
28
+ end
29
+
27
30
  def index
28
31
  authorize! :scheduled_emails_index, ::IshManager
29
32
  @scheduled_email_actions = ::Office::ScheduledEmailAction.all
@@ -34,5 +37,23 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
34
37
  authorize! :scheduled_emails_new, @scheduled_email_action
35
38
  end
36
39
 
40
+ def show
41
+ @sch = Sch.find params[:id]
42
+ authorize! :show, @sch
43
+ redirect_to action: 'edit'
44
+ end
45
+
46
+ def update
47
+ @sch = Sch.find params[:id]
48
+ authorize! :update, @sch
49
+ flag = @sch.update_attributes( params[:sch].permit! )
50
+ if flag
51
+ flash[:notice] = "Success."
52
+ else
53
+ flash[:alert] = "No luck: #{@sch.errors.full_messages.join(',')}."
54
+ end
55
+ render action: 'edit'
56
+ end
57
+
37
58
  end
38
59
 
@@ -49,7 +49,8 @@ module IshManager
49
49
  end
50
50
 
51
51
  def pretty_date date
52
- date.to_s[0, 10]
52
+ # date.to_s[0, 10]
53
+ date&.strftime('%Y-%m-%d')
53
54
  end
54
55
  def pp_date a; pretty_date a; end
55
56
 
@@ -44,29 +44,31 @@
44
44
  = link_to "Inbox (#{Office::EmailConversation.in_inbox.length})", email_conversations_path
45
45
  = link_to '[+]', new_email_context_path
46
46
  %li
47
- = link_to 'Contexts', email_contexts_path
48
- = link_to '[+]', new_email_context_path
49
- = link_to 'unsent', notsent_email_contexts_path
47
+ = link_to "Templates (#{Ish::EmailTemplate.all.count})", email_templates_path
48
+ = link_to '[+]', new_email_template_path
50
49
  %li
51
- = link_to 'Campaigns', email_campaigns_path
52
- = link_to '[+]', new_email_campaign_path
50
+ -# = link_to 'Contexts', email_contexts_path
51
+ = link_to 'Contexts', notsent_email_contexts_path
52
+ = link_to '[+]', new_email_context_path
53
+ -# %li
54
+ -# = link_to 'Campaigns', email_campaigns_path
55
+ -# = link_to '[+]', new_email_campaign_path
53
56
 
54
57
  %li
55
- = link_to 'Scheduled Emails', scheduled_email_actions_path
58
+ = link_to "Sch (#{Sch.active.length})", scheduled_email_actions_path
56
59
  = link_to '[+]', new_scheduled_email_action_path
60
+ = link_to "Email Actions (#{Office::EmailAction.all.length})", email_actions_path
61
+ = link_to '[+]', new_email_action_path
57
62
  %ul
63
+ %li &nbsp;
64
+
58
65
  %li
59
- = link_to "Templates (#{Ish::EmailTemplate.all.count})", email_templates_path
60
- = link_to '[+]', new_email_template_path
61
- %li
62
- = link_to "Leadsets (#{Leadset.kept.length})", leadsets_path
66
+ = link_to "Co's (#{Leadset.kept.length})", leadsets_path
63
67
  = link_to '[+]', new_leadset_path
64
68
  %li
65
69
  = link_to "Leads (#{Lead.kept.length})", leads_path
66
70
  = link_to '[+]', new_lead_path
67
- %li
68
- = link_to "Email Actions (#{Office::EmailAction.all.length})", email_actions_path
69
- = link_to '[+]', new_email_action_path
71
+
70
72
  %li
71
73
  = link_to "Filters (#{Office::EmailFilter.active.length})", email_filters_path
72
74
  = link_to '[+]', new_email_filter_path
@@ -1,4 +1,7 @@
1
1
 
2
2
  -# Used only in email_contexts#index right now. _vp_ 2022-10-06
3
3
 
4
- = paginate resource, param_name: resource.klass::PAGE_PARAM_NAME, views_prefix: 'ish_manager'
4
+ - if resource.respond_to? :total_pages
5
+ = paginate resource, param_name: resource.klass::PAGE_PARAM_NAME, views_prefix: 'ish_manager'
6
+ - else
7
+ -# %label Not paginated.
@@ -23,13 +23,17 @@
23
23
 
24
24
  .col-md-6
25
25
  .field
26
- %label Next in Days
27
- .eg eg: rand(1..5)
28
- = f.text_field :next_in_days
29
- .field
30
- %label Next at Time
31
- .eg eg: rand(8..16).hours + rand(1..59).minutes
32
- = f.text_field :next_at_time
26
+ %label Next At Exe
27
+ .eg rand(1..5).business_days.from_now.to_date + rand(8..16).hours + rand(1..59).minutes
28
+ = f.text_field :next_at_exe
29
+ -# .field
30
+ -# %label Next in Days
31
+ -# .eg eg: rand(1..5)
32
+ -# = f.text_field :next_in_days
33
+ -# .field
34
+ -# %label Next at Time
35
+ -# .eg eg: rand(8..16).hours + rand(1..59).minutes
36
+ -# = f.text_field :next_at_time
33
37
  .field
34
38
  %label Next Email Actions
35
39
  = f.select :next_email_actions, options_for_select( @email_actions_list, selected: act.next_email_actions.map(&:id) ), { }, { class: 'select2', multiple: true }
@@ -1,5 +1,5 @@
1
1
 
2
- .email-actions-index
2
+ .email-actions-index.max-width
3
3
 
4
4
  .header
5
5
  %h2.title
@@ -9,7 +9,7 @@
9
9
  %table.bordered
10
10
  %tr
11
11
  %th= check_box_tag 'abba'
12
- %th actions
12
+ %th
13
13
  %th slug
14
14
  %th descr
15
15
  %th next actions
@@ -1,5 +1,5 @@
1
1
 
2
- .email-actions-new
2
+ .email-actions-new.max-width
3
3
  .header
4
4
  %h2.title
5
5
  New Email Action
@@ -0,0 +1,17 @@
1
+
2
+ .email-contexts--form-reply.form-mini
3
+ = form_for ::Ish::EmailContext.new, url: email_contexts_path do |f|
4
+ = hidden_field_tag 'ish_email_context[lead_id]', lead.id
5
+ To: #{lead.email}
6
+ .field
7
+ -# = f.label :template
8
+ = f.select :email_template_id, options_for_select( @email_templates_list )
9
+ .action
10
+ = f.submit 'Reply'
11
+
12
+ .field.send-at
13
+ -# = f.label :send_at
14
+ = f.text_field :send_at, placeholder: 'YYYY-MM-DD', value: 1.business_day.after(Time.now).strftime('%Y-%m-%d'), size: 10, class: 'input-date'
15
+
16
+ .action
17
+ = f.submit 'Schedule'
@@ -1,36 +1,45 @@
1
1
 
2
2
  .email-contexts-index.padded
3
3
 
4
- .collapse-expand#emailContextsIndex
5
- %h2.header
6
- Paginated Email Contexts (#{@ctxs.length})
4
+ .header.collapse-expand-trash#emailContextsIndex
5
+ %h2.title
6
+ Email Contexts (#{@ctxs.length})
7
7
  - if @lead
8
8
  For lead `#{@lead.name}`
9
- = link_to '+', new_email_context_path
10
- = link_to 'unsent', notsent_email_contexts_path
9
+ = link_to '[+]', new_email_context_path
10
+ = link_to '[unsent]', notsent_email_contexts_path
11
11
 
12
12
  .W0
13
13
  = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
14
14
 
15
- %table.bordered
16
- %tr
17
- %th.actions Actions
18
- %th.to To
19
- %th.subject Subject
20
- %th.template Template
21
- - @ctxs.each do |ctx|
15
+ %table.bordered.data-table
16
+ %thead
22
17
  %tr
23
- %td
24
- - if ctx.sent_at
25
- [~]
26
- - else
27
- = link_to '[~]', edit_email_context_path(ctx)
28
- = button_to '[x]', email_context_path(ctx), method: :delete, form_class: :inline, data: { confirm: 'Are you sure?' }
29
- %td= ctx.to_email
30
- %td
31
- = link_to ctx.subject, email_context_path(ctx)
32
- -# = link_to 'iframe', email_context_iframe_path(ctx), target: :_blank do
33
- %td= ctx.email_template.slug
18
+ %th.actions
19
+ %th.from From
20
+ %th.to To
21
+ %th.subject Subject
22
+ %th.template Template
23
+ %th.created_at Created at
24
+ %th.updated_at Updated at
25
+ %tbody
26
+ - @ctxs.each do |ctx|
27
+ %tr
28
+ %td
29
+ - if ctx.sent_at
30
+ [~]
31
+ - else
32
+ = link_to '[~]', edit_email_context_path(ctx)
33
+ = button_to '[x]', email_context_path(ctx), method: :delete, form_class: :inline, data: { confirm: 'Are you sure?' }
34
+ %td
35
+ = ctx.from_email ? ctx.from_email : "t| #{ctx.tmpl.from_email}"
36
+ %td= ctx.to_email
37
+ %td
38
+ = link_to email_context_path(ctx) do
39
+ = ctx.subject ? ctx.subject : "t| #{ctx.tmpl.subject}"
40
+ %td= ctx.email_template.slug
41
+ %td= ctx.created_at.strftime('%Y-%m-%d %l:%M%P %:z')
42
+ %td= ctx.updated_at.strftime('%Y-%m-%d %l:%M%P %:z')
34
43
 
35
44
 
36
45
  = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
@@ -7,7 +7,7 @@
7
7
  .col-md-4
8
8
  %ul
9
9
  %li <b>From:</b> #{@ctx.from_email}
10
- %li <b>To Lead:</b> #{@ctx.lead_id ? @ctx.lead.email : '-'}
10
+ %li <b>To Lead:</b> #{link_to @ctx.lead.email, lead_path(@ctx.lead)}
11
11
  %li <b>Subject:</b> #{@ctx.subject}
12
12
 
13
13
  .col-md-4
@@ -2,28 +2,24 @@
2
2
  .email-conversations-show
3
3
 
4
4
  .header.max-width
5
- %i.material-icons mail
6
- Inbox (#{Office::EmailConversation.all.length})
5
+ -# %i.material-icons mail
7
6
 
8
7
  = link_to '[<<-]', email_conversations_path
9
- -# = link_to '[<-]', email_conversations_path
10
- #{@email_conversation.subject}
8
+
9
+ .subject #{@email_conversation.subject}
11
10
  (#{@email_conversation.email_messages.all.count})
12
11
 
13
12
  .tags.max-width
14
- Tags:
13
+ Tags (#{@email_conversation.tags.length}):
15
14
  = @email_conversation.wp_term_ids
16
15
  = @email_conversation.tags.map(&:name).join(", ")
17
16
 
18
17
  .leads.max-width
19
18
  Leads (#{@email_conversation.leads.length}):
20
- %ul
21
- - @email_conversation.leads.each do |p|
22
- %li
23
- = p.email
24
- [existing actions?]
25
- = render 'ish_manager/email_templates/form_reply_2_mini'
26
- = render 'ish_manager/scheduled_actions/form_mini'
19
+ = @email_conversation.leads.map(&:id)
20
+ .leadsC
21
+ = render 'ish_manager/leads/index_rows', leads: @email_conversation.leads
22
+
27
23
 
28
24
 
29
25
  .messages.max-width
@@ -59,7 +55,7 @@
59
55
  %iframe{ name: msg.message_id }
60
56
 
61
57
  .my-actions.hide
62
- = render 'ish_manager/email_templates/form_reply_2_mini'
58
+ = render 'ish_manager/email_contexts/form_reply', lead: lead
63
59
  -# = button_to 'Reply'
64
60
  -# = button_to 'Reply All'
65
61
  -# = button_to 'New Template'
@@ -2,10 +2,6 @@
2
2
  - url = email_template.new_record? ? email_templates_path : email_template_path(email_template.id)
3
3
 
4
4
  .email-templates--form
5
-
6
- .header
7
- %h2 Email Template
8
-
9
5
  = form_for email_template, url: url do |f|
10
6
  .row
11
7
  .col-md-4
@@ -35,7 +31,9 @@
35
31
  .tab-raw
36
32
  = f.text_area :body
37
33
  .tab-preview
38
- -# .descr= render "ish_manager/email_templates/#{email_template.layout}", ctx: Ish::EmailContext.new, tmpl: email_template
39
- %iframe{ src: email_template_iframe_path(email_template), width: '100%', height: '100%' }
34
+ - if email_template.persisted?
35
+ -# .descr= render "ish_manager/email_templates/#{email_template.layout}", ctx: Ish::EmailContext.new, tmpl: email_template
36
+ %iframe{ src: email_template_iframe_path(email_template), width: '100%', height: '100%' }
40
37
  .actions
41
- = f.submit 'Save'
38
+ = f.submit 'Save'
39
+
@@ -1,18 +1,15 @@
1
1
 
2
2
  %h3.center.collapse-expand#emailTemplatesIndex
3
3
  Email Templates (#{Ish::EmailTemplate.all.count})
4
- .email-templates-index
5
-
6
- -# = render 'ish_manager/email_templates/form_mini'
7
4
 
5
+ .email-templates-index.max-width
8
6
  %table.bordered
9
7
  %tr
10
- %th Actions
8
+ %th
11
9
  %th Slug
12
10
  %th Created
13
11
  %th Updated
14
12
 
15
-
16
13
  - @templates.each do |tmpl|
17
14
  %tr
18
15
  %td
@@ -20,10 +17,6 @@
20
17
  = link_to '[~]', edit_email_template_path({ id: tmpl })
21
18
  = button_to '[x]', email_template_path({ id: tmpl }), method: :delete, :data => { :confirm => 'Are you sure?' }, form_class: 'inline'
22
19
  %td= link_to tmpl.slug, email_template_path({ id: tmpl })
23
- %td= tmpl.created_at
24
- %td= tmpl.updated_at
25
-
26
- -# = link_to 'iFrame', email_template_iframe_path({ id: tmpl }), target: :_blank
27
-
28
- %hr
20
+ %td= pp_date tmpl.created_at
21
+ %td= pp_date tmpl.updated_at
29
22
 
@@ -0,0 +1,4 @@
1
+
2
+
3
+ <%= raw @tmpl.body %>
4
+
@@ -1,5 +1,3 @@
1
1
 
2
- - if @email_template.layout == 'plain'
3
- = raw @email_template.body
4
- - else
5
- = render "ish_manager/email_templates/#{@email_template.layout}", ctx: @email_ctx
2
+ -# = render "ish_manager/email_templates/#{@email_template.layout}", ctx: @ctx
3
+ = render "ish_manager/email_templates/#{@email_template.layout}"
@@ -1,5 +1,6 @@
1
1
 
2
+ .email-templates-new.max-width
3
+ .header
4
+ %h2.title New Email Template
2
5
 
3
- %h1 New Email Template
4
-
5
- = render 'form', email_template: @new_email_template
6
+ = render 'form', email_template: @new_email_template
@@ -1,4 +1,4 @@
1
1
 
2
2
 
3
- <%= raw @body %>
3
+ <%= raw @tmpl.body %>
4
4
 
@@ -0,0 +1,11 @@
1
+
2
+ .leads--index-rows
3
+ - leads.each do |lead|
4
+ .item
5
+ = link_to lead.email, lead_path(lead)
6
+ \(#{lead.scheduled_email_actions.length} sch
7
+ %span.expand-next [+]
8
+ .expand-hide= render 'ish_manager/scheduled_actions/form_mini'
9
+ \)
10
+ %span.expand-next [reply]
11
+ .expand-hide= render 'ish_manager/email_contexts/form_reply', lead: lead
@@ -11,7 +11,7 @@
11
11
  -# = select_tag :email_campaign_id, options_for_select( @email_campaigns_list )
12
12
  = submit_tag 'Go'
13
13
 
14
- %table.bordered
14
+ %table.bordered.data-table
15
15
  %thead
16
16
  %tr
17
17
  %th &nbsp;
@@ -19,8 +19,8 @@
19
19
  %th Company
20
20
  %th Tag
21
21
  %th created_at
22
- %th (c,s) sends
23
- %th Scheduled Actions
22
+ %th Ctx
23
+ %th Sch
24
24
 
25
25
  %tbody
26
26
  - @leads.each do |lead|
@@ -30,15 +30,16 @@
30
30
  %td= lead.company.company_url
31
31
  %td= lead.wp_tags.map(&:name).join(", ")
32
32
  %td= lead.created_at.to_s[0..10]
33
- %td #{lead.email_campaign_leads.count || '-'}, #{@email_contexts[lead.email] || '-'}
34
- %td
33
+ %td.ctx
34
+ = @email_contexts[lead.email] || '-'
35
+ %td.sch
35
36
  = lead.scheduled_email_actions.length
36
37
  = link_to '[+]', new_scheduled_email_action_path( lead_id: lead.id )
37
- %ul
38
- - lead.scheduled_email_actions.map do |sch_a|
39
- %li
40
- = link_to sch_a.email_action.slug, edit_scheduled_email_action_path( sch_a )
41
- [x]
38
+ -# %ul
39
+ -# - lead.scheduled_email_actions.map do |sch_a|
40
+ -# %li
41
+ -# = link_to sch_a.email_action.slug, edit_scheduled_email_action_path( sch_a )
42
+ -# [x]
42
43
 
43
44
 
44
45
 
@@ -0,0 +1,48 @@
1
+
2
+ .leads-show
3
+
4
+ .header
5
+ %h2.title
6
+ Lead ##{@lead.id}
7
+ = link_to '[~]', edit_lead_path(@lead)
8
+
9
+ %ul
10
+ %li Name: #{@lead.name}
11
+ %li Email: #{@lead.email}
12
+
13
+ .row
14
+ .col-md-6.ctxs
15
+ %h5
16
+ Email Contexts (#{@ctxs.length})
17
+ = link_to '[new]', '#'
18
+ %ul
19
+ - @ctxs.each do |ctx|
20
+ %li
21
+ = link_to ctx.subject, email_context_path(ctx)
22
+ = pp_date ctx.sent_at
23
+ .col-md-6.schs
24
+ %h5
25
+ Scheduled actions (#{@schs.length})
26
+ = link_to '[new]', '#'
27
+ %ul
28
+ - @schs.each do |sch|
29
+ %li
30
+ = link_to sch.email_action.slug, edit_scheduled_email_action_path(sch)
31
+ = sch.state
32
+
33
+
34
+ (#{link_to 'prototype', edit_email_action_path(sch.email_action)})
35
+
36
+ In #{sch.email_action.next_in_days} days at #{sch.email_action.next_at_time}
37
+
38
+
39
+ .row
40
+ .col-md-12.msgs
41
+ %h5 Email Messages (#{@msgs.length})
42
+ %ul
43
+ - @msgs.each do |msg|
44
+ %li= link_to msg.subject, email_conversation_path( msg.conv )
45
+
46
+
47
+
48
+
@@ -7,7 +7,7 @@
7
7
  - url = sch_a.new_record? ? scheduled_email_actions_path : scheduled_email_action_path(sch_a.id)
8
8
 
9
9
  .scheduled-email-actions--form
10
- = form_for scheduled_email_action, url: url, html: { class: "form-mini" } do |f|
10
+ = form_for scheduled_email_action, url: url, as: :sch, html: { class: "form-mini" } do |f|
11
11
  .header
12
12
  %h5.title Schedule an email action
13
13
 
@@ -0,0 +1,4 @@
1
+
2
+ .scheduled-email-actions-edit.max-width
3
+
4
+ = render 'form', scheduled_email_action: @sch
@@ -2,14 +2,21 @@
2
2
  .scheduled-emails-index.max-width
3
3
  .header
4
4
  %h2
5
- Index
5
+ Scheduled Email Actions
6
6
  -# (#{Sch.kept.count})
7
7
  (#{Sch.all.count})
8
- = link_to '[+]', new_scheduled_email_path
8
+ = link_to '[+]', new_scheduled_email_action_path
9
9
 
10
10
  .items
11
- - @scheduled_emails.each do |sch|
11
+ - @scheduled_email_actions.each do |sch|
12
12
  .item
13
- = sch.interval
14
- = sch.email_template.slug
15
- = sch.lead.email
13
+ .flex-row
14
+ .gray= sch.id
15
+ = link_to '[~]', edit_scheduled_email_action_path(sch)
16
+
17
+ %ul
18
+ %li <b>Act:</b> #{link_to sch.email_action.slug, edit_email_action_path(sch.email_action)}
19
+ %li <b>Tmpl:</b> #{sch.email_action.email_template.slug}
20
+ %li <b>Lead:</b> #{link_to sch.lead.email, lead_path(sch.lead) }
21
+ %li <b>State:</b> #{sch.state}
22
+ %li <b>Perform at:</b> #{sch.perform_at}
@@ -34,13 +34,11 @@
34
34
  = javascript_include_tag "ish_manager/application"
35
35
 
36
36
  = csrf_meta_tags
37
- %body{ class: [ params[:controller].gsub("ish_manager/",""), "#{params[:controller].gsub("ish_manager/","")}-#{params[:action]}", params[:action]] }
38
- .bg-white
39
- = render :partial => "ish_manager/application/main_header_#{@current_profile.role_name}"
40
- .container.W0
41
- = render 'alerts_notices' if notice || alert
42
- = yield
37
+ %body{ class: [ params[:controller].gsub("ish_manager/",""), "#{params[:controller].gsub("ish_manager/","")}-#{params[:action]}", params[:action], "application-fullwidth" ] }
43
38
 
39
+ = render :partial => "ish_manager/application/main_header_#{@current_profile.role_name}"
40
+ = render 'alerts_notices' if notice || alert
41
+ = yield
44
42
  = render 'ish_manager/application/main_footer'
45
43
  = render 'analytics' if Rails.env.production?
46
44
 
@@ -34,11 +34,13 @@
34
34
  = javascript_include_tag "ish_manager/application"
35
35
 
36
36
  = csrf_meta_tags
37
- %body{ class: [ params[:controller].gsub("ish_manager/",""), "#{params[:controller].gsub("ish_manager/","")}-#{params[:action]}", params[:action], "application-fullwidth" ] }
37
+ %body{ class: [ params[:controller].gsub("ish_manager/",""), "#{params[:controller].gsub("ish_manager/","")}-#{params[:action]}", params[:action]] }
38
+ .bg-white
39
+ = render :partial => "ish_manager/application/main_header_#{@current_profile.role_name}"
40
+ .container.W0
41
+ = render 'alerts_notices' if notice || alert
42
+ = yield
38
43
 
39
- = render :partial => "ish_manager/application/main_header_#{@current_profile.role_name}"
40
- = render 'alerts_notices' if notice || alert
41
- = yield
42
44
  = render 'ish_manager/application/main_footer'
43
45
  = render 'analytics' if Rails.env.production?
44
46
 
@@ -6,6 +6,43 @@ end
6
6
 
7
7
  namespace :office do
8
8
 
9
+ desc 'schheduled email actions, rolling perform'
10
+ task :schs => :environment do
11
+ while true do
12
+
13
+ Sch.active.where({ :perform_at.lte => Time.now }).each do |sch|
14
+ sch.update_attributes({ state: Sch::STATE_INACTIVE })
15
+
16
+ # send now
17
+ ctx = Ctx.new({
18
+ email_template_id: sch.act.tmpl.id,
19
+ lead_id: sch.lead.id,
20
+ send_at: Time.now,
21
+ })
22
+ ctx.save!
23
+
24
+ # schedule the next action & update the action
25
+ next_at = eval(sch.act.next_at_exe)
26
+ sch.act.next_email_actions.each do |nxt|
27
+ sch_nxt = Sch.find_or_initialize_by({
28
+ lead_id: sch.lead_id,
29
+ email_action_id: nxt.id,
30
+ })
31
+ sch_nxt.perform_at = next_at
32
+ sch_nxt.state = Sch::STATE_ACTIVE
33
+ sch_nxt.save!
34
+ end
35
+
36
+ print '.'
37
+
38
+ end
39
+
40
+ # sleep 1.minute
41
+ sleep 10.seconds
42
+ print '|'
43
+ end
44
+ end
45
+
9
46
  desc "send emails"
10
47
  task :email_worker => :environment do
11
48
  while true do
@@ -20,7 +57,6 @@ namespace :office do
20
57
  # sleep 1.minute
21
58
  sleep 10.seconds
22
59
  print '^'
23
-
24
60
  end
25
61
  end
26
62
 
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.374
4
+ version: 0.1.8.377
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-16 00:00:00.000000000 Z
11
+ date: 2023-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: business_time
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 0.13.0
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 0.13.0
209
223
  description: Description of IshManager.
210
224
  email:
211
225
  - piousbox@gmail.com
@@ -384,6 +398,7 @@ files:
384
398
  - app/views/ish_manager/email_actions/new.haml
385
399
  - app/views/ish_manager/email_campaign_leads/show.haml
386
400
  - app/views/ish_manager/email_contexts/_form.haml
401
+ - app/views/ish_manager/email_contexts/_form_reply.haml
387
402
  - app/views/ish_manager/email_contexts/edit.haml
388
403
  - app/views/ish_manager/email_contexts/index.haml
389
404
  - app/views/ish_manager/email_contexts/new.haml
@@ -402,7 +417,6 @@ files:
402
417
  - app/views/ish_manager/email_messages/show_stripped.haml
403
418
  - app/views/ish_manager/email_templates/_form.haml
404
419
  - app/views/ish_manager/email_templates/_form_mini.haml
405
- - app/views/ish_manager/email_templates/_form_reply_2_mini.haml
406
420
  - app/views/ish_manager/email_templates/_form_reply_mini.haml
407
421
  - app/views/ish_manager/email_templates/_form_schedule_mini.haml
408
422
  - app/views/ish_manager/email_templates/_index.haml
@@ -415,6 +429,7 @@ files:
415
429
  - app/views/ish_manager/email_templates/_marketing_wordpress_2.html
416
430
  - app/views/ish_manager/email_templates/_piousbox_roundborders.html.erb
417
431
  - app/views/ish_manager/email_templates/_piousbox_social.html.erb
432
+ - app/views/ish_manager/email_templates/_plain.html.erb
418
433
  - app/views/ish_manager/email_templates/_slug-1.html.erb
419
434
  - app/views/ish_manager/email_templates/_slug-2.html.erb
420
435
  - app/views/ish_manager/email_templates/_slug-3.html.erb
@@ -458,9 +473,11 @@ files:
458
473
  - app/views/ish_manager/kaminari/_prev_page.html.erb
459
474
  - app/views/ish_manager/leads/_form.haml
460
475
  - app/views/ish_manager/leads/_form_import.haml
476
+ - app/views/ish_manager/leads/_index_rows.haml
461
477
  - app/views/ish_manager/leads/edit.haml
462
478
  - app/views/ish_manager/leads/index.haml
463
479
  - app/views/ish_manager/leads/new.haml
480
+ - app/views/ish_manager/leads/show.haml
464
481
  - app/views/ish_manager/leadsets/_form.haml
465
482
  - app/views/ish_manager/leadsets/edit.haml
466
483
  - app/views/ish_manager/leadsets/index.haml
@@ -512,6 +529,7 @@ files:
512
529
  - app/views/ish_manager/reports/show.haml
513
530
  - app/views/ish_manager/scheduled_actions/_form_mini.haml
514
531
  - app/views/ish_manager/scheduled_email_actions/_form.haml
532
+ - app/views/ish_manager/scheduled_email_actions/edit.haml
515
533
  - app/views/ish_manager/scheduled_email_actions/index.haml
516
534
  - app/views/ish_manager/scheduled_email_actions/new.haml
517
535
  - app/views/ish_manager/scheduled_email_actions/show.haml
@@ -544,7 +562,7 @@ files:
544
562
  - app/views/ish_manager/videos/new.haml
545
563
  - app/views/ish_manager/videos/show.haml
546
564
  - app/views/layouts/ish_manager/application.haml
547
- - app/views/layouts/ish_manager/application_fullwidth.haml
565
+ - app/views/layouts/ish_manager/done/20230316 application.haml
548
566
  - app/views/layouts/ish_manager/email_iframe.haml
549
567
  - config/routes.rb
550
568
  - lib/ish_manager.rb
@@ -553,7 +571,7 @@ files:
553
571
  - lib/systemd/system/README.txt
554
572
  - lib/systemd/system/stockwatcher.service
555
573
  - lib/systemd/system/watch_stocks.service
556
- - lib/tasks/done/migrate.rake
574
+ - lib/tasks-done/migrate.rake
557
575
  - lib/tasks/ish_manager_tasks.rake
558
576
  - lib/tasks/office_tasks.rake
559
577
  homepage: http://wasya.co
@@ -1,15 +0,0 @@
1
-
2
- .email-templates--form-reply-2-mini.form-mini
3
- = form_for ::Ish::EmailContext.new, url: email_contexts_path do |f|
4
- .field
5
- -# = f.label :template
6
- = f.select :email_template_id, options_for_select( @email_templates_list )
7
- .action
8
- = f.submit 'Reply'
9
-
10
- .field.send-at
11
- -# = f.label :send_at
12
- = f.text_field :send_at, placeholder: 'YYYY-MM-DD', size: 10, class: 'input-date'
13
-
14
- .action
15
- = f.submit 'Schedule'
File without changes