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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b766aa1273a9c863ee71e44e96308ac8ff2de76e4a29079bcf58a23cdc50298b
4
- data.tar.gz: 5c032aa7fac857e68baf760863d0d3de1831de98e1cbf52397c117fa2db41454
3
+ metadata.gz: 2677535542d4c58553358f87c01db219b8995a4d299bc0e7019b3c61bb002c60
4
+ data.tar.gz: 8d78aeb3a31e0c4704267b9cea11cd8b4f570186101c5309ecaade26de4dfa2a
5
5
  SHA512:
6
- metadata.gz: 0f539fda62b5de3856bc7fab46585ad1ffe13be1a9f8285e70d11b2bf327d3887a2f5e63815887abb5ea79164ffc733392f6fa69d9931882428f74cacbed2dbc
7
- data.tar.gz: 98d693ef2b7b0b762b6677e42f1ba2c414f3195b1ea00f009bf55b09e1a03618bf1164e4cef342dca3032baa34294a1c29dacc511c9595ac0b866d510924ba03
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
 
@@ -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
- def self.list
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 = [ OP_DELETE, OP_ADD_TO_CAMPAIGN ]
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
@@ -50,5 +50,7 @@ class Wco::Leadset
50
50
  def to_s
51
51
  company_url
52
52
  end
53
-
53
+ def self.list
54
+ [[nil,nil]] + all.map { |ttt| [ ttt.company_url, ttt.id ] }
55
+ end
54
56
  end
@@ -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, 'out'
44
+ puts! out.response, 'publisher httparty response'
45
+ puts! out.body, 'publisher httparty body'
45
46
  if out.code != 201
46
- raise "#do_run exception: #{out.body}"
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
- - url = lead.new_record? ? leads_path : lead_path( lead.id )
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 :m3_leadset_id, options_for_select(@leadsets_list, selected: lead.m3_leadset_id), { include_blank: true }, { class: :select2 }
22
+ = f.select :leadset, options_for_select(@leadsets_list, selected: lead.leadset_id), { class: :select2 }
25
23
 
26
- .field
27
- %label Rating
28
- = f.number_field :rating
24
+ -# .field
25
+ -# %label Rating
26
+ -# = f.number_field :rating
29
27
 
30
- .field
31
- = f.label :comment
32
- = f.text_area :comment, class: :tinymce
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.wp_tags.inspect
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
@@ -4,6 +4,7 @@
4
4
  .col-sm-12.col-md-6
5
5
  %h1 New Lead
6
6
  = render 'form', lead: @lead
7
- .col-sm-12.col-md-6
8
- %h1 Import Leads
9
- = render 'form_import'
7
+
8
+ -# .col-sm-12.col-md-6
9
+ -# %h1 Import Leads
10
+ -# = render 'form_import'
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/:id', to: 'leads#show', id: /[^\/]+/
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.86
4
+ version: 3.1.0.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev