diff options
| author | hukl <contact@smyck.org> | 2009-08-09 12:42:53 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-08-09 12:42:53 +0200 |
| commit | 9e3f29257ffae63bffe4fb2023c7090cfe4a73fe (patch) | |
| tree | 687187db9cb575045a56332899dc4688eeb52356 /app | |
| parent | 4867b66ee84055a70fb3395634ae848a4a072668 (diff) | |
editing menu items now works to. also some minor changes
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/menu_items_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/menu_items/edit.html.erb | 34 | ||||
| -rw-r--r-- | app/views/menu_items/index.html.erb | 9 |
3 files changed, 46 insertions, 5 deletions
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 | |||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | def edit | 24 | def edit |
| 25 | @menu_item = MenuItem.find( params[:id] ) | ||
| 25 | end | 26 | end |
| 26 | 27 | ||
| 27 | def update | 28 | def update |
| 29 | @menu_item = MenuItem.find( params[:id] ) | ||
| 30 | |||
| 31 | if @menu_item.update_attributes( params[:menu_item] ) | ||
| 32 | redirect_to menu_items_path | ||
| 33 | else | ||
| 34 | render :edit | ||
| 35 | end | ||
| 28 | end | 36 | end |
| 29 | 37 | ||
| 30 | def delete | 38 | 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 @@ | |||
| 1 | <h1>MenuItems#edit</h1> | 1 | <h1>Edit Menu Item</h1> |
| 2 | <p>Find me in app/views/menu_items/edit.html.erb</p> | 2 | |
| 3 | <% form_for @menu_item do |f| %> | ||
| 4 | <table> | ||
| 5 | |||
| 6 | <tr> | ||
| 7 | <td class="description">Search</td> | ||
| 8 | <td> | ||
| 9 | <%= text_field_tag :menu_search_term %> | ||
| 10 | <div id="search_results"> | ||
| 11 | |||
| 12 | </div> | ||
| 13 | </td> | ||
| 14 | </tr> | ||
| 15 | <tr> | ||
| 16 | <td class="description">Node Id</td> | ||
| 17 | <td><%= f.text_field :node_id %></td> | ||
| 18 | </tr> | ||
| 19 | <tr> | ||
| 20 | <td class="description">Path</td> | ||
| 21 | <td><%= f.text_field :path %></td> | ||
| 22 | </tr> | ||
| 23 | <tr> | ||
| 24 | <td class="description">Title</td> | ||
| 25 | <td><%= f.text_field :title %></td> | ||
| 26 | </tr> | ||
| 27 | <tr> | ||
| 28 | <td></td> | ||
| 29 | <td class="right"><%= f.submit 'Update' %></td> | ||
| 30 | </tr> | ||
| 31 | </table> | ||
| 32 | <% 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 @@ | |||
| 5 | 5 | ||
| 6 | <h1>Menu Items</h1> | 6 | <h1>Menu Items</h1> |
| 7 | 7 | ||
| 8 | <ul> | 8 | <table> |
| 9 | <% @menu_items.each do |menu_item| %> | 9 | <% @menu_items.each do |menu_item| %> |
| 10 | <li><%= menu_item.title %></li> | 10 | <tr> |
| 11 | <td><%= menu_item.title %></td> | ||
| 12 | <td><%= link_to "Edit", edit_menu_item_path(menu_item) %></td> | ||
| 13 | </tr> | ||
| 11 | <% end %> | 14 | <% end %> |
| 12 | </ul> \ No newline at end of file | 15 | </table> \ No newline at end of file |
