added a warning, moved connected as into a partial, removed the

publishing box from settings page
This commit is contained in:
ilya 2010-09-27 16:31:05 -07:00
parent d41b370630
commit 52313b799b
3 changed files with 10 additions and 9 deletions

View file

@ -66,4 +66,9 @@ module ApplicationHelper
def post_yield_tag(post) def post_yield_tag(post)
(':' + post.id.to_s).to_sym (':' + post.id.to_s).to_sym
end end
def connected_fb_as token
response_hash = MiniFB.get(token, 'me')
"Connected to facebook as #{response_hash[:name]}"
end
end end

View file

@ -10,7 +10,7 @@
%p %p
%label{:for => "status_message_message"} Message %label{:for => "status_message_message"} Message
= f.text_area :message, :rows => 2, :value => params[:prefill] = f.text_area :message, :rows => 2, :value => params[:prefill]
= "going to Facebook as #{MiniFB.get(@access_token, 'me')[:name]}" if @logged_in && @aspect == :public = connected_fb_as(@access_token) if @logged_in && @aspect == :public
= f.hidden_field( :public, :value => (params[:action] == 'public') ) = f.hidden_field( :public, :value => (params[:action] == 'public') )
%ul.aspect_selector{ :style => "display:none;"} %ul.aspect_selector{ :style => "display:none;"}

View file

@ -8,20 +8,16 @@
%h3 Facebook %h3 Facebook
%p %p
- if @logged_in - if @logged_in
Connected to facebook as = connected_fb_as(@access_token)
- @response_hash = MiniFB.get(@access_token, 'me')
= @response_hash[:name] %p
- @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
- @fb_friends[:data].each do |friend| - @fb_friends[:data].each do |friend|
= image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
- form_tag "/services/fb_post" do
= text_area_tag "message"
= submit_tag "send it off"
= link_to "Disconnect from Facebook", services_destroy_path = link_to "Disconnect from Facebook", services_destroy_path
- else - else
= link_to "Connect to Facebook", @fb_access_url = link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url
#content_bottom #content_bottom
.back .back