ish_manager 0.1.8.339 → 0.1.8.341
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 +4 -4
- data/app/controllers/ish_manager/application_controller.rb +6 -1
- data/app/controllers/ish_manager/email_contexts_controller.rb +6 -0
- data/app/controllers/ish_manager/leads_controller.rb +56 -2
- data/app/views/ish_manager/application/_main_header_admin.haml +5 -2
- data/app/views/ish_manager/email_contexts/index.haml +3 -0
- data/app/views/ish_manager/leads/_form_import.haml +19 -0
- data/app/views/ish_manager/leads/edit.haml +16 -0
- data/app/views/ish_manager/leads/index.haml +7 -3
- data/app/views/ish_manager/leads/new.haml +5 -2
- data/config/routes.rb +4 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61c49a3cad8ca5b12bf89eb573cbca98aefc12c42d3e144ba3fc0d033cda4b23
|
4
|
+
data.tar.gz: f282ccadc49c6a9d75f11446c81aa15dbc85af7bbf4cb11e9dbb8b0114e758a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bed7e802a94b55d10992e3622e3a2083b30074ff8551b4fda9a68922277bef41a85faa155f5f12ce667119db73fafa52b0dd22503c9749ac64625b91cac8bbd
|
7
|
+
data.tar.gz: d34937d2aac5a9922974963e49ca47a459c161891bb4044d96915497448ad50bf88defcfa88cfc5b12f228ef423f61aa7a51365c812ffe30275f210d5386c4a8
|
@@ -35,7 +35,12 @@ module IshManager
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def set_lists
|
38
|
-
|
38
|
+
@galleries_list = Gallery.all.list
|
39
|
+
@locations_list = ::Gameui::Map.list
|
40
|
+
@maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
|
41
|
+
@reports_list = Report.all.list
|
42
|
+
@user_profiles_list = Ish::UserProfile.list
|
43
|
+
@videos_list = Video.all.list
|
39
44
|
end
|
40
45
|
|
41
46
|
def pp_errors err
|
@@ -71,9 +71,15 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
|
|
71
71
|
def index
|
72
72
|
authorize! :index, ::Ish::EmailContext
|
73
73
|
@email_ctxs = ::Ish::EmailContext.all
|
74
|
+
|
74
75
|
if params[:notsent]
|
75
76
|
@email_ctxs = @email_ctxs.where( sent_at: nil )
|
76
77
|
end
|
78
|
+
|
79
|
+
if params[:type]
|
80
|
+
@email_ctxs = @email_ctxs.where( type: params[:type] )
|
81
|
+
end
|
82
|
+
|
77
83
|
@email_ctxs = @email_ctxs.page( params[Ish::EmailContext::PAGE_PARAM_NAME] )
|
78
84
|
end
|
79
85
|
|
@@ -38,9 +38,62 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
|
|
38
38
|
authorize! :edit, @lead
|
39
39
|
end
|
40
40
|
|
41
|
+
## 0 1 2 3 4 5 6 7 8
|
42
|
+
## fields: id, date, name, email, company url, source tag, phone, linkedin, comment
|
43
|
+
def import
|
44
|
+
authorize! :import, ::Lead
|
45
|
+
file = params[:csv_file]
|
46
|
+
flags = []
|
47
|
+
errors = []
|
48
|
+
CSV.read(file.path, headers: true).each do |row|
|
49
|
+
puts! row, 'row'
|
50
|
+
puts! row[3], 'email?'
|
51
|
+
company = ::Leadset.find_or_create_by({ company_url: row[4] })
|
52
|
+
lead = ::Lead.new({
|
53
|
+
name: row[2] || 'there',
|
54
|
+
full_name: row[2] || 'there',
|
55
|
+
email: row[3],
|
56
|
+
m3_leadset_id: company.id,
|
57
|
+
phone: row[6],
|
58
|
+
})
|
59
|
+
flag = lead.save
|
60
|
+
flags << flag
|
61
|
+
if !flag
|
62
|
+
errors << lead.errors.full_messages.join(", ")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
flash[:notice] = "Result: #{flags.inspect} ."
|
66
|
+
flash[:alert] = errors
|
67
|
+
redirect_to action: 'new'
|
68
|
+
end
|
69
|
+
|
41
70
|
def index
|
42
71
|
authorize! :index, ::Lead
|
43
|
-
@leads = ::Lead.all.includes( :leadset )
|
72
|
+
@leads = ::Lead.all.includes( :leadset, :email_campaign_leads )
|
73
|
+
lead_emails = @leads.map( &:email ).compact.reject(&:empty?)
|
74
|
+
|
75
|
+
map = %Q{
|
76
|
+
function() {
|
77
|
+
emit(this.to_email, {count: 1})
|
78
|
+
}
|
79
|
+
}
|
80
|
+
reduce = %Q{
|
81
|
+
function(key, values) {
|
82
|
+
var result = {count: 0};
|
83
|
+
values.forEach(function(value) {
|
84
|
+
result.count += value.count;
|
85
|
+
});
|
86
|
+
return result;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
@email_contexts = {}
|
90
|
+
tmp_contexts = Ish::EmailContext.all.where( :to_email.in => lead_emails
|
91
|
+
).map_reduce( map, reduce
|
92
|
+
).out( inline: 1 ## From: https://www.mongodb.com/docs/mongoid/current/reference/map-reduce/
|
93
|
+
).to_a
|
94
|
+
tmp_contexts.map { |x| @email_contexts[x[:_id]] = x[:value][:count].to_i }
|
95
|
+
# puts! @email_contexts, '@email_contexts'
|
96
|
+
|
44
97
|
end
|
45
98
|
|
46
99
|
def new
|
@@ -67,8 +120,9 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
|
|
67
120
|
private
|
68
121
|
|
69
122
|
def set_lists
|
123
|
+
super
|
70
124
|
@leadsets_list = [ [nil,nil] ] + ::Leadset.all.map { |k| [ k.name, k.id ] }
|
71
|
-
@email_campaigns_list = [ [nil,nil] ] + Ish::EmailContext.
|
125
|
+
@email_campaigns_list = [ [nil,nil] ] + Ish::EmailContext.unsent_campaigns.map { |k| [ k.slug, k.id ] }
|
72
126
|
end
|
73
127
|
|
74
128
|
end
|
@@ -61,11 +61,14 @@
|
|
61
61
|
= link_to 'Meetings', meetings_path
|
62
62
|
= link_to '[+]', new_meeting_path
|
63
63
|
%ul
|
64
|
-
%li
|
64
|
+
%li
|
65
|
+
= link_to 'Leads', leads_path
|
66
|
+
= link_to '[+]', new_lead_path
|
65
67
|
%li= link_to 'Leadsets', leadsets_path
|
66
68
|
%li= link_to 'Email Templates', email_templates_path
|
67
69
|
%li
|
68
|
-
= link_to 'Contexts
|
70
|
+
= link_to 'Contexts', email_contexts_path
|
71
|
+
= link_to 'Campaigns', email_campaigns_path
|
69
72
|
= link_to '[+]', new_email_context_path
|
70
73
|
= link_to '[to-send]', notsent_email_contexts_path
|
71
74
|
%hr
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
= form_tag leads_import_path, multipart: true do
|
3
|
+
.doc
|
4
|
+
%ul
|
5
|
+
%li v1 fields: id, date, name, email, company url, source tag, phone, linkedin, comment
|
6
|
+
.field
|
7
|
+
%label File
|
8
|
+
= file_field_tag :csv_file
|
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
|
+
.actions
|
19
|
+
= submit_tag 'Submit'
|
@@ -1,3 +1,19 @@
|
|
1
1
|
|
2
2
|
%h1 Edit lead
|
3
3
|
= render 'form', :lead => @lead
|
4
|
+
|
5
|
+
%hr
|
6
|
+
%h1 Email Campaigns:
|
7
|
+
%ul
|
8
|
+
- @lead.email_campaign_leads.each do |x|
|
9
|
+
%li
|
10
|
+
<b>Sent on ::</b> #{x.sent_at.to_s[0..10]}
|
11
|
+
<b>Slug ::</b> #{x.email_campaign.slug}
|
12
|
+
|
13
|
+
%hr
|
14
|
+
%h1 Single Emails:
|
15
|
+
%ul
|
16
|
+
- @lead.email_contexts.each do |x|
|
17
|
+
%li
|
18
|
+
<b>Sent at ::</b> #{x.sent_at.to_s[0..10]}
|
19
|
+
<b>Subject ::</b> #{x.subject}
|
@@ -18,6 +18,9 @@
|
|
18
18
|
%th Company
|
19
19
|
%th Email
|
20
20
|
%th Tag
|
21
|
+
%th created_at
|
22
|
+
%th n campaign sends
|
23
|
+
%th n single sends
|
21
24
|
|
22
25
|
%tbody
|
23
26
|
- @leads.each do |lead|
|
@@ -26,8 +29,9 @@
|
|
26
29
|
%td= link_to lead.name, lead_path( lead )
|
27
30
|
%td= lead.leadset&.name
|
28
31
|
%td= lead.email
|
29
|
-
-# %td= link_to raw('<i class="fa fa-envelope"></i>'), "mailto:#{lead.email}" if lead.email.present?
|
30
|
-
|
31
|
-
|
32
32
|
%td= lead.tag
|
33
|
+
%td= lead.created_at.to_s[0..10]
|
34
|
+
%td= lead.email_campaign_leads.count
|
35
|
+
%td= @email_contexts[lead.email] || '-'
|
36
|
+
|
33
37
|
|
data/config/routes.rb
CHANGED
@@ -45,12 +45,13 @@ IshManager::Engine.routes.draw do
|
|
45
45
|
# office, below
|
46
46
|
#
|
47
47
|
|
48
|
-
resources :email_campaigns, as: :email_campaigns
|
48
|
+
# resources :email_campaigns, as: :email_campaigns
|
49
49
|
|
50
50
|
get 'email_contexts/iframe_src/:id', to: 'email_contexts#iframe_src', as: :email_context_iframe
|
51
51
|
get 'email_contexts/new_with/:template_slug', to: 'email_contexts#new'
|
52
52
|
post 'email_contexts/send/:id', to: 'email_contexts#do_send', as: :email_context_send
|
53
|
-
get 'email_contexts', to: 'email_contexts#index', as: :email_contexts, defaults: { notsent: false }
|
53
|
+
get 'email_contexts', to: 'email_contexts#index', as: :email_contexts, defaults: { notsent: false, type: Ish::EmailContext::TYPE_SINGLE }
|
54
|
+
get 'email_contexts/campaigns', to: 'email_contexts#index', as: :email_campaigns, defaults: { notsent: false, type: Ish::EmailContext::TYPE_CAMPAIGN }
|
54
55
|
get 'email_contexts/notsent', to: 'email_contexts#index', as: :notsent_email_contexts, defaults: { notsent: true }
|
55
56
|
resources :email_contexts
|
56
57
|
|
@@ -64,6 +65,7 @@ IshManager::Engine.routes.draw do
|
|
64
65
|
|
65
66
|
get 'leads', :to => 'leads#index'
|
66
67
|
post 'leads/bulkop', to: 'leads#bulkop'
|
68
|
+
post 'leads/import', to: 'leads#import', as: :leads_import
|
67
69
|
resources :leads
|
68
70
|
|
69
71
|
resources :leadsets
|
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.
|
4
|
+
version: 0.1.8.341
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -374,6 +374,7 @@ files:
|
|
374
374
|
- app/views/ish_manager/kaminari/_paginator.html.erb
|
375
375
|
- app/views/ish_manager/kaminari/_prev_page.html.erb
|
376
376
|
- app/views/ish_manager/leads/_form.haml
|
377
|
+
- app/views/ish_manager/leads/_form_import.haml
|
377
378
|
- app/views/ish_manager/leads/edit.haml
|
378
379
|
- app/views/ish_manager/leads/index.haml
|
379
380
|
- app/views/ish_manager/leads/new.haml
|