chore: update buttons to PUT data when deleting/undeleting story

This commit is contained in:
lvancraen 2021-12-06 13:12:26 -05:00 committed by Peter Bhat Harkins
parent 4778cd5673
commit 04982be4bb
2 changed files with 7 additions and 11 deletions

View File

@ -45,20 +45,15 @@
<% if @story.is_gone? && @story.is_undeletable_by_user?(@user) %>
&nbsp; | &nbsp;
<%= link_to "Undelete", story_undelete_path(@story.short_id),
:method => :post, :data => {
:confirm => "Are you sure you want to undelete this story?" },
:class => "button" %>
<%= f.submit "Undelete", formaction: story_undelete_path(@story.short_id),
:data => { :confirm => "Are you sure you want to undelete this story?" } %>
<% elsif !@story.is_gone? %>
&nbsp; | &nbsp;
<% if @story.user_id != @user.id && @user.is_moderator? %>
<%= link_to "Delete", story_path(@story.short_id),
:method => :delete, :class => "button mod_story_link deletion" %>
<%= f.submit "Delete", formaction: story_destroy_path(@story.short_id), :class => "deletion" %>
<% else %>
<%= link_to "Delete", story_path(@story.short_id),
:method => :delete, :data => {
:confirm => "Are you sure you want to delete this story?" },
:class => "button" %>
<%= f.submit "Delete", formaction: story_destroy_path(@story.short_id),
:class => "deletion", :data => { :confirm => "Are you sure you want to delete this story?" } %>
<% end %>
<% end %>

View File

@ -78,7 +78,8 @@ Rails.application.routes.draw do
post "upvote"
post "flag"
post "unvote"
post "undelete"
put "destroy"
put "undelete"
post "hide"
post "unhide"
post "save"