summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-08-08 15:38:20 +0200
committerhukl <contact@smyck.org>2009-08-08 15:38:20 +0200
commit8345fb8001e82b145b9ce4c8558d4d4712ebad60 (patch)
tree31f101301238e1f9f5661941f747029730d6e200
parent397bee72fa5bccf64d09eeb77b5ee0000aabfdb4 (diff)
added menu items resource
-rw-r--r--app/controllers/menu_items_controller.rb27
-rw-r--r--app/helpers/menu_items_helper.rb2
-rw-r--r--app/views/admin/_menu.html.erb3
-rw-r--r--app/views/menu_items/create.html.erb2
-rw-r--r--app/views/menu_items/delete.html.erb2
-rw-r--r--app/views/menu_items/edit.html.erb2
-rw-r--r--app/views/menu_items/index.html.erb7
-rw-r--r--app/views/menu_items/new.html.erb2
-rw-r--r--app/views/menu_items/show.html.erb2
-rw-r--r--app/views/menu_items/update.html.erb2
-rw-r--r--config/routes.rb1
-rw-r--r--test/functional/menu_items_controller_test.rb8
-rw-r--r--test/unit/helpers/menu_items_helper_test.rb4
13 files changed, 63 insertions, 1 deletions
diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb
new file mode 100644
index 0000000..1ac3ddb
--- /dev/null
+++ b/app/controllers/menu_items_controller.rb
@@ -0,0 +1,27 @@
1class MenuItemsController < ApplicationController
2
3 layout 'admin'
4
5 def index
6 @menu_items = MenuItem.all
7 end
8
9 def show
10 end
11
12 def new
13 end
14
15 def create
16 end
17
18 def edit
19 end
20
21 def update
22 end
23
24 def delete
25 end
26
27end
diff --git a/app/helpers/menu_items_helper.rb b/app/helpers/menu_items_helper.rb
new file mode 100644
index 0000000..f3d4e7f
--- /dev/null
+++ b/app/helpers/menu_items_helper.rb
@@ -0,0 +1,2 @@
1module MenuItemsHelper
2end
diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb
index 5ae4307..0eaeb0b 100644
--- a/app/views/admin/_menu.html.erb
+++ b/app/views/admin/_menu.html.erb
@@ -3,4 +3,5 @@
3<%= link_to 'Overview', :controller => :admin, :action => 'index' %> 3<%= link_to 'Overview', :controller => :admin, :action => 'index' %>
4<%= link_to 'Nodes', nodes_path, selected?('nodes') %> 4<%= link_to 'Nodes', nodes_path, selected?('nodes') %>
5<%= link_to 'Assets', assets_path, selected?('assets') %> 5<%= link_to 'Assets', assets_path, selected?('assets') %>
6<%= link_to 'User', users_path, selected?('users') %> &gt; \ No newline at end of file 6<%= link_to 'User', users_path, selected?('users') %>
7<%= link_to 'Navigation', menu_items_path, selected?('menu_items') %> &gt; \ No newline at end of file
diff --git a/app/views/menu_items/create.html.erb b/app/views/menu_items/create.html.erb
new file mode 100644
index 0000000..023f7b9
--- /dev/null
+++ b/app/views/menu_items/create.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#create</h1>
2<p>Find me in app/views/menu_items/create.html.erb</p>
diff --git a/app/views/menu_items/delete.html.erb b/app/views/menu_items/delete.html.erb
new file mode 100644
index 0000000..762b16e
--- /dev/null
+++ b/app/views/menu_items/delete.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#delete</h1>
2<p>Find me in app/views/menu_items/delete.html.erb</p>
diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb
new file mode 100644
index 0000000..0720571
--- /dev/null
+++ b/app/views/menu_items/edit.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#edit</h1>
2<p>Find me in app/views/menu_items/edit.html.erb</p>
diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb
new file mode 100644
index 0000000..05cc530
--- /dev/null
+++ b/app/views/menu_items/index.html.erb
@@ -0,0 +1,7 @@
1<h1>Menu Items</h1>
2
3<ul>
4 <% @menu_items.each do |menu_item| %>
5 <li><%= menu_item.title %></li>
6 <% end %>
7</ul> \ No newline at end of file
diff --git a/app/views/menu_items/new.html.erb b/app/views/menu_items/new.html.erb
new file mode 100644
index 0000000..e3f800e
--- /dev/null
+++ b/app/views/menu_items/new.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#new</h1>
2<p>Find me in app/views/menu_items/new.html.erb</p>
diff --git a/app/views/menu_items/show.html.erb b/app/views/menu_items/show.html.erb
new file mode 100644
index 0000000..65f9ef1
--- /dev/null
+++ b/app/views/menu_items/show.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#show</h1>
2<p>Find me in app/views/menu_items/show.html.erb</p>
diff --git a/app/views/menu_items/update.html.erb b/app/views/menu_items/update.html.erb
new file mode 100644
index 0000000..3df2a43
--- /dev/null
+++ b/app/views/menu_items/update.html.erb
@@ -0,0 +1,2 @@
1<h1>MenuItems#update</h1>
2<p>Find me in app/views/menu_items/update.html.erb</p>
diff --git a/config/routes.rb b/config/routes.rb
index 0f27d27..7b204a1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -19,6 +19,7 @@ ActionController::Routing::Routes.draw do |map|
19 map.login '/login', :controller => 'sessions', :action => 'new' 19 map.login '/login', :controller => 'sessions', :action => 'new'
20 map.admin_search 'admin/search', :controller => 'admin', :action => 'search' 20 map.admin_search 'admin/search', :controller => 'admin', :action => 'search'
21 map.resources :users 21 map.resources :users
22 map.resources :menu_items
22 map.resource :session 23 map.resource :session
23 24
24 map.connect ':controller/:action/:id' 25 map.connect ':controller/:action/:id'
diff --git a/test/functional/menu_items_controller_test.rb b/test/functional/menu_items_controller_test.rb
new file mode 100644
index 0000000..c47467a
--- /dev/null
+++ b/test/functional/menu_items_controller_test.rb
@@ -0,0 +1,8 @@
1require 'test_helper'
2
3class MenuItemsControllerTest < ActionController::TestCase
4 # Replace this with your real tests.
5 test "the truth" do
6 assert true
7 end
8end
diff --git a/test/unit/helpers/menu_items_helper_test.rb b/test/unit/helpers/menu_items_helper_test.rb
new file mode 100644
index 0000000..8919dfd
--- /dev/null
+++ b/test/unit/helpers/menu_items_helper_test.rb
@@ -0,0 +1,4 @@
1require 'test_helper'
2
3class MenuItemsHelperTest < ActionView::TestCase
4end