Added an inventory search page
This commit is contained in:
@ -11,10 +11,10 @@
|
||||
</head>
|
||||
<body>
|
||||
<!-- Main navigation -->
|
||||
<%= erb :'layout/navbar' %>
|
||||
<%= erb :'layout/navbar', :locals => locals %>
|
||||
|
||||
<!-- Inventory search/actions bar -->
|
||||
<%= erb :'layout/actions' %>
|
||||
<%= erb :'layout/actions', :locals => locals %>
|
||||
|
||||
<div id="main-wrapper" class="container fluid card">
|
||||
<%= yield %>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<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="Search field">
|
||||
<input id="search-field" class="u-full-width" type="text" placeholder="Search your inventory..." name="query" required <%= defined?(query) ? 'value="' + query + '"' : '' %>>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
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