wco_models 3.1.0.112 → 3.1.0.114
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/assets/stylesheets/wco/{application.css → application.scss} +1 -0
- data/app/controllers/wco/leads_controller.rb +5 -0
- data/app/controllers/wco/prices_controller.rb +3 -5
- data/app/models/wco/leadset.rb +3 -2
- data/app/models/wco_hosting/appliance_tmpl.rb +1 -42
- data/app/models/wco_hosting/domain.rb +5 -0
- data/app/models/wco_hosting/serverhost.rb +1 -0
- data/app/models/wco_hosting/subdomain.rb +24 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b569a16a9ac875085e8bbb82dab997a96759d476a197a59199ee99d6be21d9
|
4
|
+
data.tar.gz: 580890aebb83e9c43f2803949466370fc97dc0dc11cf68d3e0b3beb140132957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 330694e474ee6b97ed590f316bfe77c1f48bf9edfcf94adbf2cdfdc6ae523a21483f087c213ed2fc5367398a736e292d8c0d8ee41c3d0d720d756f97668167ab
|
7
|
+
data.tar.gz: 32cab1e5fa94860b08e97a8a7be5ebee0613291b349274a6feadf36af3664334631a92cfca0cb8291cbb9ea5bd93d2e654ae9f79cb6a62c7fd36b903d66a0694
|
@@ -30,6 +30,11 @@ class Wco::LeadsController < Wco::ApplicationController
|
|
30
30
|
@leads = @leads.any_of(
|
31
31
|
{ email: /#{params[:q].downcase}/i },
|
32
32
|
{ name: /#{params[:q].downcase}/i } )
|
33
|
+
|
34
|
+
if 1 == @leads.length
|
35
|
+
redirect_to controller: 'wco/leads', action: 'show', id: @leads[0].id
|
36
|
+
return
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
40
|
# if params[:q_tag_ids].present?
|
@@ -47,11 +47,9 @@ class Wco::PricesController < Wco::ApplicationController
|
|
47
47
|
redirect_to request.referrer || root_path
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# end
|
54
|
-
end
|
50
|
+
## delete and the create, instead
|
51
|
+
# def update
|
52
|
+
# end
|
55
53
|
|
56
54
|
end
|
57
55
|
|
data/app/models/wco/leadset.rb
CHANGED
@@ -19,10 +19,11 @@ class Wco::Leadset
|
|
19
19
|
|
20
20
|
|
21
21
|
has_many :appliances, class_name: '::WcoHosting::Appliance', inverse_of: :leadset
|
22
|
-
has_many :appliance_tmpl_prices,
|
22
|
+
has_many :appliance_tmpl_prices, class_name: 'Wco::Price'
|
23
23
|
has_many :environments, class_name: '::WcoHosting::Environment', inverse_of: :leadset
|
24
|
-
has_many :invoices,
|
24
|
+
has_many :invoices, class_name: 'Wco::Invoice'
|
25
25
|
has_many :leads, class_name: 'Wco::Lead'
|
26
|
+
has_many :subdomains, class_name: 'WcoHosting::Subdomain'
|
26
27
|
|
27
28
|
has_many :profiles, class_name: 'Wco::Profile', inverse_of: :leadset
|
28
29
|
has_many :subscriptions, class_name: 'Wco::Subscription', inverse_of: :leadset
|
@@ -63,52 +63,11 @@ class WcoHosting::ApplianceTmpl
|
|
63
63
|
# belongs_to :price, class_name: 'Wco::Price', foreign_key: :wco_price_id
|
64
64
|
|
65
65
|
field :price_id # stripe
|
66
|
-
|
67
|
-
attr_accessor :tmp_price_interval
|
66
|
+
|
68
67
|
before_validation :set_stripe_product_price, on: :create
|
69
68
|
def set_stripe_product_price
|
70
69
|
stripe_product = Stripe::Product.create({ name: "Appliance #{self}" })
|
71
70
|
self.product_id = stripe_product.id
|
72
|
-
|
73
|
-
wco_price = Wco::Price.create!({
|
74
|
-
amount_cents: tmp_price_cents,
|
75
|
-
interval: tmp_price_interval,
|
76
|
-
product_id: stripe_product.id,
|
77
|
-
product: self,
|
78
|
-
})
|
79
|
-
self.prices.push wco_price
|
80
|
-
price_hash = {
|
81
|
-
product: stripe_product.id,
|
82
|
-
unit_amount: tmp_price_cents,
|
83
|
-
currency: 'usd',
|
84
|
-
recurring: {
|
85
|
-
interval: tmp_price_interval,
|
86
|
-
},
|
87
|
-
}
|
88
|
-
stripe_price = Stripe::Price.create( price_hash )
|
89
|
-
self.price_id = stripe_price.id
|
90
|
-
end
|
91
|
-
before_validation :update_stripe_product_price, on: :update
|
92
|
-
def update_stripe_product_price
|
93
|
-
if tmp_price_cents.present?
|
94
|
-
price_hash = {
|
95
|
-
product: product_id,
|
96
|
-
unit_amount: tmp_price_cents,
|
97
|
-
currency: 'usd',
|
98
|
-
recurring: {
|
99
|
-
interval: tmp_price_interval,
|
100
|
-
},
|
101
|
-
}
|
102
|
-
stripe_price = Stripe::Price.create( price_hash )
|
103
|
-
wco_price = Wco::Price.create!({
|
104
|
-
amount_cents: tmp_price_cents,
|
105
|
-
interval: tmp_price_interval,
|
106
|
-
price_id: stripe_price.id,
|
107
|
-
product_id: product_id,
|
108
|
-
product: self,
|
109
|
-
})
|
110
|
-
self.prices.push wco_price
|
111
|
-
end
|
112
71
|
end
|
113
72
|
|
114
73
|
|
@@ -8,12 +8,17 @@ class WcoHosting::Domain
|
|
8
8
|
field :name
|
9
9
|
validates :name, presence: true, uniqueness: true
|
10
10
|
|
11
|
+
has_many :subdomains, class_name: 'WcoHosting::Subdomain'
|
12
|
+
|
11
13
|
STATUS_ACTIVE = 'active'
|
12
14
|
STATUS_INACTIVE = 'inactive'
|
13
15
|
STATUSES = [ 'active', 'inactive' ]
|
14
16
|
field :status
|
15
17
|
scope :active, ->{ where(status: STATUS_ACTIVE) }
|
16
18
|
|
19
|
+
def to_s
|
20
|
+
name
|
21
|
+
end
|
17
22
|
def self.list
|
18
23
|
[[nil,nil]] + active.map { |i| [i.name, i.name ] }
|
19
24
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
class WcoHosting::Subdomain
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
include Mongoid::Paranoia
|
6
|
+
store_in collection: 'wco_dns_subdomains'
|
7
|
+
|
8
|
+
field :name
|
9
|
+
validates :name, presence: true, uniqueness: { scope: :domain_id }
|
10
|
+
|
11
|
+
belongs_to :domain, class_name: 'WcoHosting::Domain'
|
12
|
+
belongs_to :leadset, class_name: 'Wco::Leadset'
|
13
|
+
|
14
|
+
# STATUS_ACTIVE = 'active'
|
15
|
+
# STATUS_INACTIVE = 'inactive'
|
16
|
+
# STATUSES = [ 'active', 'inactive' ]
|
17
|
+
# field :status
|
18
|
+
# scope :active, ->{ where(status: STATUS_ACTIVE) }
|
19
|
+
|
20
|
+
# def self.list
|
21
|
+
# [[nil,nil]] + active.map { |i| [i.name, i.name ] }
|
22
|
+
# end
|
23
|
+
end
|
24
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wco_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.114
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -380,7 +380,7 @@ files:
|
|
380
380
|
- app/assets/stylesheets/production_theme.scss
|
381
381
|
- app/assets/stylesheets/vendor/bootstrap-4.6.2.min.css
|
382
382
|
- app/assets/stylesheets/wco/alerts_notices.scss
|
383
|
-
- app/assets/stylesheets/wco/application.
|
383
|
+
- app/assets/stylesheets/wco/application.scss
|
384
384
|
- app/assets/stylesheets/wco/chip.scss
|
385
385
|
- app/assets/stylesheets/wco/conversations.scss
|
386
386
|
- app/assets/stylesheets/wco/galleries.scss
|
@@ -451,6 +451,7 @@ files:
|
|
451
451
|
- app/models/wco_hosting/domain.rb
|
452
452
|
- app/models/wco_hosting/environment.rb
|
453
453
|
- app/models/wco_hosting/serverhost.rb
|
454
|
+
- app/models/wco_hosting/subdomain.rb
|
454
455
|
- app/views/layouts/wco/application.haml
|
455
456
|
- app/views/wco/_alerts_notices.haml
|
456
457
|
- app/views/wco/_analytics.erb
|