Skip to content
Extraits de code Groupes Projets
Valider 1139299f rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

removed loop and hidden checkboxes from publisher. hidden field passes single...

removed loop and hidden checkboxes from publisher.  hidden field passes single aspect id or :all to controller
parent 060767e7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
......@@ -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}"
......@@ -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
......@@ -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)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter