only show connect to services if all services not already connected
This commit is contained in:
parent
001d4ceaff
commit
6a56e3298c
3 changed files with 26 additions and 1 deletions
|
|
@ -133,4 +133,8 @@ module ApplicationHelper
|
||||||
featured_users_path
|
featured_users_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def all_services_connected?
|
||||||
|
current_user.services.size == AppConfig[:configured_services].size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
= t('aspects.index.cubbies.explanation')
|
= t('aspects.index.cubbies.explanation')
|
||||||
= link_to t('aspects.index.cubbies.learn_more'), token_path
|
= link_to t('aspects.index.cubbies.learn_more'), token_path
|
||||||
|
|
||||||
- unless AppConfig.configured_services.blank?
|
- unless AppConfig.configured_services.blank? || all_services_connected?
|
||||||
.section
|
.section
|
||||||
.title
|
.title
|
||||||
= image_tag('/images/icons/monotone_wrench_settings.png')
|
= image_tag('/images/icons/monotone_wrench_settings.png')
|
||||||
|
|
|
||||||
|
|
@ -77,4 +77,25 @@ describe ApplicationHelper do
|
||||||
contacts_link.should == contacts_path
|
contacts_link.should == contacts_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#all_services_connected?" do
|
||||||
|
before do
|
||||||
|
AppConfig[:configured_services] = [1, 2, 3]
|
||||||
|
|
||||||
|
def current_user
|
||||||
|
@current_user
|
||||||
|
end
|
||||||
|
@current_user = alice
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true if all networks are connected' do
|
||||||
|
3.times { |t| @current_user.services << Factory.build(:service) }
|
||||||
|
all_services_connected?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false if not all networks are connected' do
|
||||||
|
@current_user.services.delete_all
|
||||||
|
all_services_connected?.should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue