From 76ac8e1a9d0eb23a4c5b584febbf987192a68b1c Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 27 Apr 2015 06:51:29 +0530 Subject: [PATCH] Fix Retrospring/bugs#36 --- app/assets/javascripts/questionbox/destroy.coffee | 2 +- app/views/question/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/questionbox/destroy.coffee b/app/assets/javascripts/questionbox/destroy.coffee index edf69d68..63f590e5 100644 --- a/app/assets/javascripts/questionbox/destroy.coffee +++ b/app/assets/javascripts/questionbox/destroy.coffee @@ -20,7 +20,7 @@ $(document).on "click", "a[data-action=ab-question-destroy]", (ev) -> success: (data, status, jqxhr) -> if data.success if btn[0].dataset.redirect != undefined - window.location.href = btn[0].dataset.redirect + window.location.pathname = btn[0].dataset.redirect else $("div.answerbox[data-q-id=#{qid}], div.questionbox[data-id=#{qid}]").slideUp() showNotification data.message, data.success diff --git a/app/views/question/show.html.haml b/app/views/question/show.html.haml index 14e4bd6b..45b572b0 100644 --- a/app/views/question/show.html.haml +++ b/app/views/question/show.html.haml @@ -13,7 +13,7 @@ %ul.dropdown-menu.dropdown-menu-right{role: :menu} - if current_user.mod? or @question.user == current_user %li.text-danger - %a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: '/' }} + %a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: if @question.author_is_anonymous? then "/" else show_user_questions_path(@question.user.screen_name) end }} %i.fa.fa-trash-o Delete Question - unless @question.user == current_user