ish_manager 0.1.8.358 → 0.1.8.360

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: 193a0f1a8f02445f2d98166fe6bfe614268fbc2f9e45204961c45898bd0005d3
4
- data.tar.gz: 8d9d4d82f78782390b28463c11c825ab8e1e56fa054a3351869bd6699e264869
3
+ metadata.gz: 211e20f4c15dfe93f4b66d0fe4e75be2409651310f4603d3c51da3f8b31e5f34
4
+ data.tar.gz: 3d407d3048a28347545d1912678ec1107596b1ab95fc902cdadbc38f9085b71b
5
5
  SHA512:
6
- metadata.gz: c4ab1c3fa4bb6e624b7c3c2b90759eb2d4c1823c053a0cd0c0fbfca8ef96fb67c819ef1f15cdae669a50676973f79b42d129c3688a9c88114c5632cb1225ae28
7
- data.tar.gz: 409f2c967e02c2f92110feb667f997dad6b5bbf6b5736d085ea0c86cd6e3f46a37de98d2d34124b131331ecace55116a0436fea3ce6b2dd31964d9ef83d1ca7e
6
+ metadata.gz: 686449e01136c9fbfaefe4e4a1eb890cae44365ea28a9535d61499b56942ca67f8925f8fbf26472104ef91ba0a8b65ec38d14240d66d9c577567b77672725cde
7
+ data.tar.gz: 75e6666c2a18069b36dbe8bb14ca0d62fb77f3d9845cf59adf4b37f908ef6e6dd25fcc73c10df0bfc6fd31dc4ad9142155e7d0cac84ae826a5c2c8255cf70fd0
@@ -19,11 +19,17 @@
19
19
  //= require ish_manager/vendor/jquery-ui.min
20
20
  //= require ish_manager/shared
21
21
  //
22
+ //= require_self
22
23
  //= require ish_manager/maps
23
24
  //= require ish_manager/email_contexts
24
25
  //= require ish_manager/email_templates
25
26
  //= require ish_manager/galleries
26
27
 
28
+ const AppRouter = {
29
+ gallery_update_ordering_path: ({ id, slug }) => `/manager/galleries/${slug || id}/update_ordering`,
30
+ new_email_context_with_template_path: (slug) => `/manager/email_contexts/new_with_template/${slug}`,
31
+ }
32
+
27
33
  $(function () {
28
34
 
29
35
  $('#fileupload').fileupload({
@@ -1,7 +1,4 @@
1
1
 
2
- const AppRouter = {
3
- new_email_context_with_template_path: (slug) => `/manager/email_contexts/new_with_template/${slug}`
4
- }
5
2
 
6
3
  $(document).ready(() => {
7
4
 
@@ -1,7 +1,4 @@
1
1
 
2
- const AppRouter = {
3
- gallery_update_ordering_path: ({ id, slug }) => `/manager/galleries/${slug || id}/update_ordering`,
4
- }
5
2
  $(document).ready(function () {
6
3
 
7
4
  if ( $(".orderable-items").length ) {
@@ -9,8 +9,8 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
9
9
 
10
10
  def bulkop
11
11
  authorize! :bulkop, ::Lead
12
- case params[:a]
13
- when 'add_to_campaign'
12
+ case params[:op]
13
+ when Lead::OP_ADD_TO_CAMPAIGN
14
14
  c = EmailCampaign.find params[:email_campaign_id]
15
15
  params[:lead_ids].each do |lead_id|
16
16
  c_lead = EmailCampaignLead.new( lead_id: lead_id, email_campaign_id: c.id )
@@ -21,6 +21,19 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
21
21
  end
22
22
  flash[:notice] = 'Done acted; See logs.'
23
23
  redirect_to action: :index
24
+
25
+ when Lead::OP_DELETE
26
+ outs = []
27
+ params[:lead_ids].each do |lead_id|
28
+ lead = Lead.find( lead_id )
29
+ outs.push lead.discard
30
+ end
31
+ flash[:notice] = "Outcomes: #{outs.inspect}."
32
+ redirect_to action: :index
33
+
34
+ else
35
+ throw "Unknown op: #{params[:op]}."
36
+
24
37
  end
25
38
  end
26
39
 
@@ -40,38 +53,48 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
40
53
  authorize! :edit, @lead
41
54
  end
42
55
 
43
- ## 0 1 2 3 4 5 6 7 8
44
- ## fields: id, date, name, email, company url, source tag, phone, linkedin, comment
56
+ ## 0 1 2 3 4 5 6 7
57
+ ## Fields: id, date, name, email, tag, phone, linkedin, comment
45
58
  def import
46
59
  authorize! :import, ::Lead
47
- file = params[:csv_file]
48
- flags = []
60
+ file = params[:csv_file]
61
+ flags = []
49
62
  errors = []
50
63
  CSV.read(file.path, headers: true).each do |row|
51
- company_url = row[4].presence
52
- company_url ||= "https://#{row[3].split('@')[1]}"
53
- company = ::Leadset.find_or_create_by({ company_url: company_url })
64
+
65
+ leadset = ::Leadset.find_or_create_by({ company_url: row[3].split('@')[1] })
54
66
  lead = ::Lead.new({
55
- name: row[2] || 'there',
56
- full_name: row[2] || 'there',
67
+ name: row[2].presence || row[3].split('@')[0],
68
+ full_name: row[2].presence || row[3].split('@')[0],
57
69
  email: row[3],
58
- m3_leadset_id: company.id,
59
- phone: row[6],
70
+ m3_leadset_id: leadset.id,
71
+ phone: row[5],
60
72
  })
61
73
  flag = lead.save
62
74
  flags << flag
63
75
  if !flag
64
76
  errors << lead.errors.full_messages.join(", ")
65
77
  end
78
+
79
+ if row[4].present?
80
+ tags = row[4].split(",").map do |tag_name|
81
+ WpTag.my_find_or_create({ name: tag_name })
82
+ end
83
+ puts! tags, 'tags'
84
+ tags.each do |tag|
85
+ LeadTag.create({ wp_tag: tag, lead: lead })
86
+ end
87
+ end
88
+
66
89
  end
67
- flash[:notice] = "Result: #{flags.inspect} ."
90
+ flash[:notice] = "Result: #{flags.inspect}."
68
91
  flash[:alert] = errors
69
92
  redirect_to action: 'new'
70
93
  end
71
94
 
72
95
  def index
73
96
  authorize! :index, ::Lead
74
- @leads = ::Lead.all # .includes( :leadset, :email_campaign_leads )
97
+ @leads = ::Lead.kept.includes( :company )
75
98
  lead_emails = @leads.map( &:email ).compact.reject(&:empty?)
76
99
 
77
100
  map = %Q{
@@ -2,18 +2,10 @@
2
2
  = form_tag leads_import_path, multipart: true do
3
3
  .doc
4
4
  %ul
5
- %li v1 fields: id, date, name, email, company url, source tag, phone, linkedin, comment
5
+ %li Fields: id, date, name, email, tag, phone, linkedin, comment
6
6
  .field
7
7
  %label File
8
8
  = file_field_tag :csv_file
9
9
 
10
- -# .field
11
- -# %label Leadset
12
- -# = select_tag :leadset_id, options_for_select(@leadsets_list), class: 'select2'
13
-
14
- -# .field
15
- -# %label Campaign
16
- -# = select_tag :email_campaign_id, options_for_select(@email_campaigns_list), class: 'select2'
17
-
18
10
  .actions
19
11
  = submit_tag 'Submit'
@@ -2,12 +2,12 @@
2
2
  .leads-index
3
3
  .header
4
4
  %h2.title
5
- #{link_to 'Leads', leads_path} (#{::Lead.all.count})
5
+ #{link_to 'Kept Leads', leads_path} (#{::Lead.kept.count}, #{::Lead.all.count})
6
6
  = link_to raw("<i class='fa fa-plus-square'></i>"), new_lead_path
7
7
 
8
8
  = form_tag leads_bulkop_path do
9
9
  = label_tag 'Act on Selected:'
10
- = select_tag :a, options_for_select( %w| delete add_to_campaign | )
10
+ = select_tag :op, options_for_select( [[nil,nil]] + Lead::OPS )
11
11
  -# = select_tag :email_campaign_id, options_for_select( @email_campaigns_list )
12
12
  = submit_tag 'Go'
13
13
 
@@ -27,7 +27,7 @@
27
27
  %tr
28
28
  %td= check_box_tag 'lead_ids[]', lead.id
29
29
  %td= link_to "#{lead.name} <#{lead.email}>", lead_path( lead )
30
- %td= lead.leadsets.first&.name
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
33
  %td #{lead.email_campaign_leads.count || '-'}, #{@email_contexts[lead.email] || '-'}
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.358
4
+ version: 0.1.8.360
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox