wco_models 3.1.0.86 → 3.1.0.88
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/wco/leads_controller.rb +24 -0
- data/app/models/wco/lead.rb +8 -7
- data/app/models/wco/leadset.rb +3 -1
- data/app/models/wco/publisher.rb +11 -2
- data/app/views/wco/leads/_form.haml +9 -12
- data/app/views/wco/leads/new.haml +4 -3
- data/config/routes.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2677535542d4c58553358f87c01db219b8995a4d299bc0e7019b3c61bb002c60
|
4
|
+
data.tar.gz: 8d78aeb3a31e0c4704267b9cea11cd8b4f570186101c5309ecaade26de4dfa2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6784c7d5c6d8f601d9f7a86b342a8874629d91df36a326a1953176123fadff3124c7374ccf2fa7a745be36571ea70d019f63775290ef3f99e6a8cfa44e2d96a0
|
7
|
+
data.tar.gz: 574a70b6ca0e9def07f79938feb6193fc3dc1e6a9b4625f4c35b304fbfecb4d4339878962b6fdb6a343c0543f789521211b77223ff0c97814ec3b997201c81f9
|
@@ -3,6 +3,20 @@ class Wco::LeadsController < Wco::ApplicationController
|
|
3
3
|
|
4
4
|
before_action :set_lists
|
5
5
|
|
6
|
+
def create
|
7
|
+
params[:lead][:tags].delete ''
|
8
|
+
params[:lead][:leadset] = nil if params[:lead][:leadset].blank?
|
9
|
+
|
10
|
+
@lead = Wco::Lead.new params[:lead].permit!
|
11
|
+
authorize! :crete, @lead
|
12
|
+
if @lead.save
|
13
|
+
flash_notice 'ok'
|
14
|
+
else
|
15
|
+
flash_alert @lead
|
16
|
+
end
|
17
|
+
redirect_to action: :index
|
18
|
+
end
|
19
|
+
|
6
20
|
def index
|
7
21
|
authorize! :index, Wco::Lead
|
8
22
|
@leads = Wco::Lead.all
|
@@ -27,6 +41,11 @@ class Wco::LeadsController < Wco::ApplicationController
|
|
27
41
|
@leads = @leads.page( params[:leads_page ] ).per( current_profile.per_page )
|
28
42
|
end
|
29
43
|
|
44
|
+
def new
|
45
|
+
authorize! :new, Wco::Lead
|
46
|
+
@lead = Wco::Lead.new
|
47
|
+
end
|
48
|
+
|
30
49
|
def show
|
31
50
|
@lead = Wco::Lead.where({ id: params[:id] }).first
|
32
51
|
@lead ||= Wco::Lead.where({ email: params[:id] }).first
|
@@ -44,6 +63,10 @@ class Wco::LeadsController < Wco::ApplicationController
|
|
44
63
|
# @videos = @lead.videos.page( params[:videos_page] ).per( current_profile.per_page )
|
45
64
|
end
|
46
65
|
|
66
|
+
def update
|
67
|
+
params[:tags].delete ''
|
68
|
+
end
|
69
|
+
|
47
70
|
##
|
48
71
|
## private
|
49
72
|
##
|
@@ -51,6 +74,7 @@ class Wco::LeadsController < Wco::ApplicationController
|
|
51
74
|
|
52
75
|
def set_lists
|
53
76
|
@email_campaigns_list = [[nil,nil]] + WcoEmail::Campaign.all.map { |c| [ c.slug, c.id ] }
|
77
|
+
@leadsets_list = Wco::Leadset.list
|
54
78
|
@tags_list = Wco::Tag.list
|
55
79
|
end
|
56
80
|
|
data/app/models/wco/lead.rb
CHANGED
@@ -29,7 +29,6 @@ class Wco::Lead
|
|
29
29
|
has_many :email_contexts, class_name: '::WcoEmail::Context'
|
30
30
|
def ctxs; email_contexts; end
|
31
31
|
has_many :email_actions, class_name: '::WcoEmail::EmailAction'
|
32
|
-
# has_and_belongs_to_many :scheduled_email_actions, class_name: '::WcoEmail::ScheduledEmailAction'
|
33
32
|
def schs; email_actions; end
|
34
33
|
has_and_belongs_to_many :email_campaigns, class_name: '::WcoEmail::Campaign'
|
35
34
|
has_and_belongs_to_many :tags, class_name: '::Wco::Tag'
|
@@ -37,13 +36,9 @@ class Wco::Lead
|
|
37
36
|
# has_many :galleries, class_name: 'Wco::Gallery'
|
38
37
|
# has_many :videos, class_name: 'Wco::Video'
|
39
38
|
|
40
|
-
|
41
|
-
[[nil,nil]] + all.map { |p| [ p.email, p.id ] }
|
42
|
-
end
|
43
|
-
|
44
|
-
OP_DELETE = 'delete'
|
39
|
+
OP_DELETE = 'delete'
|
45
40
|
OP_ADD_TO_CAMPAIGN = 'add_to_campaign'
|
46
|
-
OPS
|
41
|
+
OPS = [ OP_DELETE, OP_ADD_TO_CAMPAIGN ]
|
47
42
|
|
48
43
|
has_many :unsubscribes, class_name: '::WcoEmail::Unsubscribe'
|
49
44
|
field :unsubscribe_token
|
@@ -54,4 +49,10 @@ class Wco::Lead
|
|
54
49
|
self[:unsubscribe_token]
|
55
50
|
end
|
56
51
|
|
52
|
+
def to_s
|
53
|
+
email
|
54
|
+
end
|
55
|
+
def self.list
|
56
|
+
[[nil,nil]] + all.map { |p| [ p.email, p.id ] }
|
57
|
+
end
|
57
58
|
end
|
data/app/models/wco/leadset.rb
CHANGED
data/app/models/wco/publisher.rb
CHANGED
@@ -41,9 +41,18 @@ class Wco::Publisher
|
|
41
41
|
headers: @headers,
|
42
42
|
basic_auth: { username: @site.username, password: @site.password },
|
43
43
|
})
|
44
|
-
puts! out.response, '
|
44
|
+
puts! out.response, 'publisher httparty response'
|
45
|
+
puts! out.body, 'publisher httparty body'
|
45
46
|
if out.code != 201
|
46
|
-
|
47
|
+
puts! out.body, "publisher#do_run non-201 status"
|
48
|
+
::ExceptionNotifier.notify_exception(
|
49
|
+
Exception.new,
|
50
|
+
data: {
|
51
|
+
httparty_body: out.body,
|
52
|
+
httparty: out,
|
53
|
+
label: "publisher#do_run non-201 status",
|
54
|
+
} )
|
55
|
+
raise out.body
|
47
56
|
end
|
48
57
|
|
49
58
|
eval( after_eval ) if after_eval.present?
|
@@ -1,7 +1,5 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
= form_for lead, html: { multipart: true }, as: :lead, url: url do |f|
|
2
|
+
= form_for lead, html: { multipart: true } do |f|
|
5
3
|
|
6
4
|
.field
|
7
5
|
= f.label :name
|
@@ -21,20 +19,19 @@
|
|
21
19
|
|
22
20
|
.field
|
23
21
|
= f.label "Leadset (company)"
|
24
|
-
= f.select :
|
22
|
+
= f.select :leadset, options_for_select(@leadsets_list, selected: lead.leadset_id), { class: :select2 }
|
25
23
|
|
26
|
-
.field
|
27
|
-
|
28
|
-
|
24
|
+
-# .field
|
25
|
+
-# %label Rating
|
26
|
+
-# = f.number_field :rating
|
29
27
|
|
30
|
-
.field
|
31
|
-
|
32
|
-
|
28
|
+
-# .field
|
29
|
+
-# = f.label :comment
|
30
|
+
-# = f.text_area :comment, class: :tinymce
|
33
31
|
|
34
32
|
.field
|
35
33
|
= f.label "Tags"
|
36
|
-
= lead.
|
37
|
-
= f.select :lead_tags, options_for_select(@tags_list, selected: lead.wp_tags.map(&:term_id) ), {}, { class: :select2, multiple: true }
|
34
|
+
= f.select :tags, options_for_select(@tags_list, selected: lead.tag_ids ), {}, { class: :select2, multiple: true }
|
38
35
|
|
39
36
|
.field
|
40
37
|
= f.label :photo
|
data/config/routes.rb
CHANGED
@@ -22,9 +22,10 @@ Wco::Engine.routes.draw do
|
|
22
22
|
post 'invoices/:id/send-stripe', to: 'invoices#send_stripe', as: :send_invoice_stripe
|
23
23
|
resources :invoices
|
24
24
|
|
25
|
-
get 'leads
|
25
|
+
get 'leads/new', to: 'leads#new'
|
26
26
|
post 'leads/bulkop', to: 'leads#bulkop'
|
27
27
|
post 'leads/import', to: 'leads#import', as: :leads_import
|
28
|
+
get 'leads/:id', to: 'leads#show', id: /[^\/]+/
|
28
29
|
resources :leads
|
29
30
|
resources :leadsets
|
30
31
|
delete 'logs/bulkop', to: 'logs#bulkop', as: :logs_bulkop
|