From be10681945160fb60d4ab644d5fc7f8503d174f5 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 23 Sep 2010 16:06:55 -0700 Subject: [PATCH] IZ tying the publisher to fb in public aspect --- app/controllers/status_messages_controller.rb | 10 ++++++++++ app/views/aspects/public.html.haml | 5 ++++- app/views/shared/_aspect_nav.haml | 2 +- app/views/shared/_publisher.haml | 8 +++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 5a8efbe06..5dc1cbce0 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -13,6 +13,16 @@ class StatusMessagesController < ApplicationController params[:status_message][:to] = params[:aspect_ids] data = clean_hash params[:status_message] + + if @logged_in && params[:status_message][:to] == :public + id = 'me' + type = 'feed' + + @res = MiniFB.post(@access_token, id, :type=>type, + :metadata=>true, :params=>{:message => params[:status_message][:message]}) + + params[:status_message][:to] == :all + end @status_message = current_user.post(:status_message, data) respond_with @status_message diff --git a/app/views/aspects/public.html.haml b/app/views/aspects/public.html.haml index add02f490..e8872cfb7 100644 --- a/app/views/aspects/public.html.haml +++ b/app/views/aspects/public.html.haml @@ -10,7 +10,10 @@ = render "shared/aspect_friends" - content_for :publish do - = render "shared/publisher", :aspect_ids => :public + - if @logged_in + = render "shared/publisher", :aspect_ids => :public + - else + = render "shared/publisher", :aspect_ids => :all %h3 Facebook %p diff --git a/app/views/shared/_aspect_nav.haml b/app/views/shared/_aspect_nav.haml index ebfd2b57d..1d49ef049 100644 --- a/app/views/shared/_aspect_nav.haml +++ b/app/views/shared/_aspect_nav.haml @@ -12,7 +12,7 @@ = link_to "All Aspects", root_url %ul{ :style => "position:absolute;right:0;bottom:0.01em;"} - %li{:class => ("selected" if @aspect == :all)} + %li{:class => ("selected" if @aspect == :public)} = link_to "Public", aspects_public_path %li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)} diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 130f136a9..a84b39052 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -16,7 +16,13 @@ going to... - for aspect in @aspects %li - = check_box_tag("aspect_ids[]", aspect.id, @aspect == :all || current_aspect?(aspect) ) + = check_box_tag("aspect_ids[]", aspect.id, @aspect == :public || @aspect == :all || current_aspect?(aspect) ) = aspect.name = f.submit "Share" + + - if @logged_in + - @response_hash = MiniFB.get(@access_token, 'me') + = "going to Facebook as #{@response_hash[:name]}" + +