Browse files

adding back tabs to the profile

  • Loading branch information...
1 parent 7f1cbce commit 855cfeff0da7699fb3c2b0ce65c3e6fe75b75c2d erik committed Jul 10, 2012
Showing with 7 additions and 7 deletions.
  1. +4 −4 app/controllers/profiles_controller.rb
  2. +3 −3 config/routes.rb
View
8 app/controllers/profiles_controller.rb
@@ -25,10 +25,10 @@ def redirect_appropriately
def get_profile
@profile = User.find(params[:id])
- if ["assignments","pledges","donations","pitches","posts","tips","comments"].include?(params[:section])
- @tab = params[:section]
- if params[:section] != "donations"
- @items = User.find_by_id(@profile.id).send(params[:section]).paginate(:all, :page => params[:page], :per_page => 20,
+ if ["assignments","pledges","donations","pitches","posts","tips","comments"].include?(params[:tab])
+ @tab = params[:tab]
+ if params[:tab] != "donations"
+ @items = User.find_by_id(@profile.id).send(params[:tab]).paginate(:all, :page => params[:page], :per_page => 20,
:order => "created_at desc")
else
@items = User.find_by_id(@profile.id).all_donations.paid.paginate(:all, :page => params[:page], :per_page => 20,
View
6 config/routes.rb
@@ -37,7 +37,9 @@
map.resources :donations, :credit_pitches, :affiliations, :pledges, :pages, :groups
map.connect "/profiles/:id/ban", :controller => "profiles", :action => "ban"
map.connect "/profiles/:id/unban", :controller => "profiles", :action => "unban"
- map.resources :profiles
+ map.resources :profiles do |profile|
+ profile.connect ":tab", :controller => "pitches", :action => "show", :requirements => { :tab => /"assignments|pledges|donations|pitches|posts|tips|comments/ }
+ end
map.resources :stories, :member => {:accept => :put, :reject => :put, :fact_check => :put, :publish => :put}, :has_many => :comments
map.resources :tips, :has_many => [:affiliations, :comments]
map.resources :subscribers
@@ -138,8 +140,6 @@
map.connect "/myspot/purchases/paypal_return", :controller => "myspot/purchases", :action => "paypal_return"
map.connect "/myspot/purchases/paypal_ipn", :controller => "myspot/purchases", :action => "paypal_ipn"
- map.connect "/profiles/:profile_id/ban", :controller => "profiles", :action => "ban"
-
map.connect "/purchase/:pitch_id", :controller => "myspot/purchases", :action => "new"
map.namespace :myspot do |myspot|
myspot.resource :profile do |profile|

0 comments on commit 855cfef

Please sign in to comment.