From e4597521e3a7365f86731f7d69643cb1067acb5e Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Sun, 25 Nov 2007 23:53:21 -0800 Subject: [PATCH] Many visual tweaks, suggested by Lan Signed-off-by: Ira W. Snyder --- app/controllers/coitem_controller.rb | 6 ++++++ app/models/game.rb | 11 +++++++++++ app/models/gamegenre.rb | 1 + app/models/gameplatform.rb | 1 + app/views/coitem/list.rhtml | 11 +++++++++-- app/views/coitem/overdue.rhtml | 2 ++ app/views/customer/list.rhtml | 18 +++++++++--------- app/views/game/show.rhtml | 11 ++++++----- app/views/game_policy/list.rhtml | 17 +++++++---------- app/views/purchase/list.rhtml | 2 +- app/views/video/show.rhtml | 11 ++++++----- app/views/video_policy/list.rhtml | 17 +++++++---------- db/development.sqlite3 | Bin 25600 -> 25600 bytes 13 files changed, 66 insertions(+), 42 deletions(-) diff --git a/app/controllers/coitem_controller.rb b/app/controllers/coitem_controller.rb index ef8ea7c..152f40b 100644 --- a/app/controllers/coitem_controller.rb +++ b/app/controllers/coitem_controller.rb @@ -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] diff --git a/app/models/game.rb b/app/models/game.rb index ed7f30b..f2e627c 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -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 diff --git a/app/models/gamegenre.rb b/app/models/gamegenre.rb index 5a6631a..37c1eff 100644 --- a/app/models/gamegenre.rb +++ b/app/models/gamegenre.rb @@ -1,2 +1,3 @@ class Gamegenre < ActiveRecord::Base + belongs_to :game end diff --git a/app/models/gameplatform.rb b/app/models/gameplatform.rb index 340470f..c14fcf7 100644 --- a/app/models/gameplatform.rb +++ b/app/models/gameplatform.rb @@ -1,2 +1,3 @@ class Gameplatform < ActiveRecord::Base + belongs_to :game end diff --git a/app/views/coitem/list.rhtml b/app/views/coitem/list.rhtml index 2b0db69..92113ad 100644 --- a/app/views/coitem/list.rhtml +++ b/app/views/coitem/list.rhtml @@ -2,7 +2,9 @@ + + @@ -11,12 +13,17 @@ <% for coitem in @coitems %> + - + + <% if coitem.rentable.type == Game %> + + <% else %> + + <% end %> - <% end %>
Item ID CustomerType Rentable Overdue Date Checked Out
<%=h coitem.rentable.id.to_s %> <%=h coitem.customer.name %><%=h coitem.rentable.title %><%=h coitem.rentable.class %><%=link_to coitem.rentable.title.to_s, :controller => 'game', :action => 'show', :id => coitem.rentable %><%=link_to coitem.rentable.title.to_s, :controller => 'video', :action => 'show', :id => coitem.rentable %><%=h tf_to_yesno(coitem.overdue?) %> <%=h coitem.out_date %> <%=h coitem.due_date %><%= link_to 'View', :action => 'show', :id => coitem %>
diff --git a/app/views/coitem/overdue.rhtml b/app/views/coitem/overdue.rhtml index d6f525e..ab44d10 100644 --- a/app/views/coitem/overdue.rhtml +++ b/app/views/coitem/overdue.rhtml @@ -2,6 +2,7 @@ + @@ -14,6 +15,7 @@ <% for coitem in @coitems %> + diff --git a/app/views/customer/list.rhtml b/app/views/customer/list.rhtml index c9bce2b..2f4bd9c 100644 --- a/app/views/customer/list.rhtml +++ b/app/views/customer/list.rhtml @@ -2,19 +2,19 @@
Item ID Customer Customer Phone # Customer Email
<%=h coitem.rentable.id.to_s %> <%=link_to coitem.customer.name, :controller => 'customer', :action => 'show', :id => coitem.customer.id %> <%=h coitem.customer.phone %> <%=h coitem.customer.email %>
- - <% for column in Customer.content_columns %> - - <% end %> + + + + <% for customer in @customers %> - - <% for column in Customer.content_columns %> - - <% end %> - + + + + + diff --git a/app/views/game/show.rhtml b/app/views/game/show.rhtml index b3c282f..e31791b 100644 --- a/app/views/game/show.rhtml +++ b/app/views/game/show.rhtml @@ -1,8 +1,9 @@ -<% for column in Game.content_columns %> -

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

-<% end %> +

Game ID: <%=h @game.id.to_s %>

+

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

+

New Release: <%=h tf_to_yesno(@game.newrelease) %>

+

Genre: <%=h @game.genre_name %>

+

Platform: <%=h @game.platform_name %>

+ <%= link_to 'Edit', :action => 'edit', :id => @game %> | <%= link_to 'Back', :action => 'list' %> diff --git a/app/views/game_policy/list.rhtml b/app/views/game_policy/list.rhtml index 03b7b37..327c35d 100644 --- a/app/views/game_policy/list.rhtml +++ b/app/views/game_policy/list.rhtml @@ -1,17 +1,17 @@ -

Game Rental Policies

+

Game Rental Pricing and Policies

Customer ID<%= column.human_name %>Customer IDNamePhoneDebt
<%=h customer.id %><%=h customer.send(column.name) %><%= link_to 'View', :action => 'show', :id => customer %><%=h customer.id %><%=link_to customer.name.to_s, :action => 'show', :id => customer %><%=h customer.phone %><%=h number_to_currency(customer.debt) %><%= link_to "Checked Out Items", :controller => :coitem, :action => 'filterbycustomerid', :id => customer %> <%= link_to 'Edit', :action => 'edit', :id => customer %> <%= link_to 'Remove', { :action => 'destroy', :id => customer }, :confirm => 'Are you sure?', :method => :post %>
- <% for column in GamePolicy.content_columns %> - - <% end %> + + + <% for game_policy in @game_policies %> - <% for column in GamePolicy.content_columns %> - - <% end %> + + + @@ -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 %> -
- -<%= link_to 'New game_policy', :action => 'new' %> diff --git a/app/views/purchase/list.rhtml b/app/views/purchase/list.rhtml index 4c6e1ec..b702f7f 100644 --- a/app/views/purchase/list.rhtml +++ b/app/views/purchase/list.rhtml @@ -14,7 +14,7 @@ - + diff --git a/app/views/video/show.rhtml b/app/views/video/show.rhtml index d7d089d..631ec4b 100644 --- a/app/views/video/show.rhtml +++ b/app/views/video/show.rhtml @@ -1,8 +1,9 @@ -<% for column in Video.content_columns %> -

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

-<% end %> +

Video ID: <%=h @video.id.to_s %>

+

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

+

New Release: <%=h tf_to_yesno(@video.newrelease) %>

+

Genre: <%=h @video.genre %>

+

Director: <%=h @video.director %>

+

Media: <%=h @video.media_name %>

<%= link_to 'Edit', :action => 'edit', :id => @video %> | <%= link_to 'Back', :action => 'list' %> diff --git a/app/views/video_policy/list.rhtml b/app/views/video_policy/list.rhtml index 0573275..3a04b33 100644 --- a/app/views/video_policy/list.rhtml +++ b/app/views/video_policy/list.rhtml @@ -1,17 +1,17 @@ -

Video Rental Policies

+

Video Rental Pricing and Policies

<%= column.human_name %>DescriptionFeePeriod
<%=h game_policy.send(column.name) %><%=h game_policy.description %><%=h number_to_currency(game_policy.fee) %><%=h game_policy.period %> Days <%= link_to 'View', :action => 'show', :id => game_policy %> <%= link_to 'Edit', :action => 'edit', :id => game_policy %>
<%=link_to purchase.date, :action => 'filterbydate', :id => purchase.date %> <%=h purchase.quantity %><%=link_to purchase.type, :action => 'filterbytype', :id => purchase.type %><%=link_to purchase.class, :action => 'filterbytype', :id => purchase.type %> <%=h purchase.title %> <%=h purchase.price %> <%=link_to purchase.customer.name, :action => 'filterbycust', :id => purchase.customer_id %>
- <% for column in VideoPolicy.content_columns %> - - <% end %> + + + <% for video_policy in @video_policies %> - <% for column in VideoPolicy.content_columns %> - - <% end %> + + + @@ -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 %> -
- -<%= link_to 'New video_policy', :action => 'new' %> diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 86d8540519e4d00f888fae96ff16a2ee6e79a527..f826509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Pb7m^&VR z!~HRI(ET8sb036;d-j5e?t2=2j9HpVvl+(&w`M#qw*x64QdnzFl9i^^y&LUmPWz$h z-`V6zE?U1q3#PcKifoC|*G-E~Rd}hY31prv>fENYHl5)XrxS)sXB{Cnt2QlYBE$2o zgiHwPHR0pX1MAxfH`#fqPVIG+C@=>1!mLZ#x}lS Q)^(N6@fJNPFjH6Yf6B9l%K!iX delta 702 zcmZvXJ!n%=6vyv5=e@k0JlhWoq!|M?&8J&g@$Y`~J` zKg+f&D4{v&Pe#bVs0U{$M02=CAL$uJo#t<7Ma@mv?Zqud^YnynQI^W|h1MyETTb%> znsJ|p0VEP=h*vwKVppKM$Jlm28_efNG6Msd!J&V*k$8tV6}av-+Zo-R@_O3}rHZ8e zWU(OFjFPw|-@J`)s0eHLfL`NOET9G7;T~K7+i4<*$1rEGN#DQew5# zpQNwM+>;1^1)X5BXjeck3Q(#n&YY~&=W4x&hOTKK!lemuvvgS8AM3MZ!1{lVtwi31 zk5VLpI!ghREA`o#-l^J^i?#Y?TZ@8p5l$~w78d@x><;?LVH#E$ohLu8V%2G$!B*8? zhM0+EM(^ny@~yfvSF=+{YpDb(^6ei{^GMPZDm!=Kp; zw!|*6qHL++IWbvClEJfz9-dLu`9aAP98ik5EgnhLFE-_wR$d2BDH@zBdU#S%=ldm7 z(5DpfeQGkHCVSh79+l{BC%RN3t`e3y_o|M;I~6@V<`VRkaV_T4XxiQWxx2m7JVt1r ekQ;L`mD6Fuy?KTafFGA5eflu%u*Y3fbIm`=yrE?P -- 2.25.1
<%= column.human_name %>DescriptionFeePeriod
<%=h video_policy.send(column.name) %><%=h video_policy.description %><%=h number_to_currency(video_policy.fee) %><%=h video_policy.period %>Days <%= link_to 'View', :action => 'show', :id => video_policy %> <%= link_to 'Edit', :action => 'edit', :id => video_policy %>