summaryrefslogtreecommitdiff
path: root/app/controllers/nodes_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/nodes_controller.rb')
-rw-r--r--app/controllers/nodes_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 9ea66ad..021f8ff 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -144,7 +144,7 @@ class NodesController < ApplicationController
144 def trash 144 def trash
145 if @node.trash!(current_user) 145 if @node.trash!(current_user)
146 flash[:notice] = "Page has been moved to the Trash" 146 flash[:notice] = "Page has been moved to the Trash"
147 redirect_to node_path(Node.trash) 147 redirect_to trashed_nodes_path
148 else 148 else
149 flash[:notice] = "Page is already in the Trash" 149 flash[:notice] = "Page is already in the Trash"
150 redirect_to node_path(@node) 150 redirect_to node_path(@node)
@@ -170,7 +170,8 @@ class NodesController < ApplicationController
170 def destroy 170 def destroy
171 @node.destroy_from_trash!(current_user) 171 @node.destroy_from_trash!(current_user)
172 flash[:notice] = "Page has been permanently deleted" 172 flash[:notice] = "Page has been permanently deleted"
173 redirect_to node_path(Node.trash) 173 redirect_to trashed_nodes_path
174
174 rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotDestroyed => e 175 rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotDestroyed => e
175 flash[:error] = e.message 176 flash[:error] = e.message
176 redirect_to node_path(@node) 177 redirect_to node_path(@node)
@@ -247,6 +248,11 @@ class NodesController < ApplicationController
247 @sitemap_descendant_counts = descendant_counts_for(@sitemap) 248 @sitemap_descendant_counts = descendant_counts_for(@sitemap)
248 end 249 end
249 250
251 def trashed
252 @nodes = Node.trash.children.order(:slug)
253 .paginate(:page => params[:page], :per_page => 50)
254 end
255
250 private 256 private
251 257
252 def slug_for(title) 258 def slug_for(title)