diff --git a/app/views/artists/_secondary_links.html.erb b/app/views/artists/_secondary_links.html.erb index 8093e374e..c09aa9280 100644 --- a/app/views/artists/_secondary_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -15,7 +15,7 @@ <%= subnav_link_to "Edit", edit_artist_path(@artist), :"data-shortcut" => "e" %> <% end %> <%= subnav_link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %> - <% if policy(@artist).update? %> + <% if current_page?(action: "edit") && policy(@artist).update? %> <% if @artist.is_deleted? %> <%= subnav_link_to "Undelete", artist_path(@artist, format: "js"), method: :put, data: {confirm: "Are you sure you want to undelete this artist?", params: "artist[is_deleted]=false"}, remote: true %> <% else %> diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 49f2577e1..4ba542b68 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -32,12 +32,6 @@ <% t.column column: "control" do |artist| %> <% if policy(artist).update? %> <%= link_to "Edit", edit_artist_path(artist) %> - - <% if artist.is_deleted? %> - | <%= link_to "Undelete", artist_path(artist, artist: { is_deleted: false }), method: :put, remote: true %> - <% else %> - | <%= link_to "Delete", artist_path(artist, artist: { is_deleted: true }), method: :put, remote: true %> - <% end %> <% end %> <% end %> <% end %> diff --git a/app/views/pools/_secondary_links.html.erb b/app/views/pools/_secondary_links.html.erb index 618c9070e..4a6b77711 100644 --- a/app/views/pools/_secondary_links.html.erb +++ b/app/views/pools/_secondary_links.html.erb @@ -13,10 +13,12 @@ <% if policy(@pool).update? %> <%= subnav_link_to "Edit", edit_pool_path(@pool), "data-shortcut": "e" %> <% end %> - <% if policy(@pool).undelete? %> - <%= subnav_link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %> - <% elsif policy(@pool).destroy? %> - <%= subnav_link_to "Delete", pool_path(@pool), :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this pool?", :remote => true %> + <% if current_page?(action: :edit) %> + <% if policy(@pool).undelete? %> + <%= subnav_link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %> + <% elsif policy(@pool).destroy? %> + <%= subnav_link_to "Delete", pool_path(@pool), :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this pool?", :remote => true %> + <% end %> <% end %> <% if PoolVersion.enabled? %> <%= subnav_link_to "History", pool_versions_path(:search => {:pool_id => @pool.id}) %> diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb index 276591965..683438372 100644 --- a/app/views/wiki_pages/_secondary_links.html.erb +++ b/app/views/wiki_pages/_secondary_links.html.erb @@ -16,10 +16,12 @@ <% if policy(@wiki_page).edit? %> <%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %> - <% if @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", "data-confirm": "Are you sure you want to undelete this wiki?" %> - <% else %> - <%= 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", "data-confirm": "Are you sure you want to delete this wiki?" %> + <% if current_page?(action: :edit) %> + <% if @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", "data-confirm": "Are you sure you want to undelete this wiki?" %> + <% else %> + <%= 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", "data-confirm": "Are you sure you want to delete this wiki?" %> + <% end %> <% end %> <% end %> <% elsif @wiki_page_version %>