server list looks like something

This commit is contained in:
Senad Uka
2016-02-20 12:36:50 +01:00
parent 3b213c855a
commit 91b72481da
25 changed files with 258 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -14,3 +14,5 @@
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require active_scaffold
//= require bootstrap-sprockets

View File

@@ -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;
}

View File

@@ -0,0 +1,4 @@
class OperatingSystemsController < ApplicationController
active_scaffold :operating_system do |conf|
end
end

View 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

View File

@@ -0,0 +1,2 @@
module OperatingSystemsHelper
end

View File

@@ -0,0 +1,2 @@
module ServersHelper
end

View File

@@ -0,0 +1,3 @@
class OperatingSystem < ActiveRecord::Base
has_many :servers
end

8
web/app/models/server.rb Normal file
View 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

View File

@@ -7,8 +7,11 @@
<%= csrf_meta_tags %>
</head>
<body>
<h1 id="logo">
CHUB
</h1>
<div class="container-fluid">
<%= yield %>
</div>
</body>
</html>

View 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>