added hide post feature back to stream
This commit is contained in:
parent
24950bd364
commit
3f7144f214
6 changed files with 22 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ class ShareVisibilitiesController < ApplicationController
|
||||||
@vis.hidden = !@vis.hidden
|
@vis.hidden = !@vis.hidden
|
||||||
if @vis.save
|
if @vis.save
|
||||||
update_cache(@vis)
|
update_cache(@vis)
|
||||||
render 'update'
|
render :nothing => true, :status => 200
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
var target = $("#<%= @post.guid %>")
|
|
||||||
target.find(".sm_body").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");
|
|
||||||
target.find(".hide_loader").toggleClass("hidden");
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
<% if(author.id != current_user.id) { %>
|
<% if(author.id != current_user.id) { %>
|
||||||
<a href="#" rel=nofollow>
|
<a href="#" rel=nofollow>
|
||||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "<%= Diaspora.I18n.t('ignore') %>" />
|
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "<%= Diaspora.I18n.t('ignore') %>" />
|
||||||
|
<img src="/images/deletelabel.png" class="delete control_icon hide_post" title="<%= Diaspora.I18n.t('stream.hide') %>" />
|
||||||
</a>
|
</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href="#" rel=nofollow>
|
<a href="#" rel=nofollow>
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ en:
|
||||||
wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..."
|
wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..."
|
||||||
|
|
||||||
stream:
|
stream:
|
||||||
|
hide: "Hide"
|
||||||
public: "Public"
|
public: "Public"
|
||||||
limited: "Limited"
|
limited: "Limited"
|
||||||
like: "Like"
|
like: "Like"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
"click .focus_comment_textarea": "focusCommentTextarea",
|
"click .focus_comment_textarea": "focusCommentTextarea",
|
||||||
"click .shield a": "removeNsfwShield",
|
"click .shield a": "removeNsfwShield",
|
||||||
"click .remove_post": "destroyModel",
|
"click .remove_post": "destroyModel",
|
||||||
|
"click .hide_post": "hidePost",
|
||||||
"click .block_user": "blockUser"
|
"click .block_user": "blockUser"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -90,6 +91,21 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hidePost : function(evt) {
|
||||||
|
if(evt) { evt.preventDefault(); }
|
||||||
|
if(!confirm(Diaspora.I18n.t('confirm_dialog'))) { return }
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url : "/share_visibilities/42",
|
||||||
|
type : "PUT",
|
||||||
|
data : {
|
||||||
|
post_id : this.model.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.slideAndRemove();
|
||||||
|
},
|
||||||
|
|
||||||
focusCommentTextarea: function(evt){
|
focusCommentTextarea: function(evt){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
this.$(".new_comment_form_wrapper").removeClass("hidden");
|
this.$(".new_comment_form_wrapper").removeClass("hidden");
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ app.views.StreamObject = app.views.Base.extend({
|
||||||
if(!confirm(Diaspora.I18n.t("confirm_dialog"))) { return }
|
if(!confirm(Diaspora.I18n.t("confirm_dialog"))) { return }
|
||||||
|
|
||||||
this.model.destroy();
|
this.model.destroy();
|
||||||
|
this.slideAndRemove();
|
||||||
|
},
|
||||||
|
|
||||||
|
slideAndRemove : function(){
|
||||||
$(this.el).slideUp(400, function(){
|
$(this.el).slideUp(400, function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue