From ec93faa2c4ab420ba8ac45247a490d5ed436ca64 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Thu, 24 Feb 2011 17:09:31 -0800 Subject: [PATCH] added the post to services icon on every page added a manage icon and moved the RSS link to the public explain --- app/controllers/status_messages_controller.rb | 1 - app/views/shared/_public_explain.haml | 3 +- app/views/shared/_publisher.html.haml | 30 ++++++++++-------- .../images/icons/monotone_wrench_settings.png | Bin 0 -> 265 bytes public/javascripts/publisher.js | 15 +++++---- spec/javascripts/publisher-spec.js | 28 ++++++++++++++++ 6 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 public/images/icons/monotone_wrench_settings.png diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 51c0cef8d..77a6b3e5a 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -10,7 +10,6 @@ class StatusMessagesController < ApplicationController respond_to :json, :only => :show def create - pp params params[:status_message][:aspect_ids] = params[:aspect_ids] photos = Photo.where(:id => [*params[:photos]], :diaspora_handle => current_user.person.diaspora_handle) diff --git a/app/views/shared/_public_explain.haml b/app/views/shared/_public_explain.haml index 633cd1037..079a8d40b 100644 --- a/app/views/shared/_public_explain.haml +++ b/app/views/shared/_public_explain.haml @@ -9,7 +9,8 @@ =t('.outside') %br %br - + = link_to "RSS", current_user.public_url + %br - if current_user.services - for service in current_user.services = t('.logged_in', :service => service.provider) diff --git a/app/views/shared/_publisher.html.haml b/app/views/shared/_publisher.html.haml index 420a08f88..a0fdabcc9 100644 --- a/app/views/shared/_publisher.html.haml +++ b/app/views/shared/_publisher.html.haml @@ -2,6 +2,10 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +:javascript + $(function() { + $(".question_mark").tipsy({trigger: 'hover', gravity: 'w'}); + }); #publisher @@ -41,22 +45,20 @@ = image_tag 'ajax-loader.gif', :class => 'hidden', :id => "publisher_spinner" = status.submit t('.share'), :disable_with => t('.posting'), :class => 'button' - - if aspect == :all - .public_toggle - %p.checkbox_select - = status.check_box( :public, {:title => t('.make_public')}, true, false) + .public_toggle + %span#publisher_service_icons + - if aspect == :all + = status.hidden_field( :public) + = image_tag "social_media_logos/feed-16x16.png", :title => "RSS", :class => 'public_icon dim' + - if current_user.services + - for service in current_user.services + = image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider, :class => "service_icon dim", :id =>"#{service.provider}" + = link_to (image_tag "icons/monotone_wrench_settings.png"), "#question_mark_pane", :class => 'question_mark', :rel => 'facebox', :title => t('shared.public_explain.manage')#, :style=>"display:none;" - %span#publisher_service_icons - = link_to (image_tag "social_media_logos/feed-16x16.png", :title => "RSS"), current_user.public_url, :class => 'public_icon dim' - - if current_user.services - - for service in current_user.services - = image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider, :class => "service_icon dim", :id =>"#{service.provider}" - = link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;", :rel => 'facebox' - - .facebox_content - #question_mark_pane - = render 'shared/public_explain' + .facebox_content + #question_mark_pane + = render 'shared/public_explain' #publisher_photo_upload = render 'photos/new_photo', :aspect_ids => @aspect_ids.join(',') diff --git a/public/images/icons/monotone_wrench_settings.png b/public/images/icons/monotone_wrench_settings.png new file mode 100644 index 0000000000000000000000000000000000000000..9f79bb833d2f567e57a0fe636437814416d632a1 GIT binary patch literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc3?z4jzqJQajKx9jP7LeL$-D$|j01c^T$R<- zSlHR$zke?xE`H$P!N%t12M-=NySh%CG-<=ejmBnXMI|K{E?h`TNeK=OUASn`|Ns9v zHY-Vk%qj`;3ubV5b|VeMN%D4gVd!9$^#F1>3p^r=85p>QL70(Y)*K0-AbW|YuPgg) zCP@Zn&W*g!;($U 0){ @@ -305,12 +313,7 @@ var Publisher = { Publisher.cachedSubmit = false; Publisher.bindServiceIcons(); - $("div.public_toggle input").live("click", function(evt) { - $(".public_icon").toggleClass("dim"); - if ($(this).attr('checked') == true) { - $(".question_mark").click(); - } - }); + Publisher.bindPublicIcon(); if ($("#status_message_fake_message").val() == "") { Publisher.close(); diff --git a/spec/javascripts/publisher-spec.js b/spec/javascripts/publisher-spec.js index c58fb947a..771a4f1da 100644 --- a/spec/javascripts/publisher-spec.js +++ b/spec/javascripts/publisher-spec.js @@ -20,7 +20,35 @@ describe("Publisher", function() { expect(Publisher.close).wasNotCalled(); }); }); + + describe("bindPublicIcon", function() { + beforeEach( function(){ + spec.loadFixture('aspects_index_services'); + }); + it('gets called on initialize', function(){ + spyOn(Publisher, 'bindPublicIcon'); + Publisher.initialize(); + expect(Publisher.bindPublicIcon).toHaveBeenCalled(); + }); + it('toggles dim only on the clicked icon', function(){ + expect($(".public_icon").hasClass("dim")).toBeTruthy(); + + Publisher.bindPublicIcon(); + $(".public_icon").click(); + + expect($(".public_icon").hasClass("dim")).toBeFalsy(); + }); + it('toggles the hidden field', function(){ + Publisher.bindPublicIcon(); + expect($('#publisher #status_message_public').val()).toBe('false'); + + $(".public_icon").click(); + expect($('#publisher #status_message_public').val()).toBe('true'); + + + }); + }); describe("bindServiceIcons", function() { beforeEach( function(){ spec.loadFixture('aspects_index_services');