refactor AppConfig to guess what services are configured, and clean up the services view for a user. also, add a box so people can realize what they can connect

This commit is contained in:
Maxwell Salzberg 2011-07-04 13:53:41 -07:00
parent 20e2a16717
commit 2f1118f95f
5 changed files with 33 additions and 10 deletions

View file

@ -60,6 +60,7 @@ HELP
normalize_pod_url
normalize_admins
normalize_pod_services
end
def self.config_file_is_old_style?
@ -92,6 +93,19 @@ HELP
self[:admins].collect! { |username| username.downcase }
end
def self.normalize_pod_services
if defined?(SERVICES)
puts "in here"
connected_services = []
SERVICES.keys.each do |service|
unless SERVICES[service].keys.any?{|service_key| SERVICES[service][service_key].blank?}
connected_services << service
end
end
self['configured_services'] = connected_services
end
end
load!
def self.[] (key)

View file

@ -54,6 +54,18 @@
= t('.cubbies.explanation')
= link_to t('.cubbies.learn_more'), token_path
.section
.title
= image_tag('/images/icons/monotone_wrench_settings.png')
%h5
= t('.services.heading')
.content
= t('.services.content')
- AppConfig.configured_services.each do |service|
- unless current_user.services.any?{|x| x.provider == service}
%br= link_to service.titleize, "/auth/#{service}"
- if @invites > 0
.section
.title

View file

@ -14,11 +14,6 @@
- else
You haven't connected any services yet.
- unless @services.any?{|x| x.provider == 'twitter'}
%h4= link_to t('services.index.connect_to_twitter'), "/auth/twitter" if SERVICES['twitter'] && SERVICES['twitter']['consumer_key']!= ""
- unless @services.any?{|x| x.provider == 'facebook'}
%h4= link_to t('services.index.connect_to_facebook'), "/auth/facebook" if SERVICES['facebook'] && SERVICES['facebook']['app_id'] !=""
- unless @services.any?{|x| x.provider == 'tumblr'}
%h4= link_to t('services.index.connect_to_tumblr'), "/auth/tumblr" if SERVICES['tumblr'] && SERVICES['tumblr']['consumer_key'] !=""
- AppConfig.configured_services.each do |service|
- unless @services.any?{|x| x.provider == service}
%h4= link_to t("services.index.connect_to_#{service}"), "/auth/#{service}"

View file

@ -143,7 +143,7 @@ en:
seed:
family: "Family"
work: "Work"
index:
index:
your_aspects: "Your Aspects"
handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you."
no_contacts: "No contacts"
@ -157,7 +157,9 @@ en:
heading: "Diaspora ID"
content_1: "Your Diaspora ID is:"
content_2: "Give it to anyone and they'll be able to find you on Diaspora."
services:
heading: "Connect Services"
content: "You can connect the following services to Diaspora:"
aspect_memberships:
destroy:
success: "Successfully removed person from aspect"