ish_manager 0.1.8.355 → 0.1.8.357

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ish_manager/application.js +68 -15
  3. data/app/assets/javascripts/ish_manager/email_contexts.js +1 -1
  4. data/app/assets/javascripts/ish_manager/email_templates.js +20 -0
  5. data/app/assets/javascripts/ish_manager/galleries.js +78 -0
  6. data/app/assets/stylesheets/ish_manager/application.scss +48 -9
  7. data/app/assets/stylesheets/ish_manager/email.scss +44 -0
  8. data/app/assets/stylesheets/ish_manager/{email_contexts_templates.scss → email_contexts.scss} +29 -49
  9. data/app/assets/stylesheets/ish_manager/email_conversations.scss +99 -21
  10. data/app/assets/stylesheets/ish_manager/email_templates.scss +59 -0
  11. data/app/assets/stylesheets/ish_manager/galleries.scss +10 -0
  12. data/app/assets/stylesheets/ish_manager/leads_leadsets.scss +96 -3
  13. data/app/assets/stylesheets/ish_manager/scheduled_actions_emails.scss +25 -0
  14. data/app/assets/stylesheets/ish_manager/tags.scss +5 -0
  15. data/app/controllers/ish_manager/application_controller.rb +15 -0
  16. data/app/controllers/ish_manager/email_actions_controller.rb +80 -0
  17. data/app/controllers/ish_manager/email_campaigns_controller.rb +13 -0
  18. data/app/controllers/ish_manager/email_contexts_controller.rb +41 -48
  19. data/app/controllers/ish_manager/email_conversations_controller.rb +6 -2
  20. data/app/controllers/ish_manager/email_filters_controller.rb +47 -0
  21. data/app/controllers/ish_manager/email_messages_controller.rb +1 -1
  22. data/app/controllers/ish_manager/email_templates_controller.rb +23 -10
  23. data/app/controllers/ish_manager/galleries_controller.rb +23 -8
  24. data/app/controllers/ish_manager/leads_controller.rb +3 -9
  25. data/app/controllers/ish_manager/leadset_tags_controller.rb +18 -0
  26. data/app/controllers/ish_manager/leadsets_controller.rb +13 -0
  27. data/app/controllers/ish_manager/scheduled_email_actions_controller.rb +38 -0
  28. data/app/helpers/ish_manager/application_helper.rb +4 -0
  29. data/app/mailers/ish_manager/application_mailer.rb +1 -1
  30. data/app/mailers/ish_manager/meeting_mailer.rb +2 -1
  31. data/app/mailers/ish_manager/office_mailer.rb +12 -10
  32. data/app/views/ish_manager/application/_debug.haml +2 -1
  33. data/app/views/ish_manager/application/_main_header_admin.haml +47 -60
  34. data/app/views/ish_manager/email_actions/_form.haml +52 -0
  35. data/app/views/ish_manager/email_actions/edit.haml +7 -0
  36. data/app/views/ish_manager/email_actions/index.haml +26 -0
  37. data/app/views/ish_manager/email_actions/new.haml +7 -0
  38. data/app/views/ish_manager/email_contexts/_form.haml +32 -30
  39. data/app/views/ish_manager/email_contexts/edit.haml +1 -1
  40. data/app/views/ish_manager/email_contexts/index.haml +27 -22
  41. data/app/views/ish_manager/email_contexts/show.haml +26 -15
  42. data/app/views/ish_manager/email_conversations/index.haml +46 -9
  43. data/app/views/ish_manager/email_conversations/show.haml +56 -21
  44. data/app/views/ish_manager/email_filters/_form.haml +12 -0
  45. data/app/views/ish_manager/email_filters/edit.haml +5 -0
  46. data/app/views/ish_manager/email_filters/index.haml +24 -0
  47. data/app/views/ish_manager/email_filters/new.haml +5 -0
  48. data/app/views/ish_manager/email_templates/_form.haml +32 -13
  49. data/app/views/ish_manager/email_templates/_form_reply_2_mini.haml +15 -0
  50. data/app/views/ish_manager/email_templates/_form_reply_mini.haml +1 -1
  51. data/app/views/ish_manager/email_templates/_index.haml +24 -11
  52. data/app/views/ish_manager/email_templates/_piousbox_roundborders.html.erb +4 -1
  53. data/app/views/ish_manager/email_templates/_wasyaco_roundborders.html.erb +5 -6
  54. data/app/views/ish_manager/email_templates/done/_form.haml +22 -0
  55. data/app/views/ish_manager/email_templates/done/_form2.haml +26 -0
  56. data/app/views/ish_manager/email_templates/edit.haml +2 -1
  57. data/app/views/ish_manager/email_templates/iframe_src.haml +4 -3
  58. data/app/views/ish_manager/email_templates/new.haml +5 -0
  59. data/app/views/ish_manager/email_templates/show.haml +9 -3
  60. data/app/views/ish_manager/galleries/show.haml +10 -1
  61. data/app/views/ish_manager/leads/_form.haml +11 -6
  62. data/app/views/ish_manager/leads/_form_import.haml +3 -3
  63. data/app/views/ish_manager/leads/edit.haml +19 -16
  64. data/app/views/ish_manager/leads/index.haml +25 -16
  65. data/app/views/ish_manager/leads/new.haml +8 -7
  66. data/app/views/ish_manager/leadsets/index.haml +60 -12
  67. data/app/views/ish_manager/leadsets/index_dataTables.haml +33 -0
  68. data/app/views/ish_manager/photos/_index_thumbs.haml +1 -1
  69. data/app/views/ish_manager/scheduled_actions/_form_mini.haml +16 -0
  70. data/app/views/ish_manager/scheduled_email_actions/_form.haml +26 -0
  71. data/app/views/ish_manager/scheduled_email_actions/index.haml +15 -0
  72. data/app/views/ish_manager/scheduled_email_actions/new.haml +4 -0
  73. data/app/views/ish_manager/scheduled_email_actions/show.haml +0 -0
  74. data/app/views/layouts/ish_manager/application.haml +2 -2
  75. data/app/views/layouts/ish_manager/application_fullwidth.haml +2 -2
  76. data/config/routes.rb +11 -2
  77. metadata +31 -6
  78. data/app/controllers/ish_manager/office_actions_controller.rb +0 -59
  79. data/app/views/ish_manager/office_actions/_form.haml +0 -83
  80. data/app/views/ish_manager/office_actions/index.haml +0 -9
@@ -1,7 +1,7 @@
1
1
  class IshManager::GalleriesController < IshManager::ApplicationController
2
2
 
3
3
  before_action :set_lists
4
- before_action :set_gallery, only: %w|destroy edit j_show show update|
4
+ before_action :set_gallery, only: %w|destroy edit j_show show update update_ordering|
5
5
 
6
6
  # alphabetized! : )
7
7
 
@@ -86,22 +86,37 @@ class IshManager::GalleriesController < IshManager::ApplicationController
86
86
 
87
87
  def show
88
88
  authorize! :show, @gallery
89
- @photos = @gallery.photos.unscoped.where({ :is_trash => false })
90
- @deleted_photos = @gallery.photos.unscoped.where({ :is_trash => true })
89
+ @photos = @gallery.photos.unscoped.where({ :is_trash => false }).order_by( ordering: :asc )
90
+ @deleted_photos = @gallery.photos.unscoped.where({ :is_trash => true }).order_by( ordering: :asc )
91
+ end
92
+
93
+ def update_ordering
94
+ authorize! :update, @gallery
95
+ out = []
96
+ params[:gallery][:sorted_photo_ids].each_with_index do |id, idx|
97
+ out.push Photo.find( id ).update_attribute( :ordering, idx )
98
+ end
99
+ flash[:notice] = "Outcomes: #{out}."
100
+ redirect_to action: 'show', id: @gallery.id
91
101
  end
92
102
 
93
103
  def update
94
104
  old_shared_profile_ids = @gallery.shared_profiles.map(&:id)
95
105
  authorize! :update, @gallery
96
106
 
97
- params[:gallery][:shared_profiles].delete('')
107
+ if params[:gallery][:shared_profiles].present?
108
+ params[:gallery][:shared_profiles].delete('')
109
+ end
98
110
  params[:gallery][:shared_profile_ids] = params[:gallery][:shared_profiles]
99
111
  params[:gallery].delete :shared_profiles
100
112
 
101
- if @gallery.update_attributes( params[:gallery].permit! )
102
- new_shared_profiles = Ish::UserProfile.find( params[:gallery][:shared_profile_ids]
103
- ).select { |p| !old_shared_profile_ids.include?( p.id ) }
104
- ::IshManager::ApplicationMailer.shared_galleries( new_shared_profiles, @gallery ).deliver
113
+ flag = @gallery.update_attributes( params[:gallery].permit! )
114
+ if flag
115
+ if params[:gallery][:shared_profile_ids].present?
116
+ new_shared_profiles = Ish::UserProfile.find( params[:gallery][:shared_profile_ids]
117
+ ).select { |p| !old_shared_profile_ids.include?( p.id ) }
118
+ ::IshManager::ApplicationMailer.shared_galleries( new_shared_profiles, @gallery ).deliver
119
+ end
105
120
  flash[:notice] = 'Success.'
106
121
  redirect_to edit_gallery_path(@gallery)
107
122
  else
@@ -3,6 +3,8 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
+ layout 'ish_manager/application_fullwidth'
7
+
6
8
  ## alphabetized : )
7
9
 
8
10
  def bulkop
@@ -69,7 +71,7 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
69
71
 
70
72
  def index
71
73
  authorize! :index, ::Lead
72
- @leads = ::Lead.all.includes( :leadset, :email_campaign_leads )
74
+ @leads = ::Lead.all # .includes( :leadset, :email_campaign_leads )
73
75
  lead_emails = @leads.map( &:email ).compact.reject(&:empty?)
74
76
 
75
77
  map = %Q{
@@ -117,12 +119,4 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
117
119
  redirect_to :action => 'index'
118
120
  end
119
121
 
120
- private
121
-
122
- def set_lists
123
- super
124
- @leadsets_list = [ [nil,nil] ] + ::Leadset.all.map { |k| [ k.name, k.id ] }
125
- @email_campaigns_list = [ [nil,nil] ] # + Ish::EmailContext.unsent_campaigns.map { |k| [ k.slug, k.id ] }
126
- end
127
-
128
122
  end
@@ -0,0 +1,18 @@
1
+
2
+ class IshManager::LeadsetTagsController < IshManager::ApplicationController
3
+
4
+ ## params[ :leadset_id, :term_id, ]
5
+ def create
6
+ authorize! :leadset_tags_create, ::IshManager
7
+
8
+ lt = LeadsetTag.new( leadset_id: params[:leadset_id], term_id: params[:term_id] )
9
+ flag = lt.save
10
+ if flag
11
+ flash[:notice] = 'Success'
12
+ else
13
+ flash[:alert] = "No luck: #{lt.errors.full_messages.join(', ')}"
14
+ end
15
+ redirect_to request.referrer ? request.referrer : leadsets_path
16
+ end
17
+
18
+ end
@@ -1,6 +1,8 @@
1
1
 
2
2
  class ::IshManager::LeadsetsController < IshManager::ApplicationController
3
3
 
4
+ before_action :set_lists
5
+
4
6
  ## alphabetized : )
5
7
 
6
8
  def create
@@ -65,4 +67,15 @@ class ::IshManager::LeadsetsController < IshManager::ApplicationController
65
67
  redirect_to :action => 'index'
66
68
  end
67
69
 
70
+ ##
71
+ ## private
72
+ ##
73
+ private
74
+
75
+ def set_lists
76
+ @tags_list = WpTag.all.map { |t| [ t.name, t.id ] }
77
+ @leads_list = Lead.all.map { |lead| [ lead.email, lead.id ] }
78
+ @templates_list = Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
79
+ end
80
+
68
81
  end
@@ -0,0 +1,38 @@
1
+
2
+ class IshManager::ScheduledEmailActionsController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ layout 'ish_manager/application_fullwidth'
7
+
8
+ def create
9
+ puts! params, 'params'
10
+
11
+ authorize! :scheduled_emails_create, ::IshManager
12
+
13
+ @scheduled = Office::ScheduledEmailAction .new({
14
+ lead_id: params[:lead_id],
15
+ email_action_id: params[:email_action_id],
16
+ })
17
+
18
+ flag = @scheduled.save
19
+ if flag
20
+ flash[:notice] = 'Success'
21
+ else
22
+ flash[:alert] = "No luck: #{@scheduled.errors.full_messages.join(', ')}"
23
+ end
24
+ redirect_to request.referrer ? request.referrer : leadsets_path
25
+ end
26
+
27
+ def index
28
+ authorize! :scheduled_emails_index, ::IshManager
29
+ @scheduled_email_actions = ::Office::ScheduledEmailAction.all
30
+ end
31
+
32
+ def new
33
+ @scheduled_email_action = ::Office::ScheduledEmailAction.new
34
+ authorize! :scheduled_emails_new, @scheduled_email_action
35
+ end
36
+
37
+ end
38
+
@@ -26,6 +26,10 @@ module IshManager
26
26
  end
27
27
  end
28
28
 
29
+ # def email_contexts_for_lead_path lead
30
+ # "/manager/email_contexts/for_lead/#{lead.id.to_s}"
31
+ # end
32
+
29
33
  def pretty_date input
30
34
  return input.strftime("%Y-%m-%d")
31
35
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  module IshManager
3
3
  class ApplicationMailer < ActionMailer::Base
4
- default from: '314658@gmail.com'
4
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
5
5
  layout 'mailer'
6
6
 
7
7
  def shared_galleries profiles, gallery
@@ -1,6 +1,7 @@
1
1
 
2
2
  class IshManager::MeetingMailer < IshManager::ApplicationMailer
3
- default from: 'piousbox@gmail.com'
3
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
4
+
4
5
  # layout 'mailer'
5
6
 
6
7
  def morning_reminder meeting_id:
@@ -1,5 +1,6 @@
1
1
 
2
2
  class IshManager::OfficeMailer < IshManager::ApplicationMailer
3
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
3
4
 
4
5
  def send_campaign_email campaign_id, c_lead_id
5
6
  @ctx = @campaign = ::Ish::EmailContext.find campaign_id
@@ -59,15 +60,16 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
59
60
  ac = ActionController::Base.new
60
61
  ac.instance_variable_set( :@email_ctx, @email_ctx )
61
62
 
62
- case @email_ctx.email_template.type
63
- when 'partial'
64
- template = "render/_#{@email_ctx.email_template.slug}"
65
- rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@email_ctx.email_template.slug}")
66
- when 'plain'
67
- @body = @email_ctx.body_templated
68
- template = "render/plain"
69
- rendered_str = ac.render_to_string("ish_manager/email_templates/plain")
70
- end
63
+ raise '@TODO: re-implement. _vp_ 2023-03-04'
64
+ # case @email_ctx.email_template.type
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
71
73
 
72
74
  @email_ctx.update( rendered_str: rendered_str, sent_at: Time.now.to_s )
73
75
 
@@ -81,7 +83,7 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
81
83
  end
82
84
 
83
85
 
84
- ## 2022-11-10 backup
86
+ ## 2022-11-10 _vp_ backup
85
87
  # def send_context_email ctx_id
86
88
  # @email_ctx = ::Ish::EmailContext.find ctx_id
87
89
  # template = "render/_#{@email_ctx.email_template.slug}"
@@ -6,4 +6,5 @@
6
6
  %li= params.inspect
7
7
  %li Cached? #{Rails.application.config.action_controller.perform_caching} :: Cache key: #{@cache_key.inspect}
8
8
  -# %li Layout: #{current_layout}
9
- %li= "Env: #{Rails.env}"
9
+ %li= "Env: #{Rails.env}"
10
+ %li JWT: #{@jwt_token}
@@ -1,79 +1,48 @@
1
1
 
2
2
 
3
3
  .application--main-header-admin.main-header{ class: "#{ENV['RAILS_ENV']} #{ENV['RAILS_ENV'][0...3]=="dev" ? "development" : ''}" }
4
+ %i.fa.fa-compress.collapse-expand#collapseHeaderMain
5
+ Piousbox Suite
4
6
  .container
5
7
 
6
8
  %i.fa.fa-compress.collapse-expand#collapseHeaderPiCMS
7
9
  PiousboxCMS
8
- %ul
9
- -# %li
10
- -# = link_to 'Photos', photos_path
11
- -# = link_to '[+]', new_photo_path
12
- %li
13
- = render 'ish_manager/galleries/menu'
14
- %li
15
- = link_to 'Reports', reports_path
16
- .inline-search
17
- = form_tag reports_path, method: :get do
18
- = text_field_tag :q
19
- = link_to '[+]', new_report_path
20
- %li
21
- = link_to 'Videos', videos_path
22
- .inline-search
23
- = form_tag videos_path, method: :get do
24
- = text_field_tag :q
25
- = link_to '[+]', new_video_path
26
- %li
27
- = link_to 'Categories & Tags', categories_path
28
- .c
29
-
30
- %i.fa.fa-compress.collapse-expand#collapseHeaderIsh
31
- Gameui
32
- .content
10
+ .a
33
11
  %ul
34
12
  %li
35
- = link_to 'Maps', maps_path
13
+ = render 'ish_manager/galleries/menu'
14
+ %li
15
+ = link_to 'Reports', reports_path
36
16
  .inline-search
37
- = form_tag maps_path, method: :get do
17
+ = form_tag reports_path, method: :get do
38
18
  = text_field_tag :q
39
- = link_to '[+]', new_map_path
40
-
41
- -# %li
42
- -# = link_to 'Tags', tags_path
43
-
19
+ = link_to '[+]', new_report_path
20
+ %li
21
+ = link_to 'Videos', videos_path
22
+ .inline-search
23
+ = form_tag videos_path, method: :get do
24
+ = text_field_tag :q
25
+ = link_to '[+]', new_video_path
26
+ %li= link_to 'Categories & Tags', categories_path
44
27
  %ul
45
28
  %li= link_to '+Newsitem', new_newsitem_path
46
- -# %li{ :class => params[:controller] == 'ish_manager/stock_watches' ? 'active' : '' }= link_to 'Stock Watches (old m3)', stock_watches_path
47
- -# %li= link_to 'Stock Watches', '/iron_warbler/stock_watches'
48
- -# %li= link_to 'Users', users_path
49
29
  %li= link_to 'Ish::UserProfiles', user_profiles_path
30
+ %li= link_to "Ish::ImageAsset's", image_assets_path
50
31
  %li
51
- = link_to "Ish::ImageAsset's", image_assets_path
32
+ = link_to 'Maps', maps_path
33
+ .inline-search
34
+ = form_tag maps_path, method: :get do
35
+ = text_field_tag :q
36
+ = link_to '[+]', new_map_path
52
37
  .c
53
38
 
54
39
  %i.fa.fa-compress.collapse-expand#collapseHeaderOffice
55
- Office
56
- .namespace
57
- -# %ul
58
- -# %li= link_to 'Admin', '/admin'
59
- -# %li= link_to 'A/Leads', '/admin/leads'
60
- -# %li= link_to 'A/CampaignLeads', '/admin/email_campaign_leads'
40
+ PiousboxCRM
41
+ .a
61
42
  %ul
62
43
  %li
63
- = link_to 'Meetings', meetings_path
64
- = link_to '[+]', new_meeting_path
65
- %li
66
- -## superceded by conversations, below _vp_ 2023-02-26
67
- -# = link_to "Email Messages (#{Office::EmailMessage.count})", email_messages_path
68
- = link_to "Email Conv's (#{Office::EmailConversation.count})", email_conversations_path
69
- %ul
70
- %li
71
- = link_to 'Leads', leads_path
72
- = link_to '[+]', new_lead_path
73
- %li
74
- = link_to 'Leadsets', leadsets_path
75
- = link_to '[+]', new_leadset_path
76
- %li= link_to 'Email Templates', email_templates_path
44
+ = link_to "Inbox (#{Office::EmailConversation.count})", email_conversations_path
45
+ = link_to '[+]', new_email_context_path
77
46
  %li
78
47
  = link_to 'Contexts', email_contexts_path
79
48
  = link_to '[+]', new_email_context_path
@@ -81,17 +50,35 @@
81
50
  %li
82
51
  = link_to 'Campaigns', email_campaigns_path
83
52
  = link_to '[+]', new_email_campaign_path
84
- %li
85
- = link_to 'Actions', office_actions_path
86
- = link_to '[+]', new_office_action_path
87
53
 
54
+ %li
55
+ = link_to 'Scheduled Emails', scheduled_email_actions_path
56
+ = link_to '[+]', new_scheduled_email_action_path
57
+ %ul
58
+ %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
63
+ = link_to '[+]', new_leadset_path
64
+ %li
65
+ = link_to "Leads (#{Lead.kept.length})", leads_path
66
+ = 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
70
+ %li
71
+ = link_to "Filters (#{Office::EmailFilter.active.length})", email_filters_path
72
+ = link_to '[+]', new_email_filter_path
88
73
  .c
74
+
89
75
  %i.fa.fa-compress.collapse-expand#collapseHeaderIro
90
76
  Iro Wor
91
- .content
77
+ .a
92
78
  %ul
93
79
  %li
94
80
  = link_to 'Watches', iro_watches_path
95
81
  %li
96
82
  = link_to 'Plots', 'http://localhost:3000/iron_warbler/NOPE-1', target: '_blank'
83
+ .c
97
84
 
@@ -0,0 +1,52 @@
1
+
2
+ - act = email_action
3
+ - url = email_action.new_record? ? email_actions_path : email_action_path( email_action )
4
+
5
+ .email-actions--form
6
+
7
+ = form_for email_action, url: url, as: :email_action, :html => { :multipart => true } do |f|
8
+ .row
9
+ .col-sm-6
10
+ = f.submit :submit
11
+
12
+ .row
13
+ .col-md-6
14
+ .field
15
+ %label Slug
16
+ = f.text_field :slug
17
+ .field
18
+ %label Descr
19
+ = f.text_area :descr
20
+ .field
21
+ %label Template
22
+ = f.select :email_template_id, options_for_select( @email_templates_list, selected: act.email_template_id ), {}, class: 'select2'
23
+
24
+ .col-md-6
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
33
+ .field
34
+ %label Next Email Actions
35
+ = f.select :next_email_actions, options_for_select( @email_actions_list, selected: act.next_email_actions.map(&:id) ), { }, { class: 'select2', multiple: true }
36
+
37
+ .row
38
+ .col-sm-6
39
+ = f.submit :submit
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ -# .field
48
+ -# %label State
49
+ -# = f.select :state, options_for_select( ::Office::EmailAction::STATES, selected: act.state )
50
+ -# .field
51
+ -# %label Lead
52
+ -# = f.select :lead_id, options_for_select( @leads_list, selected: act.lead_id ), {}, class: 'select2'
@@ -0,0 +1,7 @@
1
+
2
+ .email-actions-edit
3
+ .header
4
+ %h2.title Edit Email Action
5
+
6
+ = render 'form', email_action: @act
7
+
@@ -0,0 +1,26 @@
1
+
2
+ .email-actions-index
3
+
4
+ .header
5
+ %h2.title
6
+ Email Actions
7
+ = link_to '[+]', new_email_action_path
8
+
9
+ %table.bordered
10
+ %tr
11
+ %th= check_box_tag 'abba'
12
+ %th actions
13
+ %th slug
14
+ %th descr
15
+ %th next actions
16
+ - @email_actions.each do |act|
17
+ %tr
18
+ %td= check_box_tag 'abba'
19
+ %td= link_to '[~]', edit_email_action_path( act )
20
+ %td= act.slug
21
+ %td= act.descr
22
+ -# %td= act.lead&.email
23
+ %td
24
+ %ul
25
+ - act.next_email_actions.map do |next_a|
26
+ %li= link_to next_a.slug, edit_email_action_path( next_a )
@@ -0,0 +1,7 @@
1
+
2
+ .email-actions-new
3
+ .header
4
+ %h2.title
5
+ New Email Action
6
+
7
+ = render 'form', email_action: @new_email_action
@@ -1,43 +1,45 @@
1
1
 
2
2
  .email-contexts--form
3
- %h2
4
- New Email Context
5
- - if email_ctx.email_template
6
- with template `#{email_ctx.email_template.slug}` type:#{email_ctx.email_template.type}.
3
+ .header
4
+ %h2.title Email Context
7
5
 
8
- - url = %w| index new create |.include?( params[:action] ) ? email_contexts_path : email_context_path(email_ctx)
9
- = form_for email_ctx, url: url do |f|
6
+ - url = ctx.new_record? ? email_contexts_path : email_context_path(ctx)
7
+ = form_for ctx, url: url do |f|
10
8
  .row
