diff --git a/app/controllers/page/trash_controller.rb b/app/controllers/page/trash_controller.rb index 9afdb02f927e914d39f10bc38fbd75f31ed630ba..e23ce32c6a79b6480e807b5ad7d9f9f830bf5d43 100644 --- a/app/controllers/page/trash_controller.rb +++ b/app/controllers/page/trash_controller.rb @@ -14,6 +14,11 @@ class Page::TrashController < Page::SidebarsController end end + def destroy + @page.destroy + redirect_to me_home_path + end + protected def track_action diff --git a/app/helpers/page/sidebar_helper.rb b/app/helpers/page/sidebar_helper.rb index 22d3437e0879917f3500869700a97425c58051de..e888622e6aa77cbaa3ef6982dbdbe5d64ab387d6 100644 --- a/app/helpers/page/sidebar_helper.rb +++ b/app/helpers/page/sidebar_helper.rb @@ -134,9 +134,9 @@ module Page::SidebarHelper def destroy_line if may_admin_page? content_tag :li do - link_to(:destroy_page_via_shred.t, page_trash_path(@page, type: 'destroy'), + link_to(:destroy_page_via_shred.t, page_trash_path(@page), remote: true, - method: 'put', + method: 'delete', icon: 'minus', confirm: :destroy_confirmation.t(thing: :page.t)) end diff --git a/config/routes.rb b/config/routes.rb index f988d2d8a1cb287601b56d7dcd268b3fed8e3281..37d8afe47aed1a9299daa5c56d99866aa2afc17f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -197,7 +197,7 @@ Crabgrass::Application.routes.draw do resource :history, only: [:show], controller: 'history' resource :attributes, only: [:update] resource :title, only: %i[edit update], controller: 'title' - resource :trash, only: %i[edit update], controller: 'trash' + resource :trash, only: %i[edit update destroy], controller: 'trash' end resources :posts, only: [] do |_posts|