Many visual tweaks, suggested by Lan
authorIra W. Snyder <devel@irasnyder.com>
Mon, 26 Nov 2007 07:53:21 +0000 (23:53 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Mon, 26 Nov 2007 07:53:21 +0000 (23:53 -0800)
Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
13 files changed:
app/controllers/coitem_controller.rb
app/models/game.rb
app/models/gamegenre.rb
app/models/gameplatform.rb
app/views/coitem/list.rhtml
app/views/coitem/overdue.rhtml
app/views/customer/list.rhtml
app/views/game/show.rhtml
app/views/game_policy/list.rhtml
app/views/purchase/list.rhtml
app/views/video/show.rhtml
app/views/video_policy/list.rhtml
db/development.sqlite3

index ef8ea7c..152f40b 100644 (file)
@@ -47,6 +47,12 @@ class CoitemController < ApplicationController
     render :action => 'overdue'
   end
 
+  def filterbycustomerid
+    query = params[:id]
+    @coitem_pages, @coitems = paginate :coitems, :per_page => 20, :conditions => ["customer_id = ?", query]
+    render :action => 'list'
+  end
+
   def return
     if request.post?
       rentable_id = params[:rentable_id]
index ed7f30b..f2e627c 100644 (file)
@@ -1,4 +1,7 @@
 class Game < Rentable
+  has_many :game_genres, :through => Gamegenre
+  has_many :gameplatforms, :through => Gameplatform
+
   validates_presence_of :game_genre
   validates_presence_of :platform
 
@@ -32,4 +35,12 @@ class Game < Rentable
     return Time.now.advance(:days => period).to_date
   end
 
+  def genre_name
+    Gamegenre.find_by_id(game_genre).name
+  end
+
+  def platform_name
+    Gameplatform.find_by_id(platform).name
+  end
+
 end
index 5a6631a..37c1eff 100644 (file)
@@ -1,2 +1,3 @@
 class Gamegenre < ActiveRecord::Base
+  belongs_to :game
 end
index 340470f..c14fcf7 100644 (file)
@@ -1,2 +1,3 @@
 class Gameplatform < ActiveRecord::Base
+  belongs_to :game
 end
index 2b0db69..92113ad 100644 (file)
@@ -2,7 +2,9 @@
 
 <table border="1">
   <tr>
+    <th>Item ID</th>
     <th>Customer</th>
+    <th>Type</th>
     <th>Rentable</th>
     <th>Overdue</th>
     <th>Date Checked Out</th>
   
 <% for coitem in @coitems %>
   <tr>
+    <td><%=h coitem.rentable.id.to_s %></td>
     <td><%=h coitem.customer.name %></td>
-    <td><%=h coitem.rentable.title %></td>
+    <td><%=h coitem.rentable.class %></td>
+    <% if coitem.rentable.type == Game %>
+    <td><%=link_to coitem.rentable.title.to_s, :controller => 'game', :action => 'show', :id => coitem.rentable %></td>
+    <% else %>
+    <td><%=link_to coitem.rentable.title.to_s, :controller => 'video', :action => 'show', :id => coitem.rentable %></td>
+    <% end %>
     <td><%=h tf_to_yesno(coitem.overdue?) %></td>
     <td><%=h coitem.out_date %></td>
     <td><%=h coitem.due_date %></td>
-    <td><%= link_to 'View', :action => 'show', :id => coitem %></td>
   </tr>
 <% end %>
 </table>
index d6f525e..ab44d10 100644 (file)
@@ -2,6 +2,7 @@
 
 <table border="1">
   <tr>
+    <th>Item ID</th>
     <th>Customer</th>
     <th>Customer Phone #</th>
     <th>Customer Email</th>
@@ -14,6 +15,7 @@
   
 <% for coitem in @coitems %>
   <tr>
+    <td><%=h coitem.rentable.id.to_s %></td>
     <td><%=link_to coitem.customer.name, :controller => 'customer', :action => 'show', :id => coitem.customer.id %></td>
     <td><%=h coitem.customer.phone %></td>
     <td><%=h coitem.customer.email %></td>
index c9bce2b..2f4bd9c 100644 (file)
@@ -2,19 +2,19 @@
 
 <table border="1">
   <tr>
-  <th>Customer ID</th>
-  <% for column in Customer.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
+    <th>Customer ID</th>
+    <th>Name</th>
+    <th>Phone</th>
+    <th>Debt</th>
   </tr>
   
 <% for customer in @customers %>
   <tr>
-  <td><%=h customer.id %></td>
-  <% for column in Customer.content_columns %>
-    <td><%=h customer.send(column.name) %></td>
-  <% end %>
-    <td><%= link_to 'View', :action => 'show', :id => customer %></td>
+    <td><%=h customer.id %></td>
+    <td><%=link_to customer.name.to_s, :action => 'show', :id => customer %></td>
+    <td><%=h customer.phone %></td>
+    <td><%=h number_to_currency(customer.debt) %></td>
+    <td><%= link_to "Checked Out Items", :controller => :coitem, :action => 'filterbycustomerid', :id => customer %></td>
     <td><%= link_to 'Edit', :action => 'edit', :id => customer %></td>
     <td><%= link_to 'Remove', { :action => 'destroy', :id => customer }, :confirm => 'Are you sure?', :method => :post %></td>
   </tr>
index b3c282f..e31791b 100644 (file)
@@ -1,8 +1,9 @@
-<% for column in Game.content_columns %>
-<p>
-  <b><%= column.human_name %>:</b> <%=h @game.send(column.name) %>
-</p>
-<% end %>
+<p><b>Game ID:</b> <%=h @game.id.to_s %></p>
+<p><b>Title:</b> <%=h @game.title %></p>
+<p><b>New Release:</b> <%=h tf_to_yesno(@game.newrelease) %></p>
+<p><b>Genre:</b> <%=h @game.genre_name %></p>
+<p><b>Platform:</b> <%=h @game.platform_name %></p>
+
 
 <%= link_to 'Edit', :action => 'edit', :id => @game %> |
 <%= link_to 'Back', :action => 'list' %>
index 03b7b37..327c35d 100644 (file)
@@ -1,17 +1,17 @@
-<h1>Game Rental Policies</h1>
+<h1>Game Rental Pricing and Policies</h1>
 
 <table border="1">
   <tr>
-  <% for column in GamePolicy.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
+    <th>Description</th>
+    <th>Fee</th>
+    <th>Period</th>
   </tr>
   
 <% for game_policy in @game_policies %>
   <tr>
-  <% for column in GamePolicy.content_columns %>
-    <td><%=h game_policy.send(column.name) %></td>
-  <% end %>
+    <td><%=h game_policy.description %></td>
+    <td><%=h number_to_currency(game_policy.fee) %></td>
+    <td><%=h game_policy.period %> Days</td>
     <td><%= link_to 'View', :action => 'show', :id => game_policy %></td>
     <td><%= link_to 'Edit', :action => 'edit', :id => game_policy %></td>
   </tr>
@@ -21,6 +21,3 @@
 <%= link_to 'Previous page', { :page => @game_policy_pages.current.previous } if @game_policy_pages.current.previous %>
 <%= link_to 'Next page', { :page => @game_policy_pages.current.next } if @game_policy_pages.current.next %> 
 
-<br />
-
-<%= link_to 'New game_policy', :action => 'new' %>
index 4c6e1ec..b702f7f 100644 (file)
@@ -14,7 +14,7 @@
   <tr>
     <td><%=link_to purchase.date, :action => 'filterbydate', :id => purchase.date %></td>
     <td><%=h purchase.quantity %></td>
-    <td><%=link_to purchase.type, :action => 'filterbytype', :id => purchase.type %></td>
+    <td><%=link_to purchase.class, :action => 'filterbytype', :id => purchase.type %></td>
     <td><%=h purchase.title %></td>
     <td><%=h purchase.price %></td>
     <td><%=link_to purchase.customer.name, :action => 'filterbycust', :id => purchase.customer_id %></td>
index d7d089d..631ec4b 100644 (file)
@@ -1,8 +1,9 @@
-<% for column in Video.content_columns %>
-<p>
-  <b><%= column.human_name %>:</b> <%=h @video.send(column.name) %>
-</p>
-<% end %>
+<p><b>Video ID:</b> <%=h @video.id.to_s %></p>
+<p><b>Title:</b> <%=h @video.title %></p>
+<p><b>New Release:</b> <%=h tf_to_yesno(@video.newrelease) %></p>
+<p><b>Genre:</b> <%=h @video.genre %></p>
+<p><b>Director:</b> <%=h @video.director %></p>
+<p><b>Media:</b> <%=h @video.media_name %></p>
 
 <%= link_to 'Edit', :action => 'edit', :id => @video %> |
 <%= link_to 'Back', :action => 'list' %>
index 0573275..3a04b33 100644 (file)
@@ -1,17 +1,17 @@
-<h1>Video Rental Policies</h1>
+<h1>Video Rental Pricing and Policies</h1>
 
 <table border="1">
   <tr>
-  <% for column in VideoPolicy.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
+    <th>Description</th>
+    <th>Fee</th>
+    <th>Period</th>
   </tr>
   
 <% for video_policy in @video_policies %>
   <tr>
-  <% for column in VideoPolicy.content_columns %>
-    <td><%=h video_policy.send(column.name) %></td>
-  <% end %>
+    <td><%=h video_policy.description %></td>
+    <td><%=h number_to_currency(video_policy.fee) %></td>
+    <td><%=h video_policy.period %>Days</td>
     <td><%= link_to 'View', :action => 'show', :id => video_policy %></td>
     <td><%= link_to 'Edit', :action => 'edit', :id => video_policy %></td>
   </tr>
@@ -21,6 +21,3 @@
 <%= link_to 'Previous page', { :page => @video_policy_pages.current.previous } if @video_policy_pages.current.previous %>
 <%= link_to 'Next page', { :page => @video_policy_pages.current.next } if @video_policy_pages.current.next %> 
 
-<br />
-
-<%= link_to 'New video_policy', :action => 'new' %>
index 86d8540..f826509 100644 (file)
Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