diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml new file mode 100644 index 000000000..0b3bbff3b --- /dev/null +++ b/app/views/aspects/_aspect_stream.haml @@ -0,0 +1,9 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + += render 'shared/publisher', :aspect => aspect, :aspect_ids => aspect_ids +#main_stream.stream + = render 'shared/stream', :posts => post_hashes += will_paginate @posts diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 13906acb3..24f7bb16c 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -15,13 +15,14 @@ = info_text(t('.handle_explanation')) .span-15.append-1 - = render 'shared/publisher', :aspect => @aspect, :aspect_ids => @aspect_ids /= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count /= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count - #main_stream.stream - = render 'shared/stream', :posts => @post_hashes - = will_paginate @posts + #aspect_stream_container + = render 'aspect_stream', + :aspect => @aspect, + :aspect_ids => @aspect_ids, + :post_hashes => @post_hashes .span-6.last = render 'aspects/all_aspects_contacts' diff --git a/app/views/aspects/index.js.erb b/app/views/aspects/index.js.erb index aa27af5a0..2b6d2686d 100644 --- a/app/views/aspects/index.js.erb +++ b/app/views/aspects/index.js.erb @@ -1 +1 @@ -$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>"); +$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :post_hashes => @post_hashes)) %>"); diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml index 1958f2589..cbac6e953 100644 --- a/app/views/photos/_new_photo.haml +++ b/app/views/photos/_new_photo.haml @@ -52,4 +52,4 @@ }); } - window.onload = createUploader; + createUploader(); diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 90f5bb6fa..516f38c87 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -3,32 +3,6 @@ -# the COPYRIGHT file. -- content_for :head do - :javascript - $(document).ready(function(){ - $("div.public_toggle input").bind("click", function(evt){ - $("#publisher_service_icons").toggleClass("dim"); - if($(this).attr('checked') == true){ - $(".question_mark").click(); - }; - }); - - if($("textarea#status_message_message").val() != ""){ - $("#publisher").removeClass("closed"); - $("#publisher").find("textarea").focus(); - $("#publisher .options_and_submit").show(); - } - - $("#publisher textarea, #publisher input").bind("focus", function(evt){ - $("#publisher .options_and_submit").show(); - }); - - $("#click_to_share").find("a").bind("click", function(evt){ - $("#publisher").removeClass("closed"); - $("#publisher").find("textarea").focus(); - }); - }); - #publisher{:class=>"closed"} #click_to_share @@ -61,9 +35,9 @@ #fileInfo = image_tag 'ajax-loader.gif', :class => 'hidden', :id => "publisher_spinner" - if aspect == :all - = status.submit t('.share'), :title => t('.share_with_all'), :disable_with => t('.posting') + = status.submit t('.share'), :title => t('.share_with_all'), :disable_with => t('.posting'), :class => 'button' - else - = status.submit t('.share'), :title => t('.share_with', :aspect => aspect), :disable_with => t('.posting') + = status.submit t('.share'), :title => t('.share_with', :aspect => aspect), :disable_with => t('.posting'), :class => 'button' - if aspect == :all .public_toggle diff --git a/config/assets.yml b/config/assets.yml index c13dce455..2ef964632 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -31,6 +31,7 @@ javascripts: - public/javascripts/aspect-edit.js - public/javascripts/contact-list.js home: + - public/javascripts/publisher.js - public/javascripts/aspect-filters.js people: - public/javascripts/contact-list.js diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js index 7879e961c..977386b0c 100644 --- a/public/javascripts/aspect-filters.js +++ b/public/javascripts/aspect-filters.js @@ -3,7 +3,7 @@ * the COPYRIGHT file. */ -$(function(){ +$(document).ready(function(){ var selectedGUIDS = []; $("#aspect_nav li").each(function(){ @@ -20,7 +20,7 @@ $(function(){ e.preventDefault(); // loading animation - $("#main_stream").fadeTo(100, 0.4); + $("#aspect_stream_container").fadeTo(100, 0.4); // filtering ////////////////////// @@ -53,6 +53,7 @@ $(function(){ } // generate new url + baseURL = baseURL.replace('#',''); baseURL += '?'; for(i=0; i < selectedGUIDS.length; i++){ baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&'; @@ -66,7 +67,7 @@ $(function(){ url : baseURL, dataType : 'script', success : function(data){ - $("#main_stream").fadeTo(100, 1); + $("#aspect_stream_container").fadeTo(100, 1); } }); diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js new file mode 100644 index 000000000..a4185c15a --- /dev/null +++ b/public/javascripts/publisher.js @@ -0,0 +1,29 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is + * licensed under the Affero General Public License version 3 or later. See + * the COPYRIGHT file. + */ + + +$(document).ready(function(){ + $("div.public_toggle input").live("click", function(evt){ + $("#publisher_service_icons").toggleClass("dim"); + if($(this).attr('checked') == true){ + $(".question_mark").click(); + }; + }); + + if($("textarea#status_message_message").val() != ""){ + $("#publisher").removeClass("closed"); + $("#publisher").find("textarea").focus(); + $("#publisher .options_and_submit").show(); + } + + $("#publisher textarea, #publisher input").live("focus", function(evt){ + $("#publisher .options_and_submit").show(); + }); + + $("#click_to_share").find("a").live("click", function(evt){ + $("#publisher").removeClass("closed"); + $("#publisher").find("textarea").focus(); + }); +}); diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index aedb11432..be7b386f8 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -106,12 +106,12 @@ var Stream = { }); }); - $(".new_status_message").bind('ajax:loading', function(data, json, xhr) { + $(".new_status_message").live('ajax:loading', function(data, json, xhr) { $("#photodropzone").find('li').remove(); $("#publisher textarea").removeClass("with_attachments"); }); - $(".new_status_message").bind('ajax:success', function(data, json, xhr) { + $(".new_status_message").live('ajax:success', function(data, json, xhr) { json = $.parseJSON(json); WebSocketReceiver.addPostToStream(json.post_id, json.html); //collapse publisher diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 034883106..a3e6ebad8 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -937,6 +937,7 @@ label > li :display inline :margin 0 + :right 2px :padding 4px 0 a :-webkit-border-radius 2px @@ -945,9 +946,9 @@ label :text-shadow 0 1px 0 #444 - :padding 1px 7px + :padding 1px 5px - :color #CCC + :color #999 :max-width 120px :overflow hidden :text-overflow ellipsis @@ -958,7 +959,7 @@ label :color #eee &.selected a - :text-shadow 0 1px 0 #eee + :text-shadow 0 1px 0 #fff :font :weight bold :background