Commit 3f7144f2 authored by danielgrippi's avatar danielgrippi Committed by Dennis Collinson

added hide post feature back to stream

parent 24950bd3
......@@ -20,7 +20,7 @@ class ShareVisibilitiesController < ApplicationController
@vis.hidden = !@vis.hidden
if @vis.save
update_cache(@vis)
render 'update'
render :nothing => true, :status => 200
return
end
end
......
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) { %>
<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/deletelabel.png" class="delete control_icon hide_post" title="<%= Diaspora.I18n.t('stream.hide') %>" />
</a>
<% } else { %>
<a href="#" rel=nofollow>
......
......@@ -70,6 +70,7 @@ en:
wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..."
stream:
hide: "Hide"
public: "Public"
limited: "Limited"
like: "Like"
......
......@@ -8,6 +8,7 @@ app.views.Post = app.views.StreamObject.extend({
"click .focus_comment_textarea": "focusCommentTextarea",
"click .shield a": "removeNsfwShield",
"click .remove_post": "destroyModel",
"click .hide_post": "hidePost",
"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){
evt.preventDefault();
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 }
this.model.destroy();
this.slideAndRemove();
},
slideAndRemove : function(){
$(this.el).slideUp(400, function(){
$(this).remove();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment