From: Ira W. Snyder Date: Mon, 26 Nov 2007 07:53:21 +0000 (-0800) Subject: Many visual tweaks, suggested by Lan X-Git-Tag: turned-in~28 X-Git-Url: https://irasnyder.com/gitweb/?a=commitdiff_plain;h=e4597521e3a7365f86731f7d69643cb1067acb5e;p=cs356-p2-videostore.git Many visual tweaks, suggested by Lan Signed-off-by: Ira W. Snyder --- 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 86d8540..f826509 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ
<%= 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 %>