Skip to content
Extraits de code Groupes Projets
Valider 8c1c546b rédigé par MrZYX's avatar MrZYX
Parcourir les fichiers

fixed #884

parent d7494287
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -24,10 +24,16 @@ class AspectsController < ApplicationController ...@@ -24,10 +24,16 @@ 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).
...@@ -88,7 +94,10 @@ class AspectsController < ApplicationController ...@@ -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
......
...@@ -90,6 +90,18 @@ describe AspectsController do ...@@ -90,6 +90,18 @@ describe AspectsController do
response.should_not be_redirect response.should_not be_redirect
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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter