Use a button to destroy poll question answer images
As mentioned in commits5311daadfandbb958daf0, using links combined with JavaScript to generate POST (or, in this case, DELETE) requests to the server has a few issues. Note that the AJAX response stopped working after replacing the link with a button. Not sure about the reason, but, since this is one of the very few places where we use AJAX calls to delete content, the easiest solution is to stop using AJAX and be consistent with what we do in the rest of the admin section.
This commit is contained in:
@@ -25,9 +25,8 @@ class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseContr
|
||||
def destroy
|
||||
@image.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render layout: false }
|
||||
end
|
||||
redirect_to admin_answer_images_path(@image.imageable),
|
||||
notice: t("flash.actions.destroy.poll_question_answer_image")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user