wco_hosting 0.0.0.2 → 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: beb77daf73609eecd8757c3f1f8a19b2ba71e03820d5bb1dbafb065f3d4ad839
4
- data.tar.gz: da6e5c4106e559345df1926ba8a3158136eb8c0f7126dfb14fb8ee27675f5006
3
+ metadata.gz: db8fa49242cace48684ab299e74aeeb62945ac04961c300f0ca642c10f7015a7
4
+ data.tar.gz: 861d0db26431887c700c759befc3c398061e076a00cffd24138f0694dc217e33
5
5
  SHA512:
6
- metadata.gz: 2b8b1d37e70e5a7f9b520945303ba96abe02a5a97ad0afef2b1ed8c1713f473b49099300fc2f87572ad41f242bc809c152406eafbf952ed44c69aa8fa327e35f
7
- data.tar.gz: 1bf76b9cd431ad9a37789b60d95796c12665d487652e250a36ebe64f1d8b5b999fa1213d25e23a1f7fa0918a27d1ade48677482f0667a06d4be136271002ef00
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.2
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