diff options
| author | hukl <contact@smyck.org> | 2009-07-19 18:40:07 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-07-19 18:40:07 +0200 |
| commit | 0d8879354fbd251e4509a0ab5c6b6e47aa3fa47d (patch) | |
| tree | 0009e7a848b47a856527d70701105523d72e6787 | |
| parent | 00362bb4817ecc82856e9a9ae5fb6821b3182c6f (diff) | |
fixed link_for_path issue
| -rw-r--r-- | app/helpers/link_helper.rb | 4 | ||||
| -rw-r--r-- | app/views/nodes/index.html.erb | 2 | ||||
| -rw-r--r-- | test/functional/nodes_controller_test.rb | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 3be5953..b40aa4b 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | module LinkHelper | 1 | module LinkHelper |
| 2 | 2 | ||
| 3 | def link_to_path title, path, html_options = {} | 3 | def link_to_path title, path, html_options = {} |
| 4 | active = (params[:page_path].join("/") == path.sub(/^\//, "")) | 4 | if params[:page_path] |
| 5 | active = (params[:page_path].join("/") == path.sub(/^\//, "")) | ||
| 6 | end | ||
| 5 | 7 | ||
| 6 | params[:locale] ||= I18n.locale | 8 | params[:locale] ||= I18n.locale |
| 7 | 9 | ||
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index 727cfa1..2f6069f 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | <td class="node_id"><%= node.id %></td> | 17 | <td class="node_id"><%= node.id %></td> |
| 18 | <td class="title"> | 18 | <td class="title"> |
| 19 | <h4><%= link_to title_for_node(node), edit_node_path(node) %></h4> | 19 | <h4><%= link_to title_for_node(node), edit_node_path(node) %></h4> |
| 20 | <p><%= link_to_path(node.unique_name, node.unique_path) %></p> | 20 | <p><%= link_to_path(node.unique_name, node.unique_name) %></p> |
| 21 | </td> | 21 | </td> |
| 22 | <td class="actions"> | 22 | <td class="actions"> |
| 23 | <%= link_to 'Preview', node_path(node) %> | 23 | <%= link_to 'Preview', node_path(node) %> |
diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 1c7e607..ff9aa68 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb | |||
| @@ -6,6 +6,8 @@ class NodesControllerTest < ActionController::TestCase | |||
| 6 | 6 | ||
| 7 | def test_get_index | 7 | def test_get_index |
| 8 | Node.root.descendants.delete_all | 8 | Node.root.descendants.delete_all |
| 9 | test_node = Node.create :slug => "foo" | ||
| 10 | test_node.move_to_child_of Node.root | ||
| 9 | login_as :quentin | 11 | login_as :quentin |
| 10 | get :index | 12 | get :index |
| 11 | assert_response :success | 13 | assert_response :success |
