From d2081caee4ce19c6d9638fdb18d77a3c3b80e587 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Mon, 26 Nov 2007 14:36:07 -0800 Subject: [PATCH] Prettify and add the Merchandise pages Signed-off-by: Ira W. Snyder --- app/controllers/merchandise_controller.rb | 4 ++-- app/views/layouts/admin.rhtml | 1 + app/views/merchandise/index.rhtml | 7 +++++++ app/views/merchandise/list.rhtml | 21 ++++++++++----------- app/views/merchandise/show.rhtml | 9 ++++----- db/development.sqlite3 | Bin 30720 -> 30720 bytes 6 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 app/views/merchandise/index.rhtml diff --git a/app/controllers/merchandise_controller.rb b/app/controllers/merchandise_controller.rb index fb7beff..79a85dd 100644 --- a/app/controllers/merchandise_controller.rb +++ b/app/controllers/merchandise_controller.rb @@ -1,11 +1,11 @@ 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) diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index 420c1ad..7a3e403 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -18,6 +18,7 @@

<%= link_to "Video Maintenence", :controller => 'video', :action => 'index' %>

<%= link_to "Game Maintenence", :controller => 'game', :action => 'index' %>

+

<%= link_to "Merchandise Maintenence", :controller => 'merchandise', :action => 'index' %>

<%= link_to "Checked Out Items", :controller => 'coitem', :action => 'index' %>

<%= link_to "Customer Maintenence", :controller => 'customer', :action => 'index' %>

<%= link_to "Financial Information", :controller => 'purchase', :action => 'index' %>

diff --git a/app/views/merchandise/index.rhtml b/app/views/merchandise/index.rhtml new file mode 100644 index 0000000..ec31215 --- /dev/null +++ b/app/views/merchandise/index.rhtml @@ -0,0 +1,7 @@ +

Merchandise Maintenence

+ +

Actions

+ diff --git a/app/views/merchandise/list.rhtml b/app/views/merchandise/list.rhtml index a328f09..91e8f5e 100644 --- a/app/views/merchandise/list.rhtml +++ b/app/views/merchandise/list.rhtml @@ -1,22 +1,21 @@

Listing merchandises

- +
- - <% for column in Merchandise.content_columns %> - - <% end %> + + + + <% for merchandise in @merchandises %> - - <% for column in Merchandise.content_columns %> - - <% end %> - + + + + - + <% end %>
Merchandise ID<%= column.human_name %>Merchandise IDTitleQuantity RemainingPrice Per Unit
<%=h merchandise.id %><%=h merchandise.send(column.name) %><%= link_to 'Show', :action => 'show', :id => merchandise %><%=h merchandise.id %><%=link_to merchandise.title.to_s, :action => 'show', :id => merchandise %><%=h merchandise.quantity %><%=h number_to_currency(merchandise.price) %> <%= link_to 'Edit', :action => 'edit', :id => merchandise %><%= link_to 'Destroy', { :action => 'destroy', :id => merchandise }, :confirm => 'Are you sure?', :method => :post %><%= link_to 'Remove', { :action => 'destroy', :id => merchandise }, :confirm => 'Are you sure?', :method => :post %>
diff --git a/app/views/merchandise/show.rhtml b/app/views/merchandise/show.rhtml index 9c90624..2180bfe 100644 --- a/app/views/merchandise/show.rhtml +++ b/app/views/merchandise/show.rhtml @@ -1,8 +1,7 @@ -<% for column in Merchandise.content_columns %> -

- <%= column.human_name %>: <%=h @merchandise.send(column.name) %> -

-<% end %> +

Merchandise ID: <%=h @merchandise.id.to_s %>

+

Title: <%=h @merchandise.title %>

+

Quantity Remaining: <%=h @merchandise.quantity %>

+

Price Per Unit: <%=h number_to_currency(@merchandise.price) %>

<%= link_to 'Edit', :action => 'edit', :id => @merchandise %> | <%= link_to 'Back', :action => 'list' %> diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 7f6ff454e8646b66b28565c6be54658a5331f39e..ce9e0e6ba6ab398ead666460386dd03fa7329e73 100644 GIT binary patch delta 21 dcmZqpz}WDCae_4Ct&K8U)fu@qUsBf#003hO2uA<_ delta 21 dcmZqpz}WDCae_4C&5bf!)fpK!UsBf#003gb2s{7) -- 2.25.1