Permalink
Browse files

add location to views

  • Loading branch information...
1 parent eb43e3b commit e1ee57276bbd25279c5ffe0831c3cd548225f538 @ralph ralph committed Mar 13, 2012
Showing with 11 additions and 0 deletions.
  1. +4 −0 app/views/items/_form.html.erb
  2. +2 −0 app/views/items/index.html.erb
  3. +5 −0 app/views/items/show.html.erb
View
4 app/views/items/_form.html.erb
@@ -23,6 +23,10 @@
<%= f.label :borrower %><br />
<%= f.text_field :borrower %>
</div>
+ <div class="field">
+ <%= f.label :location_id %><br />
+ <%= f.select :location_id, Location.all.map {|l| [l.name, l.id] } %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
View
2 app/views/items/index.html.erb
@@ -5,6 +5,7 @@
<th>Name</th>
<th>Description</th>
<th>Borrower</th>
+ <th>Location</th>
<th></th>
<th></th>
<th></th>
@@ -15,6 +16,7 @@
<td><%= item.name %></td>
<td><%= item.description %></td>
<td><%= item.borrower %></td>
+ <td><%= item.location.name %></td>
<td><%= link_to 'Show', item %></td>
<td><%= link_to 'Edit', edit_item_path(item) %></td>
<td><%= link_to 'Destroy', item, confirm: 'Are you sure?', method: :delete %></td>
View
5 app/views/items/show.html.erb
@@ -15,6 +15,11 @@
<%= @item.borrower %>
</p>
+<p>
+ <b>Location:</b>
+ <%= @item.location.name %>
+</p>
+
<%= link_to 'Edit', edit_item_path(@item) %> |
<%= link_to 'Back', items_path %>

0 comments on commit e1ee572

Please sign in to comment.