9
+ = f.submit 'Save'
10
+ .row
11
+ .col-md-6
12
+ .field.field-template
13
+ = f.label "Template"
14
+ = f.select :email_template_id, options_for_select(@email_templates_list, selected: params[:email_template_id] || ctx.email_template_id ), {}, { class: 'select2' }
15
+ = link_to 'view', email_template_path( ctx.email_template_id ), target: :_blank, class: [ 'action-view' ]
16
+ = link_to '~', edit_email_template_path( ctx.email_template_id ), target: :_blank, class: [ 'action-view' ]
17
+ -# .field
18
+ -# = f.label :slug
19
+ -# = f.text_field :slug
11
20
 
12
- .col.s6
13
- .field
14
- = f.label :email_template_id
15
- = f.select :email_template_id, options_for_select(@email_templates_list, selected: params[:email_template_id] || email_ctx.email_template&.id )
16
21
  .field
17
- = f.label :slug
18
- = f.text_field :slug
22
+ = f.label "From"
23
+ = f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: ctx.from_email)
19
24
 
25
+ -# .col-md-6
26
+ -# %h5 Context
27
+ -# %div Commonly: name, companyName
28
+ -# .field
29
+ -# = f.text_area :tmpl, value: JSON.pretty_generate( ctx.tmpl )
30
+ .row
31
+ .col-md-4
20
32
  .field
21
- = f.label :from_email
22
- = f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: email_ctx.from_email)
23
-
24
- .col.s6
25
- -# @TODO: clean this up. _vp_ 2023-02-13
26
- .TYPE_SINGLE
27
- .field
28
- = f.label :to_email
29
- = f.text_field :to_email
30
- %h5 Templating
31
- %div Commonly: name, companyName
32
- .field
33
- = f.text_area :tmpl, value: JSON.pretty_generate( email_ctx.tmpl )
33
+ = f.label "To lead"
34
+ = f.select :lead_id, options_for_select( @leads_list ), {}, { class: 'select2' }
35
+ .col-md-8
36
+ .field.field-subject
37
+ = f.label :subject
38
+ = f.text_field :subject
34
39
 
35
- .field.field-subject
36
- = f.label :subject
37
- = f.text_field :subject
38
- - if 'plain' == email_ctx.email_template&.type
40
+ - if 'plain' == ctx.email_template&.layout
39
41
  .body
40
- = raw email_ctx.email_template.body
42
+ = raw ctx.email_template.body
41
43
  - else
42
44
  .field
43
45
  = f.label :body
@@ -1,3 +1,3 @@
1
1
 
2
2
  .email-contexts-edit
3
- = render 'ish_manager/email_contexts/form', template: @template, email_ctx: @email_ctx
3
+ = render 'ish_manager/email_contexts/form', ctx: @ctx, tmpl: @tmpl
@@ -1,31 +1,36 @@
1
1
 
2
- .email-contexts-index
2
+ .email-contexts-index.padded
3
3
 
4
4
  .collapse-expand#emailContextsIndex
5
5
  %h2.header
6
- Paginated Email Contexts (aka emails)
6
+ Paginated Email Contexts (#{@ctxs.length})
7
+ - if @lead
8
+ For lead `#{@lead.name}`
7
9
  = link_to '+', new_email_context_path
8
- = link_to 'to-send', notsent_email_contexts_path
9
-
10
- %ul.meta
11
- %li= params[:type]
10
+ = link_to 'unsent', notsent_email_contexts_path
12
11
 
13
12
  .W0
14
- = render 'paginate', resource: @email_ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
13
+ = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager
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|
22
+ %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
15
34
 
16
- %ul.main
17
- - @email_ctxs.each do |ctx|
18
- %li
19
- - if ctx.sent_at
20
- \----
21
- - else
22
- = link_to '~', edit_email_context_path(ctx)
23
- = link_to email_context_path(ctx) do
24
- view
25
- = ctx.title
26
- = button_to '[x]', email_context_path(ctx), method: :delete, form_class: :inline, data: { confirm: 'Are you sure?' }
27
- -# = link_to 'iframe', email_context_iframe_path(ctx), target: :_blank do
28
35
 
29
- [ <b>tmpl:</b> #{ctx.email_template.slug} ]
30
- [ <b>To:</b> #{ctx.to_email} ]
31
- <u>#{ctx.subject}</u>
36
+ = render 'paginate', resource: @ctxs, param_name: :email_contexts_page, views_prefix: :ish_manager