wco_hosting 0.0.0.3 → 0.0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db8fa49242cace48684ab299e74aeeb62945ac04961c300f0ca642c10f7015a7
4
- data.tar.gz: 861d0db26431887c700c759befc3c398061e076a00cffd24138f0694dc217e33
3
+ metadata.gz: 3bc806f95a42fc25f895128a2c07bbf2d443c12688ad3b938d67f6fe39506df1
4
+ data.tar.gz: e1e4e8d5c60a4eaf04cd710efe01616782949fc0b317a058b283132e0f13f44c
5
5
  SHA512:
6
- metadata.gz: 7537db53e574d8737b39cadc75e79aafe46bee69233c0e495b1f899b54e81645f4d131557b9c8227ae76fe2a30165f009aff66c082534bebc83b78b61f5b3e13
7
- data.tar.gz: fe62a593cf42a12b557f8a5c1875246d6005a3e77353224b149ceb9a174363b90f6c2cd1b9d97005d6bb84b784b06a3ebd4f38bc39aa8676315dec0de6c3f00a
6
+ metadata.gz: bb1f61cde4d1b87922cf4ca1c244b9927f9c707a1c2ad6a00359fba46aecd72d5e8d6824620c552f450b3fee81f7bf63cb5cae8f41d1e4f7afd7946f70563e17
7
+ data.tar.gz: fa2777f315eae9ae27ef5d9d063131c9aeffeade11eed3ff1a519ca3d2dc86f45d9c376f94d89e9551313de76ad238b1aa6ca28ad6499c5b0de057658c3ad6cd
@@ -0,0 +1,2 @@
1
+
2
+ console.log('Loaded wco_hosting/application.js')
@@ -1,7 +1,68 @@
1
1
 
2
2
  class WcoHosting::ApplianceTmplsController < WcoHosting::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def create
7
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.new params[:tmpl].permit!
8
+ authorize! :create, @appliance_tmpl
9
+
10
+ @appliance_tmpl.price_id = Wco::Price.find( params[:tmpl][:wco_price_id] ).price_id
11
+
12
+ flag = @appliance_tmpl.save
13
+ if flag
14
+ flash[:notice] = 'Success.'
15
+ redirect_to action: :index
16
+ else
17
+ flash[:alert] = "Cannot create appliance tmplate: #{@appliance_tmpl.errors.full_messages.join(', ')}."
18
+ redirect_to action: :index
19
+ end
20
+ end
21
+
22
+ def edit
23
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
24
+ authorize! :edit, @appliance_tmpl
25
+ end
26
+
3
27
  def index
4
28
  authorize! :index, WcoHosting::ApplianceTmpl
5
29
  @appliance_tmpls = WcoHosting::ApplianceTmpl.all
6
30
  end
31
+
32
+ def new
33
+ authorize! :index, WcoHosting::ApplianceTmpl
34
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.new
35
+ end
36
+
37
+ def update
38
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
39
+ authorize! :update, @appliance_tmpl
40
+
41
+ price = Wco::Price.find( params[:tmpl][:price] )
42
+ price.product = @appliance_tmpl
43
+ price.save
44
+
45
+ params[:tmpl][:price_id] = price.price_id
46
+ params[:tmpl][:price] = price
47
+
48
+ flag = @appliance_tmpl.update params[:tmpl].permit!
49
+ if flag
50
+ flash_notice 'success'
51
+ else
52
+ flash_alert "Cannot update appliance template: #{@appliance_tmpl.errors.full_messages.join(', ')}."
53
+ end
54
+ redirect_to action: :index
55
+ end
56
+
57
+ ##
58
+ ## private
59
+ ##
60
+ private
61
+
62
+ def set_lists
63
+ @prices_list = Wco::Price.list
64
+ @new_appliance_tmpl = WcoHosting::ApplianceTmpl.new
65
+ end
66
+
7
67
  end
68
+
@@ -0,0 +1,11 @@
1
+
2
+ class WcoHosting::SubscriptionsController < WcoHosting::ApplicationController
3
+
4
+ def create
5
+ Stripe::Subscription.create({
6
+ customer: 'cus_Na6dX7aXxi11N4',
7
+ items: [{price: 'price_1MowQULkdIwHu7ixraBm864M'}],
8
+ })
9
+ end
10
+
11
+ end
@@ -5,15 +5,21 @@
5
5
  %title Wco Hosting
6
6
  = csrf_meta_tags
7
7
  = csp_meta_tag
8
+ -# = javascript_include_tag 'wco_hosting/application'
8
9
  = stylesheet_link_tag "wco_hosting/application", media: "all"
9
10
  %body
10
11
 
11
- %h1 Wco Hosting
12
- %nav
12
+ %h2 Wco Hosting
13
+ %nav.flex-row
14
+ %ul
15
+ %li= link_to 'ROOT', '/'
16
+ %li= link_to '/email', '/email'
17
+ %li= link_to '/wco', '/wco'
13
18
  %ul
14
19
  %li= link_to 'Wco::Leadsets', leadsets_path
15
20
  %li= link_to 'ApplianceTmpl`s', appliance_tmpls_path
16
21
  %li= link_to 'Appliances', appliances_path
22
+ -# %li= link_to 'Products', products_path
17
23
  %li= link_to 'Serverhosts', serverhosts_path
18
24
  %hr
19
25
 
@@ -0,0 +1,26 @@
1
+
2
+ - url = appliance_tmpl.new_record? ? appliance_tmpls_path : appliance_tmpl_path( appliance_tmpl )
3
+
4
+ .appliance-tmpls--form
5
+ = form_for appliance_tmpl, as: :tmpl, url: url do |f|
6
+ .field
7
+ = f.label :kind
8
+ = f.text_field :kind
9
+ .field
10
+ = f.label :version
11
+ = f.text_field :version
12
+ .field
13
+ = f.label :descr
14
+ = f.text_area :descr
15
+ .field
16
+ = f.label :image
17
+ = f.text_field :image, class: 'w-100'
18
+ .field
19
+ %label volume_zip
20
+ = f.text_field :volume_zip, class: 'w-100'
21
+ .field
22
+ %label price
23
+ = f.select :price, options_for_select( @prices_list, selected: appliance_tmpl.price )
24
+
25
+ .actions
26
+ = f.submit 'Submit'
@@ -0,0 +1,4 @@
1
+
2
+ .appliance-tmpls-edit.maxwidth
3
+ %h5 Edit ApplianceTmpl `#{@appliance_tmpl}`
4
+ = render 'form', appliance_tmpl: @appliance_tmpl
@@ -1,23 +1,30 @@
1
1
 
2
2
  .appliance-tmpls-index
3
- %h5 ApplianceTmpl's
3
+ %h5
4
+ ApplianceTmpl's
5
+ = link_to '[+]', new_appliance_tmpl_path
4
6
 
5
7
  %table.bordered
6
8
  %tr
7
- %th id
9
+ %th &nbsp;
8
10
  %th kind
9
11
  %th version
10
12
  %th image
11
13
  %th volume_zip
12
- -# %td &nbsp;
14
+ %th price
15
+ %td &nbsp;
13
16
 
14
17
  - @appliance_tmpls.each do |tmpl|
15
18
  %tr
16
- %td= tmpl.id
19
+ %td
20
+ = link_to '[~]', edit_appliance_tmpl_path(tmpl)
17
21
  %td= tmpl.kind
18
22
  %td= tmpl.version
19
23
  %td= tmpl.image
20
24
  %td= tmpl.volume_zip
21
- -# %td= tmpl.inspect
22
-
25
+ %td
26
+ = tmpl.price
27
+ %br
28
+ = tmpl.price_id
29
+ %td= tmpl.inspect
23
30
 
@@ -0,0 +1,4 @@
1
+
2
+ .appliance-tmpls-new
3
+ %h5 New ApplianceTmpl `#{@appliance_tmpl}`
4
+ = render 'form', appliance_tmpl: @appliance_tmpl
@@ -1,8 +1,6 @@
1
1
 
2
2
  - url = leadset.new_record? ? leadsets_path : leadset_path(leadset)
3
3
  .leadsets--form
4
- %ul
5
- %li <b>Next Serverhost:</b> #{leadset.next_serverhost}
6
4
 
7
5
  = form_for leadset, as: :leadset, url: url do |f|
8
6
  .field
@@ -2,12 +2,21 @@
2
2
  .leadsets-index
3
3
  %h5 Leadsets
4
4
 
5
- %ul
6
- - @leadsets.each do |leadset|
7
- %li.flex-row
8
- .gray= leadset.id.to_s
9
- &nbsp;&nbsp;
10
- = link_to "[view]", leadset_path(leadset)
11
- %ul
12
- %li <b>company_url:</b> #{leadset.company_url}
13
- %li <b>serverhosts:</b> #{leadset.serverhosts.map(&:name).join(",")}
5
+ %table.bordered
6
+ %tr
7
+ %th &nbsp;
8
+ %th company_url
9
+ %th serverhosts
10
+ %th customer_id
11
+ %td &nbsp;
12
+ - @leadsets.each do |item|
13
+ %tr
14
+ %td
15
+ = link_to '[~]', edit_leadset_path(item)
16
+ %td= link_to item.company_url, leadset_path(item)
17
+ %td= item.serverhosts.map(&:name).join(",")
18
+ %td= item.customer_id
19
+ %td
20
+ = item.inspect
21
+
22
+
@@ -1,5 +1,13 @@
1
1
 
2
2
  .leadsets-show
3
- %h5 Leadset #{@leadset.inspect}
3
+ %h5 Leadset `#{@leadset.company_url}`
4
+
5
+ %ul
6
+ %li <b>Next Serverhost:</b> #{@leadset.next_serverhost}
7
+ %li
8
+ <b>Subscriptions (#{@leadset.subscriptions.length}):</b>
9
+ %ul
10
+ - @leadset.subscriptions.each do |item|
11
+ %li= item.inspect
4
12
 
5
13
  = render '/wco_hosting/leadsets/form', leadset: @leadset
@@ -10,7 +10,7 @@
10
10
  %th next_port
11
11
  %th public_ip
12
12
  %th ssh_host
13
- %td &nbsp;
13
+ -# %td &nbsp;
14
14
  - @serverhosts.each do |s|
15
15
  %tr
16
16
  %td
@@ -18,6 +18,5 @@
18
18
  %td= s.ssh_host
19
19
  %td= s.next_port
20
20
  %td= s.public_ip
21
- %td
22
- = s.inspect
21
+ -# %td= s.inspect
23
22
 
@@ -0,0 +1,4 @@
1
+
2
+ Rails.application.config.assets.version = '1.0'
3
+
4
+ Rails.application.config.assets.precompile += %w( application.js application.css )
data/config/routes.rb CHANGED
@@ -9,7 +9,8 @@ WcoHosting::Engine.routes.draw do
9
9
  # get 'email_conversations/not-in/:tagname_not', to: '/wco/email_conversations#index', as: :email_conversations_in_not
10
10
  # resources :email_conversations
11
11
 
12
- resources :serverhosts
13
12
  resources :leadsets
14
13
 
14
+ resources :serverhosts
15
+
15
16
  end
data/lib/wco_hosting.rb CHANGED
@@ -7,7 +7,7 @@ require "wco_hosting/engine"
7
7
  ## From: https://github.com/rails/rails/issues/30701
8
8
  def logger; Rails.logger; end
9
9
 
10
- require 'ish_models'
10
+ # require 'ish_models'
11
11
 
12
12
  module Wco; end
13
13
  module WcoHosting; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_hosting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.3
4
+ version: 0.0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-23 00:00:00.000000000 Z
11
+ date: 2023-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 6.3.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: cancancan
42
+ name: sass-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.5.0
47
+ version: '5.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.5.0
54
+ version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: devise
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,21 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 4.9.3
69
69
  - !ruby/object:Gem::Dependency
70
- name: ish_models
70
+ name: cancancan
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.5.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.5.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: wco_models
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
@@ -179,19 +193,19 @@ dependencies:
179
193
  - !ruby/object:Gem::Version
180
194
  version: 4.0.0
181
195
  - !ruby/object:Gem::Dependency
182
- name: sass-rails
196
+ name: stripe
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: '5.0'
201
+ version: 10.4.0
188
202
  type: :runtime
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: '5.0'
208
+ version: 10.4.0
195
209
  description: https://wasya.co
196
210
  email:
197
211
  - victor@wasya.co
@@ -202,6 +216,7 @@ files:
202
216
  - README.txt
203
217
  - Rakefile
204
218
  - app/assets/config/wco_hosting_manifest.js
219
+ - app/assets/javascript/wco_hosting/application.js
205
220
  - app/assets/stylesheets/wco_hosting/application.css
206
221
  - app/assets/stylesheets/wco_hosting/main.scss
207
222
  - app/controllers/wco_hosting/appliance_tmpls_controller.rb
@@ -209,14 +224,16 @@ files:
209
224
  - app/controllers/wco_hosting/application_controller.rb
210
225
  - app/controllers/wco_hosting/leadsets_controller.rb
211
226
  - app/controllers/wco_hosting/serverhosts_controller.rb
212
- - app/controllers/wco_hosting/sessions_controller.rb-trash
227
+ - app/controllers/wco_hosting/subscriptions_controller.rb
213
228
  - app/helpers/wco_hosting/application_helper.rb
214
229
  - app/jobs/wco_hosting/application_job.rb
215
230
  - app/mailers/wco_hosting/application_mailer.rb
216
231
  - app/models/wco/ability.rb
217
232
  - app/views/layouts/wco_hosting/application.haml
218
- - app/views/wco/application/_alerts_notices.haml
233
+ - app/views/wco_hosting/appliance_tmpls/_form.haml
234
+ - app/views/wco_hosting/appliance_tmpls/edit.haml
219
235
  - app/views/wco_hosting/appliance_tmpls/index.haml
236
+ - app/views/wco_hosting/appliance_tmpls/new.haml
220
237
  - app/views/wco_hosting/appliances/index.haml
221
238
  - app/views/wco_hosting/application/home.haml
222
239
  - app/views/wco_hosting/leadsets/_form.haml
@@ -226,6 +243,7 @@ files:
226
243
  - app/views/wco_hosting/serverhosts/edit.haml
227
244
  - app/views/wco_hosting/serverhosts/index.haml
228
245
  - app/views/wco_hosting/serverhosts/new.haml
246
+ - config/initializers/assets.rb
229
247
  - config/routes.rb
230
248
  - lib/tasks/wco_hosting_tasks.rake
231
249
  - lib/wco_hosting.rb
@@ -1,19 +0,0 @@
1
-
2
- class WcoHosting::SessionsController < WcoHosting::ApplicationController
3
-
4
- skip_before_action :verify_authenticity_token, only: :create
5
-
6
- def new
7
- render :new
8
- end
9
-
10
- def create
11
- puts! params, '#create'
12
-
13
- user_info = request.env['omniauth.auth']
14
- puts! user_info, 'user_info'
15
-
16
- render json: { status: :ok }
17
- end
18
-
19
- end
@@ -1,22 +0,0 @@
1
-
2
- .row.max-width
3
- .col-sm-12
4
- - if notice&.class == String
5
- .notice
6
- = notice
7
- .close [x]
8
- - if notice&.class == Array
9
- - notice.each do |i|
10
- .notice
11
- = i
12
- .close [x]
13
- - if alert&.class == String
14
- .alert
15
- = alert
16
- .close [x]
17
- - if alert&.class == Array
18
- - alert.each do |i|
19
- .alert
20
- = i
21
- .close [x]
22
-