From b94b5240a8910db5acb8aeff26ccd76eab4988b0 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Thu, 15 Dec 2011 17:40:27 -0800 Subject: [PATCH] added block user functionality to the stream --- app/controllers/blocks_controller.rb | 14 ++++++++-- app/views/templates/comment.ujs | 5 +--- app/views/templates/stream_element.ujs | 20 +++++--------- public/javascripts/app/views/post_view.js | 26 ++++++++++++++++++- .../app/views/stream_object_view.js | 3 +-- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/app/controllers/blocks_controller.rb b/app/controllers/blocks_controller.rb index 1065bd103..7f7fa5891 100644 --- a/app/controllers/blocks_controller.rb +++ b/app/controllers/blocks_controller.rb @@ -1,6 +1,8 @@ class BlocksController < ApplicationController before_filter :authenticate_user! + respond_to :html, :json + def create block = current_user.blocks.new(params[:block]) @@ -10,7 +12,11 @@ class BlocksController < ApplicationController else notice = {:error => t('blocks.create.failure')} end - redirect_to :back, notice + + respond_with do |format| + format.html{ redirect_to :back, notice } + format.json{ render :nothing => true, :status => 204 } + end end def destroy @@ -19,7 +25,11 @@ class BlocksController < ApplicationController else notice = {:error => t('blocks.destroy.failure')} end - redirect_to :back, notice + + respond_with do |format| + format.html{ redirect_to :back, notice } + format.json{ render :nothing => true, :status => 204 } + end end protected diff --git a/app/views/templates/comment.ujs b/app/views/templates/comment.ujs index 54062b689..cb5e281f8 100644 --- a/app/views/templates/comment.ujs +++ b/app/views/templates/comment.ujs @@ -2,10 +2,7 @@
<% if(author.id === current_user.id) { %> - - - Deletelabel - + Deletelabel <% } %>
diff --git a/app/views/templates/stream_element.ujs b/app/views/templates/stream_element.ujs index 3d63acb48..1ad9f5991 100644 --- a/app/views/templates/stream_element.ujs +++ b/app/views/templates/stream_element.ujs @@ -1,23 +1,16 @@
- <% if(author.id != current_user.id) { %> - - Ignoreuser - + Ignoreuser <% } %> - - - - - +
- +
@@ -80,8 +73,7 @@ <% if(public && author.id != current_user.id) { %> <% if(root) { var rootGuid = root.guid; - } - else { + } else { var rootGuid = guid; } %> @@ -98,8 +90,8 @@