class MerchandiseController < ApplicationController
+ layout "admin"
# Make sure that a user logs in before doing any action here
before_filter :authorize
def index
- list
- render :action => 'list'
+ render :action => 'index'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
<br/>
<p><%= link_to "Video Maintenence", :controller => 'video', :action => 'index' %></p>
<p><%= link_to "Game Maintenence", :controller => 'game', :action => 'index' %></p>
+ <p><%= link_to "Merchandise Maintenence", :controller => 'merchandise', :action => 'index' %></p>
<p><%= link_to "Checked Out Items", :controller => 'coitem', :action => 'index' %></p>
<p><%= link_to "Customer Maintenence", :controller => 'customer', :action => 'index' %></p>
<p><%= link_to "Financial Information", :controller => 'purchase', :action => 'index' %></p>
--- /dev/null
+<h1>Merchandise Maintenence</h1>
+
+<h3>Actions</h3>
+<ul>
+ <li><%= link_to 'List All Merchandise', :action => 'list' %></li>
+ <li><%= link_to 'Add a New Merchandise Item', :action => 'new' %></li>
+</ul>
<h1>Listing merchandises</h1>
-<table>
+<table border="1">
<tr>
- <th>Merchandise ID</th>
- <% for column in Merchandise.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
+ <th>Merchandise ID</th>
+ <th>Title</th>
+ <th>Quantity Remaining</th>
+ <th>Price Per Unit</th>
</tr>
<% for merchandise in @merchandises %>
<tr>
- <td><%=h merchandise.id %></td>
- <% for column in Merchandise.content_columns %>
- <td><%=h merchandise.send(column.name) %></td>
- <% end %>
- <td><%= link_to 'Show', :action => 'show', :id => merchandise %></td>
+ <td><%=h merchandise.id %></td>
+ <td><%=link_to merchandise.title.to_s, :action => 'show', :id => merchandise %></td>
+ <td><%=h merchandise.quantity %></td>
+ <td><%=h number_to_currency(merchandise.price) %></td>
<td><%= link_to 'Edit', :action => 'edit', :id => merchandise %></td>
- <td><%= link_to 'Destroy', { :action => 'destroy', :id => merchandise }, :confirm => 'Are you sure?', :method => :post %></td>
+ <td><%= link_to 'Remove', { :action => 'destroy', :id => merchandise }, :confirm => 'Are you sure?', :method => :post %></td>
</tr>
<% end %>
</table>
-<% for column in Merchandise.content_columns %>
-<p>
- <b><%= column.human_name %>:</b> <%=h @merchandise.send(column.name) %>
-</p>
-<% end %>
+<p><b>Merchandise ID: </b><%=h @merchandise.id.to_s %></p>
+<p><b>Title: </b><%=h @merchandise.title %></p>
+<p><b>Quantity Remaining: </b><%=h @merchandise.quantity %></p>
+<p><b>Price Per Unit: </b><%=h number_to_currency(@merchandise.price) %></p>
<%= link_to 'Edit', :action => 'edit', :id => @merchandise %> |
<%= link_to 'Back', :action => 'list' %>