Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
421539f38c | |||
4c9d46f875 | |||
f3e970ab1b | |||
4d76c0c072 | |||
c8764db47b |
1
Gemfile
1
Gemfile
@ -1,6 +1,7 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'sinatra', '~> 3.0'
|
gem 'sinatra', '~> 3.0'
|
||||||
|
gem 'sinatra-contrib', '~> 3.0'
|
||||||
gem 'puma', '~> 6.0'
|
gem 'puma', '~> 6.0'
|
||||||
|
|
||||||
gem 'sequel', '~> 5.63'
|
gem 'sequel', '~> 5.63'
|
||||||
|
@ -6,6 +6,7 @@ GEM
|
|||||||
listen (3.7.1)
|
listen (3.7.1)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
|
multi_json (1.15.0)
|
||||||
mustermann (3.0.0)
|
mustermann (3.0.0)
|
||||||
ruby2_keywords (~> 0.0.1)
|
ruby2_keywords (~> 0.0.1)
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.8)
|
||||||
@ -26,6 +27,12 @@ GEM
|
|||||||
rack (~> 2.2, >= 2.2.4)
|
rack (~> 2.2, >= 2.2.4)
|
||||||
rack-protection (= 3.0.4)
|
rack-protection (= 3.0.4)
|
||||||
tilt (~> 2.0)
|
tilt (~> 2.0)
|
||||||
|
sinatra-contrib (3.0.4)
|
||||||
|
multi_json
|
||||||
|
mustermann (~> 3.0)
|
||||||
|
rack-protection (= 3.0.4)
|
||||||
|
sinatra (= 3.0.4)
|
||||||
|
tilt (~> 2.0)
|
||||||
sqlite3 (1.5.4-x64-mingw-ucrt)
|
sqlite3 (1.5.4-x64-mingw-ucrt)
|
||||||
sqlite3 (1.5.4-x86_64-linux)
|
sqlite3 (1.5.4-x86_64-linux)
|
||||||
tilt (2.0.11)
|
tilt (2.0.11)
|
||||||
@ -39,6 +46,7 @@ DEPENDENCIES
|
|||||||
rerun
|
rerun
|
||||||
sequel (~> 5.63)
|
sequel (~> 5.63)
|
||||||
sinatra (~> 3.0)
|
sinatra (~> 3.0)
|
||||||
|
sinatra-contrib (~> 3.0)
|
||||||
sqlite3 (~> 1.5)
|
sqlite3 (~> 1.5)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
2
Rakefile
2
Rakefile
@ -1,3 +1,5 @@
|
|||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
require 'sequel'
|
require 'sequel'
|
||||||
require 'sqlite3'
|
require 'sqlite3'
|
||||||
|
|
||||||
|
@ -8,6 +8,13 @@ body{
|
|||||||
padding-left: $nav-width;
|
padding-left: $nav-width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card{
|
||||||
|
padding: 20px 30px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: $box-shadow-2;
|
||||||
|
}
|
||||||
|
|
||||||
#main-nav{
|
#main-nav{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -53,13 +60,31 @@ body{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#main-actions{
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
|
||||||
|
form,
|
||||||
|
input{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#main-wrapper{
|
#main-wrapper{
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
padding: 20px 30px;
|
}
|
||||||
background: white;
|
|
||||||
border-radius: 5px;
|
#main-wrapper.container.fluid{
|
||||||
box-shadow: $box-shadow-2;
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#site-header{
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#item-header,
|
#item-header,
|
||||||
|
@ -10,8 +10,8 @@ Sequel.migration do
|
|||||||
String :type
|
String :type
|
||||||
String :purchased_from
|
String :purchased_from
|
||||||
DateTime :purchased_at
|
DateTime :purchased_at
|
||||||
DateTime :created_at
|
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
DateTime :updated_at
|
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ Sequel.migration do
|
|||||||
create_table(:item_comments) do
|
create_table(:item_comments) do
|
||||||
primary_key :id
|
primary_key :id
|
||||||
String :body, null: false
|
String :body, null: false
|
||||||
DateTime :created_at
|
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
DateTime :updated_at
|
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
end
|
end
|
||||||
|
|
||||||
alter_table(:item_comments) do
|
alter_table(:item_comments) do
|
||||||
|
@ -4,12 +4,12 @@ Sequel.migration do
|
|||||||
create_table(:license_comments) do
|
create_table(:license_comments) do
|
||||||
primary_key :id
|
primary_key :id
|
||||||
String :body, null: false
|
String :body, null: false
|
||||||
DateTime :created_at
|
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
DateTime :updated_at
|
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
|
||||||
end
|
end
|
||||||
|
|
||||||
alter_table(:license_comments) do
|
alter_table(:license_comments) do
|
||||||
add_foreign_key :license_id, :items
|
add_foreign_key :license_id, :licenses
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
164
lib/routes.rb
164
lib/routes.rb
@ -1,163 +1,7 @@
|
|||||||
get '/' do
|
require_relative 'routes/index.rb'
|
||||||
items = Item.reverse(:updated_at).limit(10).all()
|
|
||||||
erb :index, :locals => {
|
|
||||||
:title => 'Dashboard',
|
|
||||||
:items => items
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/item' do
|
require_relative 'routes/item.rb'
|
||||||
redirect '/item/list'
|
|
||||||
end
|
|
||||||
get '/item/list' do
|
|
||||||
items = Item.reverse(:updated_at).all()
|
|
||||||
erb :'item/list', :locals => {
|
|
||||||
:title => 'List of Items',
|
|
||||||
:items => items
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/item/create' do
|
require_relative 'routes/license.rb'
|
||||||
erb :'item/create', :locals => {
|
|
||||||
:title => 'Create New Item'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
post '/item/create' do
|
|
||||||
item = Item.create(
|
|
||||||
name: params[:item_name],
|
|
||||||
serial_number: params[:item_serial],
|
|
||||||
sku_number: params[:item_sku],
|
|
||||||
purchased_from: params[:item_purchase_from],
|
|
||||||
purchased_at: params[:item_purchase_date],
|
|
||||||
manufacturer: params[:item_manufacturer],
|
|
||||||
type: params[:item_type]
|
|
||||||
)
|
|
||||||
|
|
||||||
redirect "/item/#{item.id}"
|
require_relative 'routes/search.rb'
|
||||||
end
|
|
||||||
|
|
||||||
get '/item/:item_id' do
|
|
||||||
item = Item.where(id: params[:item_id]).first()
|
|
||||||
puts "#{item.name}"
|
|
||||||
erb :'item/view', :locals => {
|
|
||||||
:title => item.name,
|
|
||||||
:item => item
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/item/:item_id/edit' do
|
|
||||||
item = Item.where(id: params[:item_id]).first()
|
|
||||||
puts "#{item.name}"
|
|
||||||
erb :'item/edit', :locals => {
|
|
||||||
:title => "Editing: #{item.name}",
|
|
||||||
:item => item
|
|
||||||
}
|
|
||||||
end
|
|
||||||
post '/item/:item_id/edit' do
|
|
||||||
item = Item.where(id: params[:item_id]).first()
|
|
||||||
|
|
||||||
item.name = params[:item_name]
|
|
||||||
item.serial_number = params[:item_serial]
|
|
||||||
item.sku_number = params[:item_sku]
|
|
||||||
item.purchased_from = params[:item_purchase_from]
|
|
||||||
item.purchased_at = params[:item_purchase_date]
|
|
||||||
item.manufacturer = params[:item_manufacturer]
|
|
||||||
item.type = params[:item_type]
|
|
||||||
item.save()
|
|
||||||
|
|
||||||
redirect "/item/#{item.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/item/:item_id/delete' do
|
|
||||||
item = Item.where(id: params[:item_id]).first()
|
|
||||||
item.delete()
|
|
||||||
|
|
||||||
redirect '/item/list'
|
|
||||||
end
|
|
||||||
|
|
||||||
post '/item/:item_id/comment' do
|
|
||||||
item = Item.first(id: params[:item_id])
|
|
||||||
|
|
||||||
comment = ItemComment.create(body: params[:comment_body])
|
|
||||||
item.add_item_comment(comment)
|
|
||||||
|
|
||||||
redirect "/item/#{item.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/license' do
|
|
||||||
redirect '/license/list'
|
|
||||||
end
|
|
||||||
get '/license/list' do
|
|
||||||
licenses = License.reverse(:updated_at).all()
|
|
||||||
erb :'license/list', :locals => {
|
|
||||||
:title => 'List of Licenses',
|
|
||||||
:licenses => licenses
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/license/create' do
|
|
||||||
erb :'license/create', :locals => {
|
|
||||||
:title => 'Create New License'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
post '/license/create' do
|
|
||||||
license = License.create(
|
|
||||||
name: params[:license_name],
|
|
||||||
key: params[:license_key],
|
|
||||||
manufacturer: params[:license_manufacturer],
|
|
||||||
seats_used: params[:license_seats_used],
|
|
||||||
seats_total: params[:license_seats_total],
|
|
||||||
purchased_from: params[:license_purchase_from],
|
|
||||||
purchased_at: params[:license_purchase_date]
|
|
||||||
)
|
|
||||||
|
|
||||||
redirect "/license/#{license.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/license/:license_id' do
|
|
||||||
license = License.where(id: params[:license_id]).first()
|
|
||||||
puts "#{license.name}"
|
|
||||||
erb :'license/view', :locals => {
|
|
||||||
:title => license.name,
|
|
||||||
:license => license
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/license/:license_id/edit' do
|
|
||||||
license = License.where(id: params[:license_id]).first()
|
|
||||||
puts "#{license.name}"
|
|
||||||
erb :'license/edit', :locals => {
|
|
||||||
:title => "Editing: #{license.name}",
|
|
||||||
:license => license
|
|
||||||
}
|
|
||||||
end
|
|
||||||
post '/license/:license_id/edit' do
|
|
||||||
license = License.where(id: params[:license_id]).first()
|
|
||||||
|
|
||||||
license.name = params[:license_name]
|
|
||||||
license.key = params[:license_key]
|
|
||||||
license.manufacturer = params[:license_manufacturer]
|
|
||||||
license.seats_used = params[:license_seats_used]
|
|
||||||
license.seats_total = params[:license_seats_total]
|
|
||||||
license.purchased_from = params[:license_purchase_from]
|
|
||||||
license.purchased_at = params[:license_purchase_date]
|
|
||||||
license.save()
|
|
||||||
|
|
||||||
redirect "/license/#{license.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/license/:license_id/delete' do
|
|
||||||
license = License.where(id: params[:license_id]).first()
|
|
||||||
license.delete()
|
|
||||||
|
|
||||||
redirect '/license/list'
|
|
||||||
end
|
|
||||||
|
|
||||||
post '/license/:license_id/comment' do
|
|
||||||
license = License.first(id: params[:license_id])
|
|
||||||
|
|
||||||
comment = LicenseComment.create(body: params[:comment_body])
|
|
||||||
license.add_license_comment(comment)
|
|
||||||
|
|
||||||
redirect "/license/#{license.id}"
|
|
||||||
end
|
|
||||||
|
14
lib/routes/index.rb
Normal file
14
lib/routes/index.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace '/' do
|
||||||
|
|
||||||
|
get '' do
|
||||||
|
items = Item.reverse(:updated_at).limit(10).all()
|
||||||
|
licenses = License.reverse(:updated_at).limit(10).all()
|
||||||
|
erb :index, :locals => {
|
||||||
|
:title => 'Dashboard',
|
||||||
|
:items => items,
|
||||||
|
:licenses => licenses
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
81
lib/routes/item.rb
Normal file
81
lib/routes/item.rb
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
namespace '/item' do
|
||||||
|
|
||||||
|
get '' do
|
||||||
|
redirect '/item/list'
|
||||||
|
end
|
||||||
|
get '/list' do
|
||||||
|
items = Item.reverse(:updated_at).all()
|
||||||
|
erb :'item/list', :locals => {
|
||||||
|
:title => 'List of Items',
|
||||||
|
:items => items
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/create' do
|
||||||
|
erb :'item/create', :locals => {
|
||||||
|
:title => 'Create New Item'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
post '/create' do
|
||||||
|
item = Item.create(
|
||||||
|
name: params[:item_name],
|
||||||
|
serial_number: params[:item_serial],
|
||||||
|
sku_number: params[:item_sku],
|
||||||
|
purchased_from: params[:item_purchase_from],
|
||||||
|
purchased_at: params[:item_purchase_date],
|
||||||
|
manufacturer: params[:item_manufacturer],
|
||||||
|
type: params[:item_type]
|
||||||
|
)
|
||||||
|
|
||||||
|
redirect "/item/#{item.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:item_id' do
|
||||||
|
item = Item.where(id: params[:item_id]).first()
|
||||||
|
puts "#{item.name}"
|
||||||
|
erb :'item/view', :locals => {
|
||||||
|
:title => item.name,
|
||||||
|
:item => item
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:item_id/edit' do
|
||||||
|
item = Item.where(id: params[:item_id]).first()
|
||||||
|
puts "#{item.name}"
|
||||||
|
erb :'item/edit', :locals => {
|
||||||
|
:title => "Editing: #{item.name}",
|
||||||
|
:item => item
|
||||||
|
}
|
||||||
|
end
|
||||||
|
post '/:item_id/edit' do
|
||||||
|
item = Item.where(id: params[:item_id]).first()
|
||||||
|
|
||||||
|
item.name = params[:item_name]
|
||||||
|
item.serial_number = params[:item_serial]
|
||||||
|
item.sku_number = params[:item_sku]
|
||||||
|
item.purchased_from = params[:item_purchase_from]
|
||||||
|
item.purchased_at = params[:item_purchase_date]
|
||||||
|
item.manufacturer = params[:item_manufacturer]
|
||||||
|
item.type = params[:item_type]
|
||||||
|
item.save()
|
||||||
|
|
||||||
|
redirect "/item/#{item.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:item_id/delete' do
|
||||||
|
item = Item.where(id: params[:item_id]).first()
|
||||||
|
item.delete()
|
||||||
|
|
||||||
|
redirect '/item/list'
|
||||||
|
end
|
||||||
|
|
||||||
|
post '/:item_id/comment' do
|
||||||
|
item = Item.first(id: params[:item_id])
|
||||||
|
|
||||||
|
comment = ItemComment.create(body: params[:comment_body])
|
||||||
|
item.add_item_comment(comment)
|
||||||
|
|
||||||
|
redirect "/item/#{item.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
81
lib/routes/license.rb
Normal file
81
lib/routes/license.rb
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
namespace '/license' do
|
||||||
|
|
||||||
|
get '' do
|
||||||
|
redirect '/license/list'
|
||||||
|
end
|
||||||
|
get '/list' do
|
||||||
|
licenses = License.reverse(:updated_at).all()
|
||||||
|
erb :'license/list', :locals => {
|
||||||
|
:title => 'List of Licenses',
|
||||||
|
:licenses => licenses
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/create' do
|
||||||
|
erb :'license/create', :locals => {
|
||||||
|
:title => 'Create New License'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
post '/create' do
|
||||||
|
license = License.create(
|
||||||
|
name: params[:license_name],
|
||||||
|
key: params[:license_key],
|
||||||
|
manufacturer: params[:license_manufacturer],
|
||||||
|
seats_used: params[:license_seats_used],
|
||||||
|
seats_total: params[:license_seats_total],
|
||||||
|
purchased_from: params[:license_purchase_from],
|
||||||
|
purchased_at: params[:license_purchase_date]
|
||||||
|
)
|
||||||
|
|
||||||
|
redirect "/license/#{license.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:license_id' do
|
||||||
|
license = License.where(id: params[:license_id]).first()
|
||||||
|
puts "#{license.name}"
|
||||||
|
erb :'license/view', :locals => {
|
||||||
|
:title => license.name,
|
||||||
|
:license => license
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:license_id/edit' do
|
||||||
|
license = License.where(id: params[:license_id]).first()
|
||||||
|
puts "#{license.name}"
|
||||||
|
erb :'license/edit', :locals => {
|
||||||
|
:title => "Editing: #{license.name}",
|
||||||
|
:license => license
|
||||||
|
}
|
||||||
|
end
|
||||||
|
post '/:license_id/edit' do
|
||||||
|
license = License.where(id: params[:license_id]).first()
|
||||||
|
|
||||||
|
license.name = params[:license_name]
|
||||||
|
license.key = params[:license_key]
|
||||||
|
license.manufacturer = params[:license_manufacturer]
|
||||||
|
license.seats_used = params[:license_seats_used]
|
||||||
|
license.seats_total = params[:license_seats_total]
|
||||||
|
license.purchased_from = params[:license_purchase_from]
|
||||||
|
license.purchased_at = params[:license_purchase_date]
|
||||||
|
license.save()
|
||||||
|
|
||||||
|
redirect "/license/#{license.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:license_id/delete' do
|
||||||
|
license = License.where(id: params[:license_id]).first()
|
||||||
|
license.delete()
|
||||||
|
|
||||||
|
redirect '/license/list'
|
||||||
|
end
|
||||||
|
|
||||||
|
post '/:license_id/comment' do
|
||||||
|
license = License.first(id: params[:license_id])
|
||||||
|
|
||||||
|
comment = LicenseComment.create(body: params[:comment_body])
|
||||||
|
license.add_license_comment(comment)
|
||||||
|
|
||||||
|
redirect "/license/#{license.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
14
lib/routes/search.rb
Normal file
14
lib/routes/search.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace '/search' do
|
||||||
|
get '' do
|
||||||
|
search_parameter = params[:query]
|
||||||
|
items = Item.where(Sequel.ilike(:name, "%#{search_parameter}%")).all()
|
||||||
|
licenses = License.where(Sequel.ilike(:name, "%#{search_parameter}%")).all()
|
||||||
|
|
||||||
|
erb :'search/list', :locals => {
|
||||||
|
:title => 'Search Results',
|
||||||
|
:items => items,
|
||||||
|
:licenses => licenses,
|
||||||
|
:query => search_parameter
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
1
raven.rb
1
raven.rb
@ -2,6 +2,7 @@ require 'logger'
|
|||||||
require 'sequel'
|
require 'sequel'
|
||||||
require 'sqlite3'
|
require 'sqlite3'
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
|
require 'sinatra/namespace'
|
||||||
|
|
||||||
require_relative 'lib/config.rb'
|
require_relative 'lib/config.rb'
|
||||||
|
|
||||||
|
@ -1,11 +1,57 @@
|
|||||||
<p>This is a test.</p>
|
<div class="row">
|
||||||
|
<div class="twelve columns">
|
||||||
|
<h1 id="site-header">Welcome to Raven</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% if items.length > 0 %>
|
<hr>
|
||||||
<ul>
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="six columns">
|
||||||
|
<h3>Recent inventory updates</h3>
|
||||||
|
<% if items.length > 0 %>
|
||||||
|
<table class="u-full-width">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Item name</th>
|
||||||
|
<th>Updated at</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<% items.each do |item| %>
|
<% items.each do |item| %>
|
||||||
<li><%= item.name %></li>
|
<tr>
|
||||||
|
<td><%= item.name %></td>
|
||||||
|
<td><%= date_format(item.updated_at) %></td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</tbody>
|
||||||
<% else %>
|
</table>
|
||||||
|
<% else %>
|
||||||
<p>There are no items to display.</p>
|
<p>There are no items to display.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="six columns">
|
||||||
|
<h3>Recent license updates</h3>
|
||||||
|
<% if licenses.length > 0 %>
|
||||||
|
<table class="u-full-width">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>License name</th>
|
||||||
|
<th>Updated at</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% licenses.each do |license| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= license.name %></td>
|
||||||
|
<td><%= date_format(license.updated_at) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<p>There are no licenses to display.</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@ -11,16 +11,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Main navigation -->
|
<!-- Main navigation -->
|
||||||
<nav id="main-nav">
|
<%= erb :'layout/navbar', :locals => locals %>
|
||||||
<h3>Raven</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="/">Dashboard</a></li>
|
|
||||||
<li><a href="/item/list">Items</a></li>
|
|
||||||
<li><a href="/license/list">Licenses</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div id="main-wrapper" class="container">
|
<!-- Inventory search/actions bar -->
|
||||||
|
<%= erb :'layout/actions', :locals => locals %>
|
||||||
|
|
||||||
|
<div id="main-wrapper" class="container fluid card">
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
9
views/layout/actions.erb
Normal file
9
views/layout/actions.erb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<div id="main-actions" class="container fluid card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="six columns">
|
||||||
|
<form action="/search" class="u-full-width">
|
||||||
|
<input id="search-field" class="u-full-width" type="text" placeholder="Search your inventory..." name="query" required <%= defined?(query) ? 'value="' + query + '"' : '' %>>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
8
views/layout/navbar.erb
Normal file
8
views/layout/navbar.erb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<nav id="main-nav">
|
||||||
|
<h3>Raven</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/">Dashboard</a></li>
|
||||||
|
<li><a href="/item/list">Items</a></li>
|
||||||
|
<li><a href="/license/list">Licenses</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
25
views/search/list.erb
Normal file
25
views/search/list.erb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="twelve columns">
|
||||||
|
<h4>Matching hardware:</h4>
|
||||||
|
<% if items.length > 0 %>
|
||||||
|
<ul class="u-full-width">
|
||||||
|
<% items.each do |r| %>
|
||||||
|
<li><a href="/item/<%= r.id %>"><%= r.name %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<p>Sorry, nothing in your hardware inventory matches that search term.</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h4>Matching licenses:</h4>
|
||||||
|
<% if licenses.length > 0 %>
|
||||||
|
<ul class="u-full-width">
|
||||||
|
<% licenses.each do |r| %>
|
||||||
|
<li><a href="/item/<%= r.id %>"><%= r.name %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<p>Sorry, nothing in your license inventory matches that search term.</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
Reference in New Issue
Block a user