fixed #884
This commit is contained in:
parent
d74942877f
commit
8c1c546bdf
2 changed files with 23 additions and 2 deletions
|
|
@ -24,11 +24,17 @@ class AspectsController < ApplicationController
|
||||||
aspect_ids = @aspects.map{|a| a.id}
|
aspect_ids = @aspects.map{|a| a.id}
|
||||||
|
|
||||||
# redirect to signup
|
# 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
|
redirect_to getting_started_path
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# redirect to aspects creation
|
||||||
|
if @aspects.blank?
|
||||||
|
redirect_to new_aspect_path
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
unless params[:only_posts]
|
unless params[:only_posts]
|
||||||
all_selected_people = Person.joins(:contacts => :aspect_memberships).
|
all_selected_people = Person.joins(:contacts => :aspect_memberships).
|
||||||
where(:contacts => {:user_id => current_user.id},
|
where(:contacts => {:user_id => current_user.id},
|
||||||
|
|
@ -88,7 +94,10 @@ class AspectsController < ApplicationController
|
||||||
def new
|
def new
|
||||||
@aspect = Aspect.new
|
@aspect = Aspect.new
|
||||||
@person_id = params[:person_id]
|
@person_id = params[:person_id]
|
||||||
render :layout => false
|
respond_to do |format|
|
||||||
|
format.js { render :layout => false }
|
||||||
|
format.html { render '_new' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,18 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
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
|
context 'with posts in multiple aspects' do
|
||||||
before do
|
before do
|
||||||
@posts = []
|
@posts = []
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue