wiki pages: add undelete link in navbar.

Also redirect back to the wiki page after deleting or undeleting it,
rather than redirecting to the index.
This commit is contained in:
evazion
2019-11-06 15:08:59 -06:00
parent 70b6525e69
commit a92c24f093
3 changed files with 5 additions and 3 deletions

View File

@@ -16,8 +16,10 @@
<% if CurrentUser.is_member? %>
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %>
<% end %>
<% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %>
<%= subnav_link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this wiki page?" %>
<% if CurrentUser.is_builder? && @wiki_page.is_deleted? %>
<%= subnav_link_to "Undelete", wiki_page_path(@wiki_page.id), remote: true, method: :put, "data-params": "wiki_page[is_deleted]=false", "data-shortcut": "shift+d" %>
<% elsif CurrentUser.is_builder? && !@wiki_page.is_deleted? %>
<%= subnav_link_to "Delete", wiki_page_path(@wiki_page.id), remote: true, method: :put, "data-params": "wiki_page[is_deleted]=true", "data-shortcut": "shift+d" %>
<% end %>
<% elsif @wiki_page_version %>
<li>|</li>

View File

@@ -1 +0,0 @@
window.location.href = "/wiki_pages";

View File

@@ -0,0 +1 @@
location.reload();