ish_manager 0.1.8.384 → 0.1.8.386

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ish_manager/application.js +1 -1
  3. data/app/assets/javascripts/ish_manager/email_contexts.js +1 -15
  4. data/app/assets/javascripts/ish_manager/email_templates.js +1 -1
  5. data/app/assets/stylesheets/ish_manager/application.scss +7 -0
  6. data/app/assets/stylesheets/ish_manager/email.scss +5 -0
  7. data/app/assets/stylesheets/ish_manager/email_contexts.scss +0 -4
  8. data/app/assets/stylesheets/ish_manager/email_templates.scss +1 -1
  9. data/app/controllers/ish_manager/application_controller.rb +1 -1
  10. data/app/controllers/ish_manager/email_actions_controller.rb +12 -7
  11. data/app/controllers/ish_manager/email_contexts_controller.rb +10 -9
  12. data/app/controllers/ish_manager/scheduled_email_actions_controller.rb +1 -6
  13. data/app/views/ish_manager/email_actions/_form.haml +12 -24
  14. data/app/views/ish_manager/email_actions/edit.haml +1 -1
  15. data/app/views/ish_manager/email_actions/index.haml +10 -4
  16. data/app/views/ish_manager/email_actions/new.haml +1 -1
  17. data/app/views/ish_manager/email_actions/show.haml +3 -0
  18. data/app/views/ish_manager/email_contexts/_form.haml +17 -23
  19. data/app/views/ish_manager/email_contexts/edit.haml +3 -1
  20. data/app/views/ish_manager/email_contexts/iframe_src.haml +4 -0
  21. data/app/views/ish_manager/email_contexts/index.haml +0 -4
  22. data/app/views/ish_manager/email_contexts/new.haml +3 -1
  23. data/app/views/ish_manager/email_contexts/show.haml +7 -6
  24. data/app/views/ish_manager/email_conversations/show.haml +2 -1
  25. data/app/views/ish_manager/email_templates/_form.haml +3 -0
  26. data/app/views/ish_manager/email_templates/_plain.haml +3 -0
  27. data/app/views/ish_manager/email_templates/_wasyaco_roundborders.html.erb +3 -319
  28. data/app/views/ish_manager/email_templates/iframe_src.haml +1 -2
  29. data/app/views/ish_manager/leads/show.haml +5 -8
  30. data/app/views/ish_manager/scheduled_email_actions/_form.haml +7 -3
  31. data/lib/tasks/office_tasks.rake +9 -8
  32. metadata +5 -3
  33. data/app/views/ish_manager/email_templates/_plain.html.erb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bebeac16a23bc0a3d32dfe6ed2f17ffa40f12f5651d2ed96b6c536107982361
4
- data.tar.gz: c0bb4c816f75c97b8baa1c158f340618cb30a594b4eb7366b1a2c6342b1a3af3
3
+ metadata.gz: ad5f6ecf804df03a3acafbff94f1136e5372aed88b43e0949603620cfeb87c30
4
+ data.tar.gz: 7d49e60a9d8ad7f9bd732f02d03ea313232262cb44e56365d671c5665a87f5a9
5
5
  SHA512:
6
- metadata.gz: b963eb5535ea6ff9e746c16a8ede99eddd69bb99147ff02d1426b587eddfbb153afa6fc4867500dcc1cc5cd40688cd1add88f34dc45abbce2fda09f950499719
7
- data.tar.gz: 80c4f372cc882d4bf282128fe4caaa71a8eb4efe037ae471649862f0bb1ce8f618e61a32da87e8756ff256aff72d80f17588ba1b1ec242f45885177c43aa2317
6
+ metadata.gz: 3e2b8b77466307c9e709209632a7013851900dccc7ed29b65e627170ec20be937b9ce58229e76a8d32101b6698516757065927f23b0cb0f8521a89c9ae558054
7
+ data.tar.gz: a16b163f1ba2a29dd335711c8c508104ecf06812661cb82b50460bfc61f64acea6a1346d77643da3ef8cc613f1001c811994c1960bae26246453411dba9f86d0
@@ -91,7 +91,7 @@ $(function () {
91
91
  if (!!$('body').select2) {
92
92
  $('.select2').each(function() {
93
93
  $( this ).select2({
94
- width: '100%'
94
+ width: 'auto',
95
95
  })
96
96
  })
97
97
  }
@@ -3,26 +3,12 @@
3
3
  $(document).ready(() => {
4
4
 
5
5
  if ($(".email-contexts--form").length) {
6
+
6
7
  $("#ish_email_context_email_template_id").on('change', (ev) => {
7
8
  const val = ev.target.value
8
9
  window.location.href = AppRouter.new_email_context_with_template_path(val)
9
10
  })
10
11
 
11
- $("#ish_email_context_type").on('change', (ev) => {
12
- const val = ev.target.value
13
- if (val == 'TYPE_CAMPAIGN') {
14
- $(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
15
- } else {
16
- $(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
17
- }
18
- })
19
- // on page load:
20
- if ($("#ish_email_context_type").val() == 'TYPE_CAMPAIGN') {
21
- $(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
22
- } else {
23
- $(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
24
- }
25
-
26
12
  }
27
13
 
28
14
  })
@@ -1,7 +1,7 @@
1
1
 
2
2
  $(document).ready(() => {
3
3
 
4
- if ($(".email-templates--form").length) {
4
+ if ($(".email-templates--form").length || $(".email-contexts--form").length) {
5
5
  $(".tab-labels > a").click(function() {
6
6
  logg( $(this).data('ref'), 'ref')
7
7
 
@@ -208,6 +208,10 @@ table.dataTable {
208
208
 
209
209
  /* F */
210
210
 
211
+ .flex-grow {
212
+ flex-grow: 1;
213
+ }
214
+
211
215
  .flex-row {
212
216
  display: flex;
213
217
  flex-wrap: wrap;
@@ -327,6 +331,8 @@ textarea.large {
327
331
  margin-top: 1em;
328
332
 
329
333
  flex-grow: 1;
334
+
335
+ z-index: -1;
330
336
  }
331
337
 
332
338
  .max-width {
@@ -400,6 +406,7 @@ textarea.large {
400
406
 
401
407
  .select2-container {
402
408
  max-width: 100%;
409
+ min-width: 250px;
403
410
  display: block;
404
411
  }
405
412
 
@@ -20,6 +20,11 @@
20
20
  }
21
21
  }
22
22
 
23
+ .email-actions--form {
24
+ .select2-container {
25
+ flex-grow: 1;
26
+ }
27
+ }
23
28
 
24
29
  .form-mini {
25
30
 
@@ -24,10 +24,6 @@
24
24
 
25
25
  .field-template {
26
26
  display: flex;
27
-
28
- a.action-view {
29
- width: 150px;
30
- }
31
27
  }
32
28
 
33
29
  textarea {
@@ -1,4 +1,5 @@
1
1
 
2
+ .email-contexts--form,
2
3
  .email-templates--form {
3
4
  form {
4
5
  > .actions {
@@ -9,7 +10,6 @@
9
10
  // border: 1px solid red;
10
11
  margin-top: 1em;
11
12
 
12
-
13
13
  display: flex;
14
14
 
15
15
  > * {
@@ -66,7 +66,7 @@ module IshManager
66
66
 
67
67
  @leads_list = Lead.list
68
68
  @leadsets_list = Leadset.list
69
- @email_actions_list = ::Office::EmailAction.all.map { |a| [ a.slug, a.id ] }
69
+ @email_actions_list = [[nil,nil]] + ::Office::EmailAction.all.map { |a| [ a.slug, a.id ] }
70
70
  @email_templates_list = Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
71
71
  end
72
72
 
@@ -29,6 +29,7 @@ class ::IshManager::EmailActionsController < IshManager::ApplicationController
29
29
 
30
30
  def edit
31
31
  @act = @email_action = Office::EmailAction.find( params[:id] )
32
+ @act.ties.push Office::EmailActionTie.new( next_email_action_id: nil )
32
33
  authorize! :edit, @act
33
34
  end
34
35
 
@@ -43,25 +44,29 @@ class ::IshManager::EmailActionsController < IshManager::ApplicationController
43
44
  end
44
45
 
45
46
  def show
47
+ @act = @email_action = Office::EmailAction.find( params[:id] )
48
+ authorize! :show, @act
46
49
  end
47
50
 
48
51
  def update
49
52
  @act = @email_action = Office::EmailAction.find( params[:id] )
50
53
  authorize! :update, @act
51
54
 
52
- next_ids = params[:email_action].delete(:next_email_actions)
53
- next_ids.delete("")
54
- Office::EmailAction.where(prev_email_action_id: params[:id] ).update_all(prev_email_action_id: nil)
55
- next_ids.each do |next_id|
56
- next_action = ::Office::EmailAction.find next_id
57
- next_action.update_attribute( :prev_email_action_id, params[:id] )
55
+ params[:email_action][:ties_attributes].each do |k, v|
56
+ if !v[:next_email_action_id].present?
57
+ params[:email_action][:ties_attributes].delete( k )
58
+ end
59
+ if v[:to_delete] == "1"
60
+ Actie.find( v[:id] ).delete
61
+ params[:email_action][:ties_attributes].delete( k )
62
+ end
58
63
  end
59
64
 
60
65
  flag = @act.update_attributes( params[:email_action].permit! )
61
66
  if flag
62
67
  flash[:notice] = 'Success'
63
68
  else
64
- flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}"
69
+ flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}. #{@act.ties.map { |t| t.errors.full_messages.join(', ') }.join(' | ') }"
65
70
  end
66
71
 
67
72
  redirect_to action: 'index'
@@ -6,8 +6,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
6
6
  before_action :set_lists
7
7
 
8
8
  def create
9
- pparams = params[:ish_email_context].permit!
10
- @ctx = ::Ish::EmailContext.new pparams
9
+ @ctx = ::Ish::EmailContext.new params[:ctx].permit!
11
10
  @tmpl = ::Ish::EmailTemplate.find @ctx.email_template_id
12
11
 
13
12
  @ctx.from_email ||= @tmpl.from_email
@@ -57,9 +56,12 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
57
56
  def iframe_src
58
57
  @ctx = @email_context = Ish::EmailContext.find params[:id]
59
58
  authorize! :iframe_src, @ctx
59
+
60
60
  @tmpl = @email_template = @ctx.email_template
61
61
  @lead = @ctx.lead
62
- render "ish_manager/email_templates/_#{@tmpl.layout}", layout: false
62
+ @body = @ctx.body
63
+
64
+ render layout: false
63
65
  end
64
66
 
65
67
  def index
@@ -80,10 +82,10 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
80
82
  authorize! :new, ::Ish::EmailContext
81
83
  @tmpl = @email_template = Ish::EmailTemplate.where( slug: params[:template_slug] ).first || Ish::EmailTemplate.where( id: params[:template_slug] ).first
82
84
  attrs = {}
83
- if @template
84
- attrs = @template.attributes.slice( :subject, :body, :from_email )
85
+ if @tmpl
86
+ attrs = @tmpl.attributes.slice( :subject, :body, :from_email )
85
87
  end
86
- @ctx = ::Ish::EmailContext.new( { email_template: @template }.merge(attrs) )
88
+ @ctx = ::Ish::EmailContext.new( { email_template: @tmpl }.merge(attrs) )
87
89
  end
88
90
 
89
91
  def show
@@ -94,11 +96,10 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
94
96
  def update
95
97
  @ctx = ::Ish::EmailContext.find params[:id]
96
98
  authorize! :update, @ctx
97
- pparams = params[:ish_email_context].permit!
98
99
 
99
- if @ctx.update_attributes pparams
100
+ if @ctx.update_attributes params[:ctx].permit!
100
101
  flash[:notice] = 'Saved.'
101
- redirect_to action: 'show', id: @ctx.id
102
+ redirect_to action: 'edit', id: @ctx.id
102
103
  return
103
104
  else
104
105
  flash[:alert] = "Could not save: #{@ctx.errors.full_messages.join(', ')}"
@@ -4,14 +4,9 @@ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationContr
4
4
  before_action :set_lists
5
5
 
6
6
  def create
7
- puts! params, 'params'
8
-
9
7
  authorize! :scheduled_emails_create, ::IshManager
10
8
 
11
- @scheduled = Office::ScheduledEmailAction .new({
12
- lead_id: params[:lead_id],
13
- email_action_id: params[:email_action_id],
14
- })
9
+ @scheduled = Office::ScheduledEmailAction.new( params[:sch].permit! )
15
10
 
16
11
  flag = @scheduled.save
17
12
  if flag
@@ -22,35 +22,23 @@
22
22
  = f.select :email_template_id, options_for_select( @email_templates_list, selected: act.email_template_id ), {}, class: 'select2'
23
23
 
24
24
  .col-md-6
25
- .field
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
37
25
  .field
38
26
  %label Next Email Actions
39
- = f.select :next_email_actions, options_for_select( @email_actions_list, selected: act.next_email_actions.map(&:id) ), { }, { class: 'select2', multiple: true }
27
+ .eg rand(1..5).business_days.from_now.to_date + rand(8..16).hours + rand(1..59).minutes
28
+ %br
29
+
30
+ = f.fields_for :ties do |next_f|
31
+ .flex-row.field
32
+ = next_f.label :next_at_exe
33
+ = next_f.text_field :next_at_exe, class: 'flex-grow'
34
+ .flex-row.field
35
+ = next_f.label :to_delete
36
+ = next_f.check_box :to_delete
37
+ = next_f.select :next_email_action_id, options_for_select( @email_actions_list, selected: next_f.object.next_email_action_id ), { }, { class: 'select2' }
38
+ %br
40
39
 
41
40
  .row
42
41
  .col-sm-6
43
42
  = f.submit :submit
44
43
 
45
44
 
46
-
47
-
48
-
49
-
50
-
51
- -# .field
52
- -# %label State
53
- -# = f.select :state, options_for_select( ::Office::EmailAction::STATES, selected: act.state )
54
- -# .field
55
- -# %label Lead
56
- -# = f.select :lead_id, options_for_select( @leads_list, selected: act.lead_id ), {}, class: 'select2'
@@ -1,5 +1,5 @@
1
1
 
2
- .email-actions-edit
2
+ .email-actions-edit.padded
3
3
  .header
4
4
  %h2.title Edit Email Action
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- .email-actions-index.max-width
2
+ .email-actions-index.padded
3
3
 
4
4
  .header
5
5
  %h2.title
@@ -17,10 +17,16 @@
17
17
  %tr
18
18
  %td= check_box_tag 'abba'
19
19
  %td= link_to '[~]', edit_email_action_path( act )
20
- %td= act.slug
20
+ %td= link_to act.slug, email_action_path( act )
21
21
  %td= act.descr
22
22
  -# %td= act.lead&.email
23
23
  %td
24
24
  %ul
25
- - act.next_email_actions.map do |next_a|
26
- %li= link_to next_a.slug, edit_email_action_path( next_a )
25
+ - act.ties.map do |next_a|
26
+ %li
27
+ .a= next_a.next_at_exe
28
+ .a
29
+ - if next_a.next_email_action.slug == act.slug
30
+ (same)
31
+ = next_a.next_email_action.slug
32
+ -# %li= link_to next_a.next_email_action.slug, edit_email_action_path( next_a.next_email_action )
@@ -1,5 +1,5 @@
1
1
 
2
- .email-actions-new.max-width
2
+ .email-actions-new.padded
3
3
  .header
4
4
  %h2.title
5
5
  New Email Action
@@ -0,0 +1,3 @@
1
+
2
+ .email-actions-show.max-width
3
+ show...
@@ -1,12 +1,7 @@
1
1
 
2
2
  .email-contexts--form
3
- .header
4
- %h2.title Email Context
5
-
6
3
  - url = ctx.new_record? ? email_contexts_path : email_context_path(ctx)
7
- = form_for ctx, url: url do |f|
8
- .row
9
- = f.submit 'Save'
4
+ = form_for ctx, as: :ctx, url: url do |f|
10
5
  .row
11
6
  .col-md-6
12
7
  .field.field-template
@@ -15,36 +10,35 @@
15
10
  - if ctx.email_template_id
16
11
  = link_to 'view', email_template_path( ctx.email_template_id ), target: :_blank, class: [ 'action-view' ]
17
12
  = link_to '~', edit_email_template_path( ctx.email_template_id ), target: :_blank, class: [ 'action-view' ]
18
- -# .field
19
- -# = f.label :slug
20
- -# = f.text_field :slug
13
+ layout: #{ctx.tmpl.layout}
21
14
 
22
15
  .field
23
16
  = f.label "From"
24
17
  = f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: ctx.from_email)
25
18
 
26
- -# .col-md-6
27
- -# %h5 Context
28
- -# %div Commonly: name, companyName
29
- -# .field
30
- -# = f.text_area :tmpl, value: JSON.pretty_generate( ctx.tmpl )
31
19
  .row
32
20
  .col-md-4
33
- .field
21
+ .field.flex-row
34
22
  = f.label "To lead"
35
- = f.select :lead_id, options_for_select( @leads_list ), {}, { class: 'select2' }
23
+ = f.select :lead_id, options_for_select( @leads_list, selected: ctx.lead_id ), {}, { class: 'select2' }
36
24
  .col-md-8
37
25
  .field.field-subject
38
26
  = f.label :subject
39
27
  = f.text_field :subject
40
28
 
41
- - if 'plain' == ctx.email_template&.layout
42
- .body
43
- = raw ctx.email_template.body
44
- - else
45
- .field
46
- = f.label :body
47
- = f.text_area :body, class: 'tinymce'
29
+
30
+
31
+ .tab-labels
32
+ %a.label-raw{ href: "javascript: void(0)", data: { ref: '.tab-raw' } } Raw
33
+ %a.label-preview.active{ href: "javascript: void(0)", data: { ref: '.tab-preview' } } Preview
34
+ .label-save-preview= f.submit 'Save & Preview'
35
+ .tabs
36
+ .tab-raw
37
+ = f.text_area :body
38
+ .tab-preview
39
+ %iframe{ src: email_context_iframe_path(ctx), width: '100%', height: '100%' }
40
+
41
+
48
42
  .actions
49
43
  .left
50
44
  = f.submit 'Preview'
@@ -1,3 +1,5 @@
1
1
 
2
- .email-contexts-edit
2
+ .email-contexts-edit.max-width
3
+ .header
4
+ %h2.title Edit email Context
3
5
  = render 'ish_manager/email_contexts/form', ctx: @ctx, tmpl: @tmpl
@@ -0,0 +1,4 @@
1
+
2
+
3
+ = render "ish_manager/email_templates/#{@email_template.layout}", body: @body
4
+
@@ -20,8 +20,6 @@
20
20
  %th.to To
21
21
  %th.subject Subject
22
22
  %th.template Template
23
- %th.created_at Created at
24
- %th.updated_at Updated at
25
23
  %tbody
26
24
  - @ctxs.each do |ctx|
27
25
  %tr
@@ -38,8 +36,6 @@
38
36
  = link_to email_context_path(ctx) do
39
37
  = ctx.subject ? ctx.subject : "t| #{ctx.tmpl.subject}"
40
38
  %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')
43
39
 
44
40
 
45
41
  = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
@@ -1,3 +1,5 @@
1
1
 
2
- .email-contexts-new
2
+ .email-contexts-new.max-width
3
+ .header
4
+ %h2.title New email context
3
5
  = render 'ish_manager/email_contexts/form', ctx: @ctx
@@ -23,10 +23,11 @@
23
23
  = button_to 'Send', email_context_send_path(@ctx), form_class: 'inline', :data => { :confirm => 'Are you sure?' }
24
24
  = link_to '[~]', edit_email_context_path(@ctx)
25
25
 
26
- - if @ctx.sent_at
27
- = raw @ctx.rendered_str
28
- = @ctx.tmpl
26
+ .max-width
27
+ - if @ctx.sent_at
28
+ = raw @ctx.rendered_str
29
+ -# = @ctx.tmpl
29
30
 
30
- - else
31
- = link_to 'i-src', email_context_iframe_path(@ctx), target: :_blank
32
- %iframe{ src: email_context_iframe_path(@ctx), width: '100%', height: '100%' }
31
+ - else
32
+ -# = link_to 'i-src', email_context_iframe_path(@ctx), target: :_blank
33
+ %iframe{ src: email_context_iframe_path(@ctx), width: '100%', height: '100%' }
@@ -31,7 +31,8 @@
31
31
  = msg.id
32
32
  <b>To:</b> #{msg.to}
33
33
  %li
34
- <b>From:</b> #{msg.from}
34
+ <b>From:</b>
35
+ -# #{msg.from}
35
36
  = lead.email
36
37
  %a.chip{ href: email_contexts_for_lead_path( lead ) }
37
38
  \(
@@ -23,6 +23,7 @@
23
23
  = f.label :preview_str
24
24
  = f.text_field :preview_str
25
25
 
26
+
26
27
  .tab-labels
27
28
  %a.label-raw{ href: "javascript: void(0)", data: { ref: '.tab-raw' } } Raw
28
29
  %a.label-preview.active{ href: "javascript: void(0)", data: { ref: '.tab-preview' } } Preview
@@ -34,6 +35,8 @@
34
35
  - if email_template.persisted?
35
36
  -# .descr= render "ish_manager/email_templates/#{email_template.layout}", ctx: Ish::EmailContext.new, tmpl: email_template
36
37
  %iframe{ src: email_template_iframe_path(email_template), width: '100%', height: '100%' }
38
+
39
+
37
40
  .actions
38
41
  = f.submit 'Save'
39
42
 
@@ -0,0 +1,3 @@
1
+
2
+ = raw ERB.new( body ).result
3
+