From a84f9437b09e5c20d91cec5f64754f0336bdfae7 Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 8 Nov 2010 16:30:46 -0800 Subject: [PATCH 1/3] trying another thing to get the redirect working --- app/controllers/people_controller.rb | 2 +- app/controllers/services_controller.rb | 7 ++++++- app/controllers/status_messages_controller.rb | 2 +- app/views/photos/_index.html.haml | 2 +- app/views/shared/_author_info.html.haml | 1 + spec/controllers/services_controller_spec.rb | 16 +++++++++++++++- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 996ead2ff..bcea6fb76 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -18,7 +18,7 @@ class PeopleController < ApplicationController @person = Person.find(params[:id].to_id) @post_type = :all - + @aspect = :none if @person @profile = @person.profile @contact = current_user.contact_for(@person) diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 3086b66c3..b12848d06 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -11,6 +11,7 @@ class ServicesController < ApplicationController end def create + auth = request.env['omniauth.auth'] provider = auth['provider'] @@ -32,7 +33,11 @@ class ServicesController < ApplicationController end flash[:notice] = I18n.t 'services.create.success' - redirect_to :back + if current_user.getting_started + redirect_to getting_started_path(:step => 3) + else + redirect_to services_url + end end def destroy diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 3f7911162..e33612dc7 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -24,7 +24,7 @@ class StatusMessagesController < ApplicationController def index @aspect = :profile - @post_type = :status_message + @post_type = :status_messages @person = Person.find(params[:person_id].to_id) diff --git a/app/views/photos/_index.html.haml b/app/views/photos/_index.html.haml index fc53d91f7..7f38bcd2b 100644 --- a/app/views/photos/_index.html.haml +++ b/app/views/photos/_index.html.haml @@ -11,7 +11,7 @@ }); }); -.span-24.last +.span-15.last #thumbnails - for photo in photos .image_thumb diff --git a/app/views/shared/_author_info.html.haml b/app/views/shared/_author_info.html.haml index fa63ede45..10a418741 100644 --- a/app/views/shared/_author_info.html.haml +++ b/app/views/shared/_author_info.html.haml @@ -16,3 +16,4 @@ = link_to t('.view_profile'), person_path(person) = link_to t('_photos'), person_photos_path(person) = link_to 'status messages', person_status_messages_path(person) + = "viewing: #{@post_type.to_s.titleize}" if defined?(@post_type) diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index e11869a4b..9549a9085 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -22,6 +22,7 @@ describe ServicesController do before do sign_in :user, user + @controller.stub!(:current_user).and_return(user) mock_access_token.stub!(:token).and_return("12345") mock_access_token.stub!(:secret).and_return("56789") end @@ -36,9 +37,22 @@ describe ServicesController do describe '#create' do it 'creates a new OmniauthService' do request.env['omniauth.auth'] = omniauth_auth - request.env["HTTP_REFERER"] = "" lambda{post :create}.should change(user.services, :count).by(1) end + + it 'should redirect to getting started if the user still getting started' do + user.getting_started = true + request.env['omniauth.auth'] = omniauth_auth + post :create + response.should redirect_to getting_started_path(:step => 3) + end + + it 'should redirect to services url' do + user.getting_started = false + request.env['omniauth.auth'] = omniauth_auth + post :create + response.should redirect_to services_url + end end describe '#destroy' do From 7d6be51cfb0c0750ada0795550071cf5406ef305 Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 8 Nov 2010 17:53:47 -0800 Subject: [PATCH 2/3] making photos#show be in no aspect --- app/controllers/photos_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 780f17b5b..063e98b4c 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -83,6 +83,7 @@ class PhotosController < ApplicationController end def show + @aspect = :none @photo = current_user.find_visible_post_by_id params[:id] unless @photo render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 From 091d98ea15d9334d2768ce6220c9c16316dc4ef9 Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 8 Nov 2010 18:00:36 -0800 Subject: [PATCH 3/3] invite friends actually calls up the invite friends pane on all aspects --- app/views/aspects/_no_friends_message.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/aspects/_no_friends_message.haml b/app/views/aspects/_no_friends_message.haml index a36d8bab7..51babc7fe 100644 --- a/app/views/aspects/_no_friends_message.haml +++ b/app/views/aspects/_no_friends_message.haml @@ -6,7 +6,7 @@ - if aspect == :all %h3=t('.nobody') %h4= link_to t('.add_friend'), aspects_manage_path - %h4= link_to t('.invite'), aspects_manage_path + %h4= link_to t('.invite'), "#invite_user_pane", :class => "invite_user_button", :class => "invite_user_button", :title => t('.invite') - else %h3=t('.nobody_in_aspect', :aspect_name => aspect.name) %h4= link_to t('.add_friend_to', :aspect_name => aspect.name), "#add_request_pane", :class => "add_request_button"