From 9e3f29257ffae63bffe4fb2023c7090cfe4a73fe Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 9 Aug 2009 12:42:53 +0200 Subject: editing menu items now works to. also some minor changes --- app/controllers/menu_items_controller.rb | 8 ++++++++ app/views/menu_items/edit.html.erb | 34 ++++++++++++++++++++++++++++++-- app/views/menu_items/index.html.erb | 9 ++++++--- 3 files changed, 46 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb index 0ba56c3..7b71693 100644 --- a/app/controllers/menu_items_controller.rb +++ b/app/controllers/menu_items_controller.rb @@ -22,9 +22,17 @@ class MenuItemsController < ApplicationController end def edit + @menu_item = MenuItem.find( params[:id] ) end def update + @menu_item = MenuItem.find( params[:id] ) + + if @menu_item.update_attributes( params[:menu_item] ) + redirect_to menu_items_path + else + render :edit + end end def delete diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb index 0720571..9ea0fcc 100644 --- a/app/views/menu_items/edit.html.erb +++ b/app/views/menu_items/edit.html.erb @@ -1,2 +1,32 @@ -

MenuItems#edit

-

Find me in app/views/menu_items/edit.html.erb

+

Edit Menu Item

+ +<% form_for @menu_item do |f| %> + + + + + + + + + + + + + + + + + + + + + + +
Search + <%= text_field_tag :menu_search_term %> +
+ +
+
Node Id<%= f.text_field :node_id %>
Path<%= f.text_field :path %>
Title<%= f.text_field :title %>
<%= f.submit 'Update' %>
+<% end %> \ No newline at end of file diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb index db4a771..00a9b05 100644 --- a/app/views/menu_items/index.html.erb +++ b/app/views/menu_items/index.html.erb @@ -5,8 +5,11 @@

Menu Items

-