From 154ec9571779fd7563667c5f686a7b24a129b9f1 Mon Sep 17 00:00:00 2001 From: danielvincent <danielgrippi@gmail.com> Date: Fri, 8 Oct 2010 14:06:49 -0700 Subject: [PATCH] killed the public tab. made a broadcast button in everyone tab --- app/models/fb_status.rb | 2 -- app/views/aspects/index.html.haml | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/shared/_aspect_nav.haml | 4 +--- app/views/shared/_publisher.haml | 12 +++++++++--- app/views/shared/_sub_header.haml | 2 +- public/javascripts/view.js | 7 +++++++ public/stylesheets/application.css | 10 +++++----- public/stylesheets/sass/application.sass | 10 +++++----- spec/models/retraction_spec.rb | 22 ++++++++++++---------- 10 files changed, 42 insertions(+), 31 deletions(-) diff --git a/app/models/fb_status.rb b/app/models/fb_status.rb index 0e7d2692e6..7076cbd313 100644 --- a/app/models/fb_status.rb +++ b/app/models/fb_status.rb @@ -26,6 +26,4 @@ class FbStatus :updated_time => Time.parse(hash['updated_time']) ) end - end - diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 772a71971a..4935531d6d 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -9,7 +9,7 @@ = render "shared/aspect_friends" - content_for :publish do - = render "shared/publisher", :aspect_ids => :all + = render "shared/publisher", :aspect_ids => :all, :broadcast => true %ul#stream - for post in @posts diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index b8de1dd247..961dd9e0b0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -49,7 +49,7 @@ = text_field_tag 'q' %li= link_to current_user.real_name, current_user.person - %li= link_to t('.edit_profile'), edit_user_path(current_user) + %li= link_to "settings", edit_user_path(current_user) %li= link_to t('.logout.'), destroy_user_session_path = render "shared/aspect_nav" diff --git a/app/views/shared/_aspect_nav.haml b/app/views/shared/_aspect_nav.haml index 8d1fa844da..799479a13d 100644 --- a/app/views/shared/_aspect_nav.haml +++ b/app/views/shared/_aspect_nav.haml @@ -5,14 +5,12 @@ #aspect_nav %ul %li{:class => ("selected" if @aspect == :all)} - = link_to t('.all_aspects'), root_url + = link_to "Everyone", root_url - for aspect in @aspects %li{:class => ("selected" if current_aspect?(aspect))} = link_for_aspect aspect %ul{ :style => "position:absolute;right:0;bottom:0.01em;"} - %li{:class => ("selected" if @aspect == :public)} - = link_to "Public", aspects_public_path %li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)} = link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects') diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 410670c855..0a0eff891e 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -10,8 +10,6 @@ %p %label{:for => "status_message_message"} Message = f.text_area :message, :rows => 2, :value => params[:prefill] - = connected_fb_as(@access_token) if @logged_in && @aspect == :public - = f.hidden_field( :public, :value => (params[:action] == 'public') ) %ul.aspect_selector{ :style => "display:none;"} going to... @@ -19,4 +17,12 @@ %li = check_box_tag("aspect_ids[]", aspect.id, @aspect == :public || @aspect == :all || current_aspect?(aspect) ) = aspect.name - = f.submit t('.share') + + = connected_fb_as(@access_token) if @logged_in && @aspect == :public + = f.hidden_field( :public, :value => (params[:action] == 'public') ) + + .buttons + = f.submit t('.share'), :name => "share", :id => "fii" + - if broadcast + = f.submit "Broadcast", :class => "broadcast", :name => "broadcast" + diff --git a/app/views/shared/_sub_header.haml b/app/views/shared/_sub_header.haml index e7dc4e79da..781b38629e 100644 --- a/app/views/shared/_sub_header.haml +++ b/app/views/shared/_sub_header.haml @@ -7,7 +7,7 @@ - else %h2 - if @aspect == :all - = link_to t('.all_aspects'), root_path + = link_to "Everyone", root_path - elsif @aspect == :public = "Public" - elsif @aspect == :manage diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 58264470fc..119b86d3de 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -66,3 +66,10 @@ $.fn.clearForm = function() { }); }; +$("#publisher .broadcast").live("click", function(evt){ + evt.preventDefault(); + if( confirm("Broadcast to the world?") ) { + $("#status_message_public").val("true"); + $(this).submit(); + } +}); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 6320a4567d..4e5f7c3c6b 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -418,16 +418,16 @@ label { #publisher form { display: inline; } #publisher form input[type='submit'] { - float: right; + display: block; margin-right: 20px; - margin-top: 26px; } + width: 100%; } #publisher textarea { - width: 600px; + width: 570px; height: 42px; margin-top: 0; margin-bottom: 0; } - #publisher .button { - margin-left: 100px; } + #publisher .buttons { + float: right; } #image_picker .small_photo { height: 100px; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 40e824fa02..46f533b82d 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -563,20 +563,20 @@ label :display inline input[type='submit'] - :float right + :display block :margin :right 20px - :top 26px + :width 100% textarea - :width 600px + :width 570px :height 42px :margin :top 0 :bottom 0 - .button - :margin-left 100px + .buttons + :float right #image_picker .small_photo diff --git a/spec/models/retraction_spec.rb b/spec/models/retraction_spec.rb index fd8e3d28a7..4cbb14e9ef 100644 --- a/spec/models/retraction_spec.rb +++ b/spec/models/retraction_spec.rb @@ -5,25 +5,27 @@ require 'spec_helper' describe Retraction do - before do - @user = Factory.create(:user) - @person = Factory.create(:person) - @aspect = @user.aspect(:name => "Bruisers") - @user.activate_friend(@person, @aspect) - @post = @user.post :status_message, :message => "Destroy!", :to => @aspect.id - end + + let(:user) { Factory(:user) } + let(:person) { Factory(:person) } + let(:aspect) { user.aspect(:name => "Bruisers") } + let!(:activation) { user.activate_friend(person, aspect) } + let!(:post) { user.post :status_message, :message => "Destroy!", :to => aspect.id } + describe 'serialization' do it 'should have a post id after serialization' do - retraction = Retraction.for(@post) + retraction = Retraction.for(post) xml = retraction.to_xml.to_s - xml.include?(@post.id.to_s).should == true + xml.include?(post.id.to_s).should == true end end + describe 'dispatching' do it 'should dispatch a message on delete' do Factory.create(:person) User::QUEUE.should_receive :add_post_request - @post.destroy + post.destroy end end + end -- GitLab