summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/content_controller.rb5
-rw-r--r--app/helpers/content_helper.rb2
-rw-r--r--app/views/content/render_page.html.erb2
-rw-r--r--config/routes.rb42
-rw-r--r--doc/README_FOR_APP11
-rw-r--r--test/functional/content_controller_test.rb21
-rw-r--r--test/unit/helpers/content_helper_test.rb4
7 files changed, 47 insertions, 40 deletions
diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb
new file mode 100644
index 0000000..afa093c
--- /dev/null
+++ b/app/controllers/content_controller.rb
@@ -0,0 +1,5 @@
1class ContentController < ApplicationController
2 def render_page
3 end
4
5end
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
new file mode 100644
index 0000000..3199604
--- /dev/null
+++ b/app/helpers/content_helper.rb
@@ -0,0 +1,2 @@
1module ContentHelper
2end
diff --git a/app/views/content/render_page.html.erb b/app/views/content/render_page.html.erb
new file mode 100644
index 0000000..af7ef88
--- /dev/null
+++ b/app/views/content/render_page.html.erb
@@ -0,0 +1,2 @@
1<h1>Content#render_page</h1>
2<p>Find me in app/views/content/render_page.html.erb</p>
diff --git a/config/routes.rb b/config/routes.rb
index 4f3d9d2..cbad5cc 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,43 +1,9 @@
1ActionController::Routing::Routes.draw do |map| 1ActionController::Routing::Routes.draw do |map|
2 # The priority is based upon order of creation: first created -> highest priority.
3
4 # Sample of regular route:
5 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6 # Keep in mind you can assign values other than :controller and :action
7
8 # Sample of named route:
9 # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10 # This route can be invoked with purchase_url(:id => product.id)
11
12 # Sample resource route (maps HTTP verbs to controller actions automatically):
13 # map.resources :products
14
15 # Sample resource route with options:
16 # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
18 # Sample resource route with sub-resources:
19 # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20 2
21 # Sample resource route with more complex sub-resources 3 map.connect ':language/*pagepath',
22 # map.resources :products do |products| 4 :controller => 'content', :action => 'render_page',
23 # products.resources :comments 5 :requirements => {:language => /\w{2}/}
24 # products.resources :sales, :collection => { :recent => :get } 6
25 # end
26
27 # Sample resource route within a namespace:
28 # map.namespace :admin do |admin|
29 # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30 # admin.resources :products
31 # end
32
33 # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34 # map.root :controller => "welcome"
35
36 # See how all your routes lay out with "rake routes"
37
38 # Install the default routes as the lowest priority.
39 # Note: These default routes make all actions in every controller accessible via GET requests. You should
40 # consider removing the them or commenting them out if you're using named routes and resources.
41 map.connect ':controller/:action/:id' 7 map.connect ':controller/:action/:id'
42 map.connect ':controller/:action/:id.:format' 8 map.connect ':controller/:action/:id.:format'
43end 9end
diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP
index fe41f5c..acd2d3f 100644
--- a/doc/README_FOR_APP
+++ b/doc/README_FOR_APP
@@ -1,2 +1,9 @@
1Use this README file to introduce your application and point to useful places in the API for learning more. 1CCCMS
2Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 2
3
4The basic structure of the cccms is built from Nodes. Nodes live within a
5nested set. When a arbitrary url is entered it is dispatched to the
6ContentController action render_page. Based on the url parameters the
7render_page action retrieves the corresponding Node from the database. Rather
8than walking through the tree of the nested set to find the node, the Node is
9retrieved directly by its unique_name which matches the url parameters. \ No newline at end of file
diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb
new file mode 100644
index 0000000..c44b221
--- /dev/null
+++ b/test/functional/content_controller_test.rb
@@ -0,0 +1,21 @@
1require 'test_helper'
2
3class ContentControllerTest < ActionController::TestCase
4
5 def test_custom_page_route
6 assert_recognizes({ :controller => 'content', :action => 'render_page', :language => 'de', :pagepath => ['foo', 'bar'] }, '/de/foo/bar')
7 assert_recognizes({ :controller => 'content', :action => 'render_page', :language => 'en', :pagepath => ['home'] }, '/en/home')
8 end
9
10 # def test_rendering_a_page
11 # Page.destroy_all
12 # load_atp 'content_controller'
13 # Page.all.each {|x| x.update_unique_name; x.save}
14 # assert Page.valid?
15 # assert_not_nil Page.find_by_title("short name yo")
16 # get :render_page, :language => 'de', :pagepath => ["shortname","barfoo"]
17 # assert_response :success
18 # assert_template 'wtp_eins'
19 # assert_equal "page_templates/layouts/screen", @response.layout
20 # end
21end
diff --git a/test/unit/helpers/content_helper_test.rb b/test/unit/helpers/content_helper_test.rb
new file mode 100644
index 0000000..2da82d7
--- /dev/null
+++ b/test/unit/helpers/content_helper_test.rb
@@ -0,0 +1,4 @@
1require 'test_helper'
2
3class ContentHelperTest < ActionView::TestCase
4end