change route for member action and change variable name to more likely name

master
Coleman 2008-10-11 17:36:01 -05:00
parent 309b0e7374
commit 8ee2a5ebf4
2 changed files with 11 additions and 10 deletions

View File

@ -9,9 +9,9 @@ module Merb
end end
def photo_url(photo, w = nil, h = nil) def photo_url(photo, w = nil, h = nil)
w = photo.width if w.nil? or w > photo.width w = photo.width if w.nil? or w.to_i > photo.width
h = photo.height if h.nil? or h > photo.height h = photo.height if h.nil? or h.to_i > photo.height
url :controller => 'photos', :action => 'thumbnail', :width => w, :height => h, :id => photo.id "/photos/#{photo.id}/thumbnail?width=#{w}&height=#{h}"
end end
def indicator def indicator
@ -38,8 +38,8 @@ module Merb
@menu_items @menu_items
end end
def pagination(block_name, base_url) def pagination(div_name, base_url)
@pagination_block = block_name @pagination_block = div_name
@base_pagination_url = base_url @base_pagination_url = base_url
partial 'home/pagination_script' partial 'home/pagination_script'
end end

View File

@ -1,14 +1,15 @@
Merb.logger.info("Compiling routes...") Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r| Merb::Router.prepare do |r|
r.match('/').to( :controller => 'home', :action => 'index' ) # custom routes for specific thingeys
r.match('/acceptable_use').to( :controller => 'home', :action => 'acceptable_use' ) r.match('/').to(:controller => 'home', :action => 'index')
r.match('/acceptable_use').to(:controller => 'home', :action => 'acceptable_use')
r.match('/disclaimer').to(:controller => 'home', :action => 'disclaimer')
r.match('/hall_of_fame').to(:controller => 'home', :action => 'hall_of_fame') r.match('/hall_of_fame').to(:controller => 'home', :action => 'hall_of_fame')
# restful things
r.resources :sessions r.resources :sessions
r.resources :users r.resources :users
r.resources :people
r.resources :votes r.resources :votes
r.resources :favorites r.resources :favorites
r.match('/photos/thumbnail/:id').to(:controller => 'photos', :action => 'thumbnail') r.resources :photos, :member => { :thumbnail => :get }
r.resources :photos
end end