Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 8 files changed
  • 0 comments
  • 1 contributor
2  Gemfile
... ... @@ -1,5 +1,7 @@
1 1 source 'https://rubygems.org'
2 2
  3 +gem 'bootstrap-sass'
  4 +
3 5 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4 6 gem 'rails', '4.0.0.rc1'
5 7
3  Gemfile.lock
@@ -27,6 +27,8 @@ GEM
27 27 tzinfo (~> 0.3.37)
28 28 arel (4.0.0)
29 29 atomic (1.1.9)
  30 + bootstrap-sass (2.3.1.3)
  31 + sass (~> 3.2)
30 32 builder (3.1.4)
31 33 coffee-rails (4.0.0)
32 34 coffee-script (>= 2.2.0)
@@ -109,6 +111,7 @@ PLATFORMS
109 111 ruby
110 112
111 113 DEPENDENCIES
  114 + bootstrap-sass
112 115 coffee-rails (~> 4.0.0)
113 116 jbuilder (~> 1.0.1)
114 117 jquery-rails
3  app/assets/stylesheets/bootstrap_and_overrides.css.scss
... ... @@ -0,0 +1,3 @@
  1 +@import "bootstrap";
  2 +body { padding-top: 60px; }
  3 +@import "bootstrap-responsive";
6 app/models/license.rb
@@ -5,10 +5,14 @@ class License < ActiveRecord::Base
5 5
6 6 def remaining
7 7 if capacity > 0
8   - capacity - active_licenses.count
  8 + capacity - used_count
9 9 else
10 10 999
11 11 end
12 12 end
13 13
  14 + def used_count
  15 + active_licenses.count
  16 + end
  17 +
14 18 end
8 app/views/layouts/_messages.html.erb
... ... @@ -0,0 +1,8 @@
  1 +<% flash.each do |name, msg| %>
  2 + <% if msg.is_a?(String) %>
  3 + <div class="alert alert-<%= name == :notice ? "success" : "error" %>">
  4 + <a class="close" data-dismiss="alert">&#215;</a>
  5 + <%= content_tag :div, msg, :id => "flash_#{name}" %>
  6 + </div>
  7 + <% end %>
  8 +<% end %>
10 app/views/layouts/_nav.html.erb
... ... @@ -1 +1,9 @@
1   -<%= link_to "View Licenses", licenses_path %> | <%= link_to "View Assets", machines_path %>
  1 +<ul class='nav'>
  2 +<li><%= link_to "Log Out #{current_user.name}", logout_path %></li>
  3 +<li><%= link_to "View Licenses", licenses_path %></li>
  4 +<li><%= link_to "View Assets", machines_path %></li>
  5 +<% if current_user.admin? %>
  6 + <li><%= link_to "Administer Licenses", licenses_path %></li>
  7 + <li><%= link_to "Administer Assets", machines_path %></li>
  8 + <li><%= link_to "Administer Users", licenses_path %></li>
  9 +<% end %>
53 app/views/layouts/application.html.erb
... ... @@ -1,18 +1,37 @@
1   -<!DOCTYPE html>
  1 +<!doctype html>
2 2 <html>
3   -<head>
4   - <title>Norrington</title>
5   - <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6   - <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7   - <%= csrf_meta_tags %>
8   -</head>
9   -<body>
10   -<% if current_user %>
11   - <h3>Signed in as <%= current_user.name %> | <%= link_to 'Sign out', '/logout', method: :delete %></h3>
12   - <%= render partial: 'layouts/nav' %>
13   - <br><br>
14   -<% end %>
15   -<%= yield %>
16   -
17   -</body>
18   -</html>
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6 + <title><%= content_for?(:title) ? yield(:title) : "Myapp" %></title>
  7 + <meta name="description" content="">
  8 + <meta name="author" content="">
  9 + <%= stylesheet_link_tag "application", :media => "all" %>
  10 + <%= javascript_include_tag "application" %>
  11 + <%= csrf_meta_tags %>
  12 + <%= yield(:head) %>
  13 + </head>
  14 + <body>
  15 + <header class="navbar navbar-fixed-top">
  16 + <nav class="navbar-inner">
  17 + <div class="container">
  18 + <%= render partial: 'layouts/nav' %>
  19 + </div>
  20 + </nav>
  21 + </header>
  22 + <div id="main" role="main">
  23 + <div class="container">
  24 + <div class="content">
  25 + <div class="row">
  26 + <div class="span12">
  27 + <%= render 'layouts/messages' %>
  28 + <%= yield %>
  29 + </div>
  30 + </div>
  31 + <footer>
  32 + </footer>
  33 + </div>
  34 + </div> <!--! end of .container -->
  35 + </div> <!--! end of #main -->
  36 + </body>
  37 +</html>
18 app/views/licenses/index.html.erb
... ... @@ -1 +1,17 @@
1   -<h2>Licenses</h2>
  1 +<h2>Licenses</h2>
  2 +<table>
  3 + <tr>
  4 + <th>Name</th>
  5 + <th>Total</th>
  6 + <th>Used</th>
  7 + <th>Remaining</th>
  8 + </tr>
  9 + <% License.all.each do |license| %>
  10 + <tr>
  11 + <td><%= license.name %></td>
  12 + <td><%= license.capacity %></td>
  13 + <td><%= license.used_count %></td>
  14 + <td><%= license.remaining %></td>
  15 + </tr>
  16 + <% end %>
  17 +</table>

No commit comments for this range

Something went wrong with that request. Please try again.