Show ajax loader and hide the hide icon when hiding a post.
This commit is contained in:
parent
1b5698c1f5
commit
50f32ce5ac
3 changed files with 24 additions and 7 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
var target = $("#<%= @post.guid %>")
|
var target = $("#<%= @post.guid %>")
|
||||||
target.find(".sm_body").toggleClass("hidden");
|
target.find(".sm_body").toggleClass("hidden");
|
||||||
target.find(".undo_text").toggleClass("hidden");
|
target.find(".undo_text").toggleClass("hidden");
|
||||||
|
target.find(".hide_loader").toggleClass("hidden");
|
||||||
|
|
||||||
|
var hide_icon = target.find(".stream_element_delete")
|
||||||
|
if (target.find(".undo_text").hasClass("hidden")) {
|
||||||
|
hide_icon.toggleClass("hidden");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@
|
||||||
|
|
||||||
|
|
||||||
.stream_element{:id => post.guid}
|
.stream_element{:id => post.guid}
|
||||||
- if user_signed_in?
|
.right.controls
|
||||||
- if post.author.owner_id == current_user.id
|
- if current_user && post.author.owner_id == current_user.id
|
||||||
.right.controls
|
= link_to image_tag('deletelabel.png'), post_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete stream_element_delete", :title => t('delete')
|
||||||
= link_to image_tag('deletelabel.png'), post_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete stream_element_delete", :title => t('delete')
|
|
||||||
- else
|
- else
|
||||||
.right.controls
|
= link_to image_tag('deletelabel.png'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete vis_hide", :title => t('hide')
|
||||||
= link_to image_tag('deletelabel.png'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete", :title => t('hide')
|
= image_tag 'ajax-loader.gif', :class => "hide_loader hidden"
|
||||||
|
|
||||||
.undo_text.hidden
|
.undo_text.hidden
|
||||||
= t('post_visibilites.update.post_hidden', :name => post.author.name)
|
= t('post_visibilites.update.post_hidden', :name => post.author.name)
|
||||||
= link_to t('undo'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete"
|
= link_to t('undo'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_hide_undo"
|
||||||
|
|
||||||
.sm_body
|
.sm_body
|
||||||
= person_image_link(post.author, :size => :thumb_small)
|
= person_image_link(post.author, :size => :thumb_small)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ var Stream = {
|
||||||
|
|
||||||
Diaspora.widgets.subscribe("stream/scrolled", Stream.collapseText);
|
Diaspora.widgets.subscribe("stream/scrolled", Stream.collapseText);
|
||||||
Stream.collapseText('eventID', $(Stream.selector)[0]);
|
Stream.collapseText('eventID', $(Stream.selector)[0]);
|
||||||
|
Stream.bindHideIcon();
|
||||||
},
|
},
|
||||||
collapseText: function(){
|
collapseText: function(){
|
||||||
elements = $(Array.prototype.slice.call(arguments,1));
|
elements = $(Array.prototype.slice.call(arguments,1));
|
||||||
|
|
@ -188,6 +189,16 @@ var Stream = {
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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){
|
||||||
|
$("img.hide_loader").toggleClass("hidden");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue