Stream is a class

This commit is contained in:
Raphael 2010-11-21 13:21:42 -05:00
parent a3395b6de8
commit 7db1da935a
12 changed files with 41 additions and 35 deletions

1
.gitignore vendored
View file

@ -17,6 +17,7 @@ public/uploads/*
public/assets/* public/assets/*
public/source.tar* public/source.tar*
tmp/**/* tmp/**/*
tmp/*
db/*.sqlite3 db/*.sqlite3
.redcar .redcar

View file

@ -16,13 +16,9 @@
processNotification(obj['notice']); processNotification(obj['notice']);
}else if (obj['class'] == 'people'){ }else if (obj['class'] == 'people'){
$('#loader').hide();
debug("got a " + obj['class']); debug("got a " + obj['class']);
if(obj['status'] == 'fail'){ processPerson(obj);
$('#request_result li:first').show().$('#message').text(obj['response']).show();
}else{
processPerson(obj['html']);
}
}else{ }else{
debug("got a " + obj['class'] + " for aspects " + obj['aspect_ids']); debug("got a " + obj['class'] + " for aspects " + obj['aspect_ids']);
@ -46,12 +42,20 @@
}; };
}); });
function processPerson(html){ function processPerson(response){
$('.people#stream').prepend(html).slideDown('slow', function(){}); form = $('.webfinger_form:visible');
var rr = $('#request_result li:first'); form.siblings('.spinner').hide();
rr.after(html); result_ul = form.siblings('.webfinger_result');
$("#request_result [name='into']").val(rr.attr('aspect_id')); if(response['status'] == 'fail'){
$('#request_result :nth-child(2)').slideDown('fast', function(){}); result_ul.children('.error').show();
result_ul.children('.webfinger_error').text(response['response']).show();
}else{
//result_ul.prepend(response['html']).slideDown('slow', function(){});
var first_li = result_ul.find('li:first');
first_li.after(response['html']);
result_ul.children("[name='into']").val(first_li.attr('aspect_id'));
result_ul.children(':nth-child(2)').slideDown('fast', function(){});
}
} }
function processNotification(html){ function processNotification(html){
@ -60,7 +64,7 @@
function processRetraction(post_id){ function processRetraction(post_id){
$("*[data-guid='"+post_id+"']").fadeOut(400, function(){$(this).remove()}); $("*[data-guid='"+post_id+"']").fadeOut(400, function(){$(this).remove()});
if($("#stream")[0].childElementCount == 0){ if($("#main_stream")[0].childElementCount == 0){
$("#no_posts").fadeIn(200); $("#no_posts").fadeIn(200);
} }
} }
@ -89,9 +93,9 @@
function processPost(className, html, aspectIds){ function processPost(className, html, aspectIds){
if(onPageForAspects(aspectIds)){ if(onPageForAspects(aspectIds)){
var addPostToStream = function (html){ var addPostToStream = function (html){
$("#stream:not('.show')").prepend( $("#main_stream:not('.show')").prepend(
$(html).fadeIn("fast", function(){ $(html).fadeIn("fast", function(){
$("#stream").find("label").first().inFieldLabels(); $("#main_stream").find("label").first().inFieldLabels();
}) })
) )
}; };

View file

@ -7,7 +7,7 @@
=t('.results_for') =t('.results_for')
%u= params[:q] %u= params[:q]
%ul#stream.people %ul{:class => 'stream people', :id => 'people_stream'}
- for person in @people - for person in @people
= render 'people/person', :person => person, :aspects => @aspects = render 'people/person', :person => person, :aspects => @aspects

View file

@ -57,6 +57,6 @@
= link_to t('.delete_photo'), @photo, :confirm => t('are_you_sure'), :method => :delete, :class => 'button' = link_to t('.delete_photo'), @photo, :confirm => t('are_you_sure'), :method => :delete, :class => 'button'
.span-9.last .span-9.last
#stream.show %div{id => 'photo_stream', :class => 'stream show'}"
%li.message{:data=>{:guid=>@photo.id}} %li.message{:data=>{:guid=>@photo.id}}
= render "comments/comments", :post => @photo = render "comments/comments", :post => @photo

View file

@ -30,13 +30,13 @@
= submit_tag t('.create_request') = submit_tag t('.create_request')
%br %br
#loader.hidden= image_tag 'ajax-loader.gif' .spinner.hidden= image_tag 'ajax-loader.gif'
%ul#request_result{:aspect_id => aspect.id} %ul{:class => 'webfinger_result stream', :aspect_id => aspect.id}
%li.error.hidden %li.error.hidden
#message .webfinger_error
= link_to t('.know_email'), "#invite_user_pane", :class => "invite_user_button" = link_to t('.know_email'), "#invite_user_pane", :class => "invite_user_button"
%br %br
.yo{ :style => "display:none;"} .yo{ :style => "display:none;"}
#invite_user_pane .invite_user_pane
= render "invitations/new" = render "invitations/new"

View file

@ -2,6 +2,6 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
%ul#stream %ul{:class => 'stream', :id => 'main_stream'}
- for post in posts - for post in posts
= render 'shared/stream_element', :post => post = render 'shared/stream_element', :post => post

View file

@ -16,6 +16,6 @@
= link_to t('.destroy'), @status_message, :confirm => t('are_you_sure'), :method => :delete = link_to t('.destroy'), @status_message, :confirm => t('are_you_sure'), :method => :delete
.span-9.last .span-9.last
#stream.show %div{:class => 'stream show', :id => 'status_message_stream'}
%li.message{:data=>{:guid=>@status_message.id}} %li.message{:data=>{:guid=>@status_message.id}}
= render "comments/comments", :post => @status_message = render "comments/comments", :post => @status_message

View file

@ -7,7 +7,7 @@
= t('.your_services') = t('.your_services')
.description .description
= t('.description') = t('.description')
%ul#stream %ul.stream#service_stream
- for service in @services - for service in @services
%h3 %h3
%b= service.provider %b= service.provider

View file

@ -17,7 +17,7 @@ When /^(.*) in the aspect list$/ do |action|
end end
Then /^I should see "([^\"]*)" in the main content area$/ do |stuff| Then /^I should see "([^\"]*)" in the main content area$/ do |stuff|
within("#stream") do within("#main_stream") do
Then "I should see #{stuff}" Then "I should see #{stuff}"
end end
end end

View file

@ -5,9 +5,9 @@
$(document).ready(function(){ $(document).ready(function(){
var $stream = $("#stream"); var $stream = $(".stream");
// expand all comments on page load // expand all comments on page load
$("#stream:not('.show')").find('.comments').each(function(index) { $(".stream:not('.show')").find('.comments').each(function(index) {
var comments = $(this); var comments = $(this);
if(comments.children("li").length > 1) { if(comments.children("li").length > 1) {
var show_comments_toggle = comments.closest("li").find(".show_post_comments"); var show_comments_toggle = comments.closest("li").find(".show_post_comments");
@ -32,7 +32,7 @@ $(document).ready(function(){
.closest("form").find(".comment_submit").fadeIn(200); .closest("form").find(".comment_submit").fadeIn(200);
}); });
$("#stream").delegate("textarea.comment_box", "blur", function(evt){ $(".stream").delegate("textarea.comment_box", "blur", function(evt){
var commentBox = $(this); var commentBox = $(this);
if( !commentBox.val() ) { if( !commentBox.val() ) {
commentBox.attr("rows", 1) commentBox.attr("rows", 1)

View file

@ -46,7 +46,7 @@ $(document).ready(function(){
} }
}); });
$("#stream").delegate("textarea.comment_box", "keydown", function(e){ $(".stream").delegate("textarea.comment_box", "keydown", function(e){
if (e.keyCode === 13) { if (e.keyCode === 13) {
$(this).closest("form").submit(); $(this).closest("form").submit();
} }
@ -72,8 +72,9 @@ $(document).ready(function(){
$(".person img", ".dropzone").tipsy({live:true}); $(".person img", ".dropzone").tipsy({live:true});
$(".avatar", ".aspects").tipsy({live:true}); $(".avatar", ".aspects").tipsy({live:true});
$('.webfinger_form').submit(function(){ $('.webfinger_form').submit(function(evt){
$('#loader').show(); form = $(evt.currentTarget);
form.siblings('.spinner').show();
$('#request_result li:first').hide(); $('#request_result li:first').hide();
}); });
});//end document ready });//end document ready

View file

@ -189,7 +189,7 @@ header
:margin :margin
:left 432px :left 432px
#stream .stream
:margin 0 :margin 0
:padding 0 :padding 0
> li > li
@ -488,7 +488,7 @@ form
:margin :margin
:right 1em :right 1em
#stream.show .stream.show
ul.comments ul.comments
:display block :display block
:margin :margin
@ -501,7 +501,7 @@ form
:background none :background none
:border none :border none
#stream ul.comments .stream ul.comments
:display none :display none
.avatar .avatar
@ -587,7 +587,7 @@ ul.comments
:bottom 1em :bottom 1em
#stream, #profile, .stream, #profile,
.comments .comments
img.person_picture img.person_picture