Moved live() bindings for post hide icon from Stream.initialize to Stream.initializeLives
This commit is contained in:
parent
9fd4432e5a
commit
59ba3f85e6
2 changed files with 10 additions and 11 deletions
|
|
@ -24,7 +24,6 @@ var Stream = {
|
|||
|
||||
Diaspora.page.subscribe("stream/scrolled", Stream.collapseText);
|
||||
Stream.collapseText('eventID', $(Stream.selector)[0]);
|
||||
Stream.bindHideIcon();
|
||||
},
|
||||
collapseText: function(){
|
||||
elements = $(Array.prototype.slice.call(arguments,1));
|
||||
|
|
@ -58,6 +57,15 @@ var Stream = {
|
|||
}
|
||||
});
|
||||
|
||||
// ajax-loader and hide icon visibility handling for post hide and unhide
|
||||
$("a.stream_element_delete.vis_hide").live("click", function(evt){
|
||||
$(this).toggleClass("hidden");
|
||||
$(this).next("img.hide_loader").toggleClass("hidden");
|
||||
});
|
||||
$("a.stream_element_hide_undo").live("click", function(evt){
|
||||
$(this).closest('.stream_element').find("img.hide_loader").toggleClass("hidden");
|
||||
});
|
||||
|
||||
// this.setUpComments();
|
||||
},
|
||||
|
||||
|
|
@ -148,15 +156,6 @@ var Stream = {
|
|||
}
|
||||
},
|
||||
|
||||
bindHideIcon: function(){
|
||||
$("a.stream_element_delete.vis_hide").live("click", function(evt){
|
||||
$(this).toggleClass("hidden");
|
||||
$(this).next("img.hide_loader").toggleClass("hidden");
|
||||
});
|
||||
$("a.stream_element_hide_undo").live("click", function(evt){
|
||||
$(this).closest('.stream_element').find("img.hide_loader").toggleClass("hidden");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe("Stream", function() {
|
|||
|
||||
describe("streamElement", function() {
|
||||
it("makes sure that ajax spinner appears when hiding a post", function() {
|
||||
Stream.bindHideIcon();
|
||||
Stream.initializeLives();
|
||||
link = $("a.stream_element_delete.vis_hide");
|
||||
spinner = link.next("img.hide_loader");
|
||||
expect(link).not.toHaveClass("hidden");
|
||||
|
|
|
|||
Loading…
Reference in a new issue