ish_manager 0.1.8.376 → 0.1.8.377

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0ff9a276e00c2464f92167105e1cb686a92433a33979e8ee2f1f9d4d461dd29
4
- data.tar.gz: 2ab57d283b26b74871533704e3369ddf72cb2c4f1b14e34dc23c35f539a6491a
3
+ metadata.gz: 5421ad5b4dc558f6e168566d8bacc5db35ab266e1701abf9cfc5e7fefe605fd1
4
+ data.tar.gz: fdd493de49a5ace572f87d31f3c61d607bf205c793998f9136ec77a08ae1c7c8
5
5
  SHA512:
6
- metadata.gz: 9028d3cdd8091a7bc6e458174d71baeb1428d0e40067bddb05d0069f63fa31fa97795b08756b72b3c6000dc63e741fc34e48f1d0726b4b381b133625e8dd4b47
7
- data.tar.gz: '082dd5da46c2d5c5620236f898d2e44fdb3252421d7be3a2f5d339addd205fff5a19c5c8aa86e6fd4784f9ebf10d1d1b8e9686037ec3a93d280c0556421fae29'
6
+ metadata.gz: 1ebe7d90b2bca5b0f029dd7e462ca72c338a61fd513f120ec2e645cd589c17572cdf9650c84a6404be263a74fe74e672fbfc2d7aa412813d6ef3f57fab6fc61d
7
+ data.tar.gz: 896955dcb964096acd99ddf8ef71e019ba213bf917b5291378d07584b203966dad014c30ea798e73fbd16c650b8c5d9a7916a9faa28125ed0ddbb2a7d874a261
@@ -187,6 +187,14 @@ table.dataTable {
187
187
 
188
188
 
189
189
  /* E */
190
+ .eg {
191
+ font-size: 0.8em;
192
+
193
+ &:before {
194
+ content: "e.g. ";
195
+ }
196
+ }
197
+
190
198
  .error_explanation {
191
199
  border: 1px solid red;
192
200
  padding: .8em;
@@ -4,6 +4,7 @@
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,
@@ -25,7 +25,6 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
25
25
  def edit
26
26
  @sch = Sch.find params[:id]
27
27
  authorize! :edit, @sch
28
-
29
28
  end
30
29
 
31
30
  def index
@@ -38,5 +37,23 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
38
37
  authorize! :scheduled_emails_new, @scheduled_email_action
39
38
  end
40
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
+
41
58
  end
42
59
 
@@ -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 Email Actions', 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
@@ -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-edit.max-width
2
+ .email-actions-edit
3
3
  .header
4
4
  %h2.title Edit Email Action
5
5
 
@@ -15,7 +15,8 @@
15
15
  %table.bordered.data-table
16
16
  %thead
17
17
  %tr
18
- %th.actions Actions
18
+ %th.actions
19
+ %th.from From
19
20
  %th.to To
20
21
  %th.subject Subject
21
22
  %th.template Template
@@ -30,12 +31,15 @@
30
31
  - else
31
32
  = link_to '[~]', edit_email_context_path(ctx)
32
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}"
33
36
  %td= ctx.to_email
34
37
  %td
35
- = link_to ctx.subject, email_context_path(ctx)
38
+ = link_to email_context_path(ctx) do
39
+ = ctx.subject ? ctx.subject : "t| #{ctx.tmpl.subject}"
36
40
  %td= ctx.email_template.slug
37
- %td= ctx.created_at.strftime('%Y-%m-%d')
38
- %td= ctx.updated_at.strftime('%Y-%m-%d')
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')
39
43
 
40
44
 
41
45
  = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
@@ -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
@@ -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
 
@@ -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
@@ -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
 
@@ -10,8 +10,13 @@
10
10
  .items
11
11
  - @scheduled_email_actions.each do |sch|
12
12
  .item
13
- <b>Lead:</b> #{link_to sch.lead.email, lead_path(sch.lead)}
13
+ .flex-row
14
+ .gray= sch.id
15
+ = link_to '[~]', edit_scheduled_email_action_path(sch)
16
+
14
17
  %ul
15
- -# %li= sch.interval
18
+ %li <b>Act:</b> #{link_to sch.email_action.slug, edit_email_action_path(sch.email_action)}
16
19
  %li <b>Tmpl:</b> #{sch.email_action.email_template.slug}
17
- %li <b>Lead:</b> #{sch.lead.email}
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}
@@ -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,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.376
4
+ version: 0.1.8.377
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -571,7 +571,7 @@ files:
571
571
  - lib/systemd/system/README.txt
572
572
  - lib/systemd/system/stockwatcher.service
573
573
  - lib/systemd/system/watch_stocks.service
574
- - lib/tasks/done/migrate.rake
574
+ - lib/tasks-done/migrate.rake
575
575
  - lib/tasks/ish_manager_tasks.rake
576
576
  - lib/tasks/office_tasks.rake
577
577
  homepage: http://wasya.co
File without changes