the saved aspects works properly now
This commit is contained in:
parent
789ff679a9
commit
55403d9bea
4 changed files with 34 additions and 5 deletions
|
|
@ -6,7 +6,11 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if current_user
|
if current_user
|
||||||
redirect_to :controller => 'aspects', :action => 'index', :a_ids => current_user.open_aspects
|
if params[:home]
|
||||||
|
redirect_to :controller => 'aspects', :action => 'index'
|
||||||
|
else
|
||||||
|
redirect_to :controller => 'aspects', :action => 'index', :a_ids => current_user.open_aspects
|
||||||
|
end
|
||||||
elsif is_mobile_device?
|
elsif is_mobile_device?
|
||||||
redirect_to user_session_path
|
redirect_to user_session_path
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
-unless @landing_page
|
-unless @landing_page
|
||||||
%ul#aspect_nav
|
%ul#aspect_nav
|
||||||
%li{:class => ('selected' if @aspect == :all)}
|
%li{:class => ('selected' if @aspect == :all)}
|
||||||
= link_to t('_home'), root_path, :class => 'home_selector'
|
= link_to t('_home'), root_path(:home => true), :class => 'home_selector'
|
||||||
|
|
||||||
- for aspect in @all_aspects
|
- for aspect in @all_aspects
|
||||||
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if @object_aspect_ids.include?(aspect.id))}
|
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if @object_aspect_ids.include?(aspect.id))}
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,30 @@ Feature: saved state
|
||||||
But I should have aspect "Open 2" "selected"
|
But I should have aspect "Open 2" "selected"
|
||||||
But I should have aspect "Closed 1" "not selected"
|
But I should have aspect "Closed 1" "not selected"
|
||||||
But I should have aspect "Closed 2" "not selected"
|
But I should have aspect "Closed 2" "not selected"
|
||||||
|
|
||||||
|
And I follow "Home"
|
||||||
|
Then I should have aspect "Home" "selected"
|
||||||
|
|
||||||
|
Scenario: home persists across sessions
|
||||||
|
Given I am signed in
|
||||||
|
And I have an aspect called "Closed 1"
|
||||||
|
And I have an aspect called "Closed 2"
|
||||||
|
And I am on the aspects page
|
||||||
|
When I follow "Closed 1"
|
||||||
|
When I follow "Home"
|
||||||
|
|
||||||
|
Then I should have aspect "Home" "selected"
|
||||||
|
Then I should have aspect "Closed 1" "not selected"
|
||||||
|
Then I should have aspect "Closed 2" "not selected"
|
||||||
|
|
||||||
|
And I click on my name in the header
|
||||||
|
And I follow "logout"
|
||||||
|
|
||||||
|
And I go to the new user session page
|
||||||
|
|
||||||
|
And I am signed in
|
||||||
|
|
||||||
|
Then I should be on the aspects page
|
||||||
|
Then I should have aspect "Home" "selected"
|
||||||
|
Then I should have aspect "Closed 1" "not selected"
|
||||||
|
Then I should have aspect "Closed 2" "not selected"
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,7 @@ When /^I click on the contact request$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should have aspect "([^"]*)" "([^"]*)"$/ do |arg1, arg2|
|
Then /^I should have aspect "([^"]*)" "([^"]*)"$/ do |arg1, arg2|
|
||||||
@aspect = Aspect.where(:name => arg1).first
|
val = evaluate_script("$('a:contains(\"#{arg1}\")').parent('li').hasClass('selected');") #
|
||||||
|
|
||||||
val = evaluate_script("$('#aspect_nav').children('li[data-guid=#{@aspect.id}]').hasClass('selected');") #
|
|
||||||
if arg2 == "selected"
|
if arg2 == "selected"
|
||||||
val.should == true
|
val.should == true
|
||||||
elsif arg2 == "not selected"
|
elsif arg2 == "not selected"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue