diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index b4bc9fe94..c365b0e46 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -9,15 +9,11 @@ class StatusMessagesController < ApplicationController respond_to :json, :only => :show def create - params[:status_message][:to] = params[:aspect_ids] - data = clean_hash params[:status_message] - if logged_into_fb? && params[:status_message][:public] == '1' - id = 'me' + id, type = 'me' type = 'feed' - Rails.logger.info("Sending a message: #{params[:status_message][:message]} to Facebook") EventMachine::HttpRequest.new("https://graph.facebook.com/me/feed?message=#{params[:status_message][:message]}&access_token=#{@access_token}").post end diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index a6f1bd92c..e44c28157 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -3,7 +3,6 @@ -# the COPYRIGHT file. :javascript - $("div.public_toggle input").live("click", function(evt){ if("#{@logged_in}" == "false" && $(this).attr('checked') == true){ $(".question_mark").click(); @@ -16,28 +15,23 @@ = form_for StatusMessage.new, :remote => true do |f| = f.error_messages %p - %label{:for => "status_message_message"} Message + = f.label :message, "Post a message to #{@aspect}" = f.text_area :message, :rows => 2, :value => params[:prefill] - %ul.aspect_selector{ :style => "display:none;"} - going to... - - for aspect in @aspects - %li - = check_box_tag("aspect_ids[]", aspect.id, @aspect == :all || current_aspect?(aspect) ) - = aspect.name - + = f.hidden_field :to, :value => (@aspect == :all ? @aspect : @aspect.id) - if @aspect == :all .public_toggle = f.check_box( :public, :value => false ) make public = link_to '(?)', "#question_mark_pane", :class => 'question_mark' - .yo{:style => "display:none;"} + + .fancybox_content #question_mark_pane = render 'shared/public_explain' - .buttons - - if @aspect == :all - = f.submit t('.share'), :title => "Share with all aspects" - - else - = f.submit t('.share'), :title => "Share with #{@aspect.name}" + + - if @aspect == :all + = f.submit t('.share'), :title => "Share with all aspects" + - else + = f.submit t('.share'), :title => "Share with #{@aspect.name}" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index b37faf839..7eab8e3fd 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -629,20 +629,14 @@ label :display inline input[type='submit'] - :display block + :float right :margin :right 20px - :width 100% textarea :width 570px :height 42px - :margin - :top 0 - :bottom 0 - - .buttons - :float right + :margin 0 .public_toggle :position absolute @@ -1057,3 +1051,6 @@ input[type="search"] header input[type="search"] :width 200px + +.fancybox_content + :display none diff --git a/spec/controllers/status_message_controller_spec.rb b/spec/controllers/status_message_controller_spec.rb index 8df112285..9c84fe3e8 100644 --- a/spec/controllers/status_message_controller_spec.rb +++ b/spec/controllers/status_message_controller_spec.rb @@ -5,16 +5,17 @@ require 'spec_helper' describe StatusMessagesController do - render_views + render_views + + let!(:user) { Factory(:user) } + let!(:aspect) { user.aspect(:name => "lame-os") } + before do - @user = Factory.create(:user) - @aspect = @user.aspect(:name => "lame-os") - @album = @user.post :album, :to => @aspect.id, :name => 'things on fire' - sign_in :user, @user + sign_in :user, user end describe '#create' do - let(:status_message_hash) {{"aspect_ids" =>"#{@aspect.id.to_s}", "status_message"=>{"public"=>"1", "message"=>"facebook, is that you?"}}} + let(:status_message_hash) {{"status_message"=>{"public"=>"1", "message"=>"facebook, is that you?", "to" =>"#{aspect.id}"}}} before do @controller.stub!(:logged_into_fb?).and_return(true)