server list looks like something
This commit is contained in:
BIN
web/app/assets/images/chub.png
Normal file
BIN
web/app/assets/images/chub.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
web/app/assets/images/ubuntu.png
Normal file
BIN
web/app/assets/images/ubuntu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -14,3 +14,5 @@
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require_tree .
|
||||
//= require active_scaffold
|
||||
//= require bootstrap-sprockets
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
@@ -10,6 +11,15 @@
|
||||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||
* file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*= require active_scaffold
|
||||
*/
|
||||
@import "bootstrap";
|
||||
|
||||
#logo {
|
||||
margin: 20px;
|
||||
color: green;
|
||||
}
|
||||
|
||||
.server-thumbnail {
|
||||
margin: 15px;
|
||||
}
|
||||
4
web/app/controllers/operating_systems_controller.rb
Normal file
4
web/app/controllers/operating_systems_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class OperatingSystemsController < ApplicationController
|
||||
active_scaffold :operating_system do |conf|
|
||||
end
|
||||
end
|
||||
6
web/app/controllers/servers_controller.rb
Normal file
6
web/app/controllers/servers_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class ServersController < ApplicationController
|
||||
active_scaffold :server do |conf|
|
||||
conf.columns = [:name, :operating_system]
|
||||
conf.columns[:operating_system].form_ui = :select
|
||||
end
|
||||
end
|
||||
2
web/app/helpers/operating_systems_helper.rb
Normal file
2
web/app/helpers/operating_systems_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module OperatingSystemsHelper
|
||||
end
|
||||
2
web/app/helpers/servers_helper.rb
Normal file
2
web/app/helpers/servers_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ServersHelper
|
||||
end
|
||||
3
web/app/models/operating_system.rb
Normal file
3
web/app/models/operating_system.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class OperatingSystem < ActiveRecord::Base
|
||||
has_many :servers
|
||||
end
|
||||
8
web/app/models/server.rb
Normal file
8
web/app/models/server.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Server < ActiveRecord::Base
|
||||
belongs_to :operating_system
|
||||
before_create :generate_hash
|
||||
|
||||
def generate_hash
|
||||
self.namehash = SecureRandom.hex
|
||||
end
|
||||
end
|
||||
@@ -7,8 +7,11 @@
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="logo">
|
||||
CHUB
|
||||
</h1>
|
||||
<div class="container-fluid">
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
23
web/app/views/servers/list.html.erb
Normal file
23
web/app/views/servers/list.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="row">
|
||||
<div class="col-md-11">
|
||||
<h2>Servers</h2>
|
||||
</div>
|
||||
<div class="col-md-1 text-right">
|
||||
<%= link_to(new_server_path) do %>
|
||||
<button class="btn btn-default pull-right">Add Server</button>
|
||||
<% end %>
|
||||
</dev>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<% @page.items.each do |server| %>
|
||||
<div class="col-md-2 col-xs-6 text-md-center server-thumbnail">
|
||||
<div class="thumbnail">
|
||||
<%= image_tag('ubuntu.png', size: '128', class:"img-responsive" ) %>
|
||||
<div class="caption text-md-center" >
|
||||
<h3><%= server.name %></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user