This commit is contained in:
MrZYX 2011-07-06 15:38:54 +02:00
parent d74942877f
commit 8c1c546bdf
2 changed files with 23 additions and 2 deletions

View file

@ -24,11 +24,17 @@ class AspectsController < ApplicationController
aspect_ids = @aspects.map{|a| a.id}
# redirect to signup
if (current_user.getting_started == true || @aspects.blank?) && !request.format.mobile? && !request.format.js?
if current_user.getting_started == true && !request.format.mobile? && !request.format.js?
redirect_to getting_started_path
return
end
# redirect to aspects creation
if @aspects.blank?
redirect_to new_aspect_path
return
end
unless params[:only_posts]
all_selected_people = Person.joins(:contacts => :aspect_memberships).
where(:contacts => {:user_id => current_user.id},
@ -88,7 +94,10 @@ class AspectsController < ApplicationController
def new
@aspect = Aspect.new
@person_id = params[:person_id]
render :layout => false
respond_to do |format|
format.js { render :layout => false }
format.html { render '_new' }
end
end
def destroy

View file

@ -91,6 +91,18 @@ describe AspectsController do
end
end
context 'with no aspects' do
before do
alice.aspects.each { |aspect| aspect.destroy }
alice.reload
end
it 'redirects to the new aspect page' do
get :index
response.should redirect_to new_aspect_path
end
end
context 'with posts in multiple aspects' do
before do
@posts = []