publisher retains text when filtering stream

This commit is contained in:
danielvincent 2011-01-05 10:23:13 -08:00
parent a773450650
commit d0b25814b1
5 changed files with 49 additions and 15 deletions

View file

@ -42,5 +42,20 @@ module AspectsHelper
remove_from_aspect_button(aspect_id, person.id)
end
end
def publisher_description(aspect_count, aspect=nil)
if aspect && aspect == :all
str = t('.share_with_all')
else
str = "#{t('.post_a_message_to', :aspect => aspect_count)} "
if aspect_count == 1
str += t('_aspect')
else
str += t('_aspects')
end
end
(link_to str, '#', :id => 'expand_publisher').html_safe
end
end

View file

@ -3,14 +3,11 @@
-# the COPYRIGHT file.
#publisher{:class=>"closed"}
#publisher{:class => ("closed" unless params[:op])}
#click_to_share
= image_tag 'icons/doc_edit.png'
- if aspect == :all
= link_to t('.share_with_all'), '#', :id => 'expand_publisher'
- else
= link_to t('.post_a_message_to', :aspect => aspect), '#', :id => 'expand_publisher'
= publisher_description(@aspect_ids.count, aspect)
.content_creation
= form_for(StatusMessage.new, :remote => true) do |status|
@ -30,14 +27,13 @@
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
.options_and_submit
.right
#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'), :class => 'button'
- else
= status.submit t('.share'), :title => t('.share_with', :aspect => aspect), :disable_with => t('.posting'), :class => 'button'
= status.submit t('.share'), :disable_with => t('.posting'), :class => 'button'
- if aspect == :all
.public_toggle

View file

@ -41,6 +41,8 @@ en:
one: "new request!"
few: "%{count} new requests!"
other: "%{count} new requests!"
_aspect: "aspect"
_aspects: "aspects"
activemodel:
errors:

View file

@ -4,7 +4,8 @@
*/
$(document).ready(function(){
var selectedGUIDS = [];
var selectedGUIDS = [],
requests = 0;
$("#aspect_nav li").each(function(){
var button = $(this),
@ -19,9 +20,13 @@ $(document).ready(function(){
$("#aspect_nav a.aspect_selector").click(function(e){
e.preventDefault();
requests++;
// loading animation
$("#aspect_stream_container").fadeTo(100, 0.4);
// get text from box
var post = $("#publisher textarea").val();
// filtering //////////////////////
var $this = $(this),
@ -58,16 +63,33 @@ $(document).ready(function(){
for(i=0; i < selectedGUIDS.length; i++){
baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&';
}
baseURL = baseURL.slice(0,baseURL.length-1);
if(!$("#publisher").hasClass("closed")) {
// open publisher
baseURL += "op=true";
} else {
// slice last '&'
baseURL = baseURL.slice(0,baseURL.length-1);
}
///////////////////////////////////
//window.location = baseURL;
$.ajax({
url : baseURL,
dataType : 'script',
success : function(data){
$("#aspect_stream_container").fadeTo(100, 1);
requests--;
// fill in publisher
// (not cached because this element changes)
$("#publisher textarea").val(post);
// reinit listeners on stream
Stream.initialize();
// fade contents back in
if(requests == 0){
$("#aspect_stream_container").fadeTo(100, 1);
}
}
});

View file

@ -112,7 +112,7 @@ form
:margin 0
header
:z-index 4
:z-index 10
:position relative
:min-height 40px
@ -120,7 +120,7 @@ header
:color #111
:color rgba(30,30,30,0.98)
:background -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.94)), to(rgba(0,0,0,0.96)))
:background -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.88)), to(rgba(0,0,0,0.96)))
:-webkit-box-shadow 0 1px 3px #111
:-moz-box-shadow 0 1px 2px #111
@ -786,7 +786,6 @@ label
:size 14px
.options_and_submit
:display none
:min-height 21px
:position relative
:padding