wco_hosting 0.0.0.3 → 0.0.0.4

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: 8f0b58b867b5892b387e86f64a985030cafcf66e4f69249ba1489f1fd6b156ce
4
+ data.tar.gz: 97e32482d3c0283241f1b179b8c0e07544e6d3c3b9588a8c30a76613a4e18d59
5
5
  SHA512:
6
- metadata.gz: 7537db53e574d8737b39cadc75e79aafe46bee69233c0e495b1f899b54e81645f4d131557b9c8227ae76fe2a30165f009aff66c082534bebc83b78b61f5b3e13
7
- data.tar.gz: fe62a593cf42a12b557f8a5c1875246d6005a3e77353224b149ceb9a174363b90f6c2cd1b9d97005d6bb84b784b06a3ebd4f38bc39aa8676315dec0de6c3f00a
6
+ metadata.gz: 3ad9e34cbb40487eb7f1ead61e62c46702e2462778774109d953b3d91dcdbd658d1f3e86ab5d5ded31e3697529e02d85b2cb73049ca13819ebbd7ac256a0a76b
7
+ data.tar.gz: 9888d34d89214a5e735ea43427f498d87dc716ee25ce14e1380a6922054f1e9d17bdd847233bacce784f28bde77c4f5e2178f2a5f3b3039acf95ad8999f923d3
@@ -1,7 +1,57 @@
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[:appliance].permit!
8
+ authorize! :create, @appliance_tmpl
9
+
10
+ flag = @appliance_tmpl.save
11
+ if flag
12
+ flash[:notice] = 'Success.'
13
+ redirect_to action: :index
14
+ else
15
+ flash[:alert] = "Cannot create appliance tmplate: #{@appliance_tmpl.errors.full_messages.join(', ')}."
16
+ redirect_to action: :index
17
+ end
18
+ end
19
+
20
+ def edit
21
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
22
+ authorize! :edit, @appliance_tmpl
23
+ end
24
+
3
25
  def index
4
26
  authorize! :index, WcoHosting::ApplianceTmpl
5
27
  @appliance_tmpls = WcoHosting::ApplianceTmpl.all
6
28
  end
29
+
30
+ def new
31
+ authorize! :index, WcoHosting::ApplianceTmpl
32
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.new
33
+ end
34
+
35
+ def update
36
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
37
+ authorize! :update, @appliance_tmpl
38
+ flag = @appliance_tmpl.update params[:appliance].permit!
39
+ if flag
40
+ flash_notice 'success'
41
+ else
42
+ flash_alert "Cannot update appliance template: #{@appliance_tmpl.errors.full_messages.join(', ')}."
43
+ end
44
+ redirect_to action: :index
45
+ end
46
+
47
+ ##
48
+ ## private
49
+ ##
50
+ private
51
+
52
+ def set_lists
53
+ @new_appliance_tmpl = WcoHosting::ApplianceTmpl.new
54
+ end
55
+
7
56
  end
57
+
@@ -0,0 +1,23 @@
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: :appliance, 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
+
22
+ .actions
23
+ = 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,6 +1,8 @@
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
@@ -0,0 +1,4 @@
1
+
2
+ .appliance-tmpls-new
3
+ %h5 New ApplianceTmpl `#{@appliance_tmpl}`
4
+ = render 'form', appliance_tmpl: @appliance_tmpl
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
@@ -216,7 +216,10 @@ files:
216
216
  - app/models/wco/ability.rb
217
217
  - app/views/layouts/wco_hosting/application.haml
218
218
  - app/views/wco/application/_alerts_notices.haml
219
+ - app/views/wco_hosting/appliance_tmpls/_form.haml
220
+ - app/views/wco_hosting/appliance_tmpls/edit.haml
219
221
  - app/views/wco_hosting/appliance_tmpls/index.haml
222
+ - app/views/wco_hosting/appliance_tmpls/new.haml
220
223
  - app/views/wco_hosting/appliances/index.haml
221
224
  - app/views/wco_hosting/application/home.haml
222
225
  - app/views/wco_hosting/leadsets/_form.haml