summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-02-21 14:38:14 +0100
committerhukl <contact@smyck.org>2009-02-21 14:38:14 +0100
commit4c3d622b3795836e1e7be4df303ee256a88b2812 (patch)
treee644596d27e4943477a76ab516ed50a1d63a2ab2
parent6eb546b6cbd2fa39d2663ab83b44fbde10507d70 (diff)
adding @node filter for publish action and setting
a new member route for the nodes resource so that a put request on /nodes/id/publish will publish the current draft of a node
-rw-r--r--app/controllers/nodes_controller.rb9
-rw-r--r--app/views/nodes/edit.html.erb2
-rw-r--r--config/routes.rb2
3 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 1515fdf..6d400bc 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -2,7 +2,14 @@ class NodesController < ApplicationController
2 2
3 layout 'admin' 3 layout 'admin'
4 before_filter :login_required 4 before_filter :login_required
5 before_filter :find_node, :only => [:create, :show, :edit, :update, :destroy] 5 before_filter :find_node, :only => [
6 :create,
7 :show,
8 :edit,
9 :update,
10 :destroy,
11 :publish
12 ]
6 13
7 def index 14 def index
8 @nodes = Node.root.descendants.paginate( 15 @nodes = Node.root.descendants.paginate(
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb
index 6848dfb..f457bc7 100644
--- a/app/views/nodes/edit.html.erb
+++ b/app/views/nodes/edit.html.erb
@@ -1,5 +1,7 @@
1<h1>Nodes#edit</h1> 1<h1>Nodes#edit</h1>
2 2
3<%= link_to 'Publish', publish_node_path, :method => :put %>
4
3<h1>Editing page</h1> 5<h1>Editing page</h1>
4 6
5<%= I18n.locale %> 7<%= I18n.locale %>
diff --git a/config/routes.rb b/config/routes.rb
index 6365186..ff9a13b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,7 +2,7 @@ ActionController::Routing::Routes.draw do |map|
2 map.filter :locale 2 map.filter :locale
3 3
4 map.resources :pages 4 map.resources :pages
5 map.resources :nodes 5 map.resources :nodes, :member => {:publish => :put}
6 6
7 map.logout '/logout', :controller => 'sessions', :action => 'destroy' 7 map.logout '/logout', :controller => 'sessions', :action => 'destroy'
8 map.login '/login', :controller => 'sessions', :action => 'new' 8 map.login '/login', :controller => 'sessions', :action => 'new'