wco_hosting 0.0.0.1 → 0.0.0.3

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: ad86ddea646207d16f72d9a01a7b925fa85574641164a874fcb68bba68867722
4
- data.tar.gz: 48b073865fc07cb5a04ed435f2d870a2e0374dc66280f6bc0a3f5de33e1dcb10
3
+ metadata.gz: db8fa49242cace48684ab299e74aeeb62945ac04961c300f0ca642c10f7015a7
4
+ data.tar.gz: 861d0db26431887c700c759befc3c398061e076a00cffd24138f0694dc217e33
5
5
  SHA512:
6
- metadata.gz: 01beb59a4811affdc28437ec87a7c98cbf1bfbf9a1d2d44e10e4816b039e2706492892491b68ce37f5e005b8b71db04c38dab0562b580686d0ccf806afec9fe8
7
- data.tar.gz: 1005ac9dc93f5626397153768691c3705fc7cc0e7e11bedbad6ec3b5e6247c7c7f5e4db5ed53050707c01a72dd815729bc7f886fd16125c510216db93384943a
6
+ metadata.gz: 7537db53e574d8737b39cadc75e79aafe46bee69233c0e495b1f899b54e81645f4d131557b9c8227ae76fe2a30165f009aff66c082534bebc83b78b61f5b3e13
7
+ data.tar.gz: fe62a593cf42a12b557f8a5c1875246d6005a3e77353224b149ceb9a174363b90f6c2cd1b9d97005d6bb84b784b06a3ebd4f38bc39aa8676315dec0de6c3f00a
@@ -1,9 +1,18 @@
1
1
 
2
2
  class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
3
3
 
4
- def index
5
- authorize! :index, WcoHosting::Serverhost
6
- @serverhosts = WcoHosting::Serverhost.all
4
+ def create
5
+ @serverhost = WcoHosting::Serverhost.new params[:serverhost].permit!
6
+ authorize! :create, @serverhost
7
+
8
+ flag = @serverhost.save
9
+ if flag
10
+ flash[:notice] = 'Success.'
11
+ redirect_to action: :index
12
+ else
13
+ flash[:alert] = "Cannot create serverhost: #{@serverhost.errors.full_messages.join(', ')}."
14
+ render action: :index
15
+ end
7
16
  end
8
17
 
9
18
  def edit
@@ -11,6 +20,17 @@ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
11
20
  authorize! :edit, @serverhost
12
21
  end
13
22
 
23
+ def index
24
+ authorize! :index, WcoHosting::Serverhost
25
+ @serverhosts = WcoHosting::Serverhost.all
26
+ @new_serverhost = WcoHosting::Serverhost.new
27
+ end
28
+
29
+ def new
30
+ authorize! :index, WcoHosting::Serverhost
31
+ @new_serverhost = WcoHosting::Serverhost.new
32
+ end
33
+
14
34
  def update
15
35
  @serverhost = WcoHosting::Serverhost.find params[:id]
16
36
  authorize! :update, @serverhost
@@ -1,6 +1,8 @@
1
1
 
2
2
  .serverhosts-index
3
- %h5 Serverhosts
3
+ %h5
4
+ Serverhosts
5
+ = link_to '[+]', new_serverhost_path
4
6
 
5
7
  %table.bordered
6
8
  %tr
@@ -0,0 +1,2 @@
1
+
2
+ = render 'form', serverhost: @new_serverhost
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.1
4
+ version: 0.0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
@@ -225,6 +225,7 @@ files:
225
225
  - app/views/wco_hosting/serverhosts/_form.haml
226
226
  - app/views/wco_hosting/serverhosts/edit.haml
227
227
  - app/views/wco_hosting/serverhosts/index.haml
228
+ - app/views/wco_hosting/serverhosts/new.haml
228
229
  - config/routes.rb
229
230
  - lib/tasks/wco_hosting_tasks.rake
230
231
  - lib/wco_hosting.rb