diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 44c7ece2..cb85fe24 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -34,19 +34,10 @@ module ApplicationHelper end # Replicates the link_to method but also checks request.request_uri to find - # current page. If that matches the name parameter, the link is marked + # current page. If that matches the url, the link is marked # id = "current" # def navigation_link(name, options = {}, html_options = nil, *parameters_for_method_reference) - curr_path = request.request_uri.to_s - if curr_path =~ /([a-z]+)$/ - curr_page = $& - elsif curr_path == "/" - curr_page = "home" - end - - id_tag = (curr_page == name.downcase) ? " id=\"current\"" : "" - if html_options html_options = html_options.stringify_keys convert_options_to_javascript!(html_options) @@ -54,7 +45,9 @@ module ApplicationHelper else tag_options = nil end - url = options.is_a?(String) ? options : self.url_for(options, *parameters_for_method_reference) + url = options.is_a?(String) ? options : self.url_for(options, *parameters_for_method_reference) + id_tag = (request.request_uri == url) ? " id=\"current\"" : "" + "#{name || url}" end end diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index d5174262..6eb8cc0f 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -32,7 +32,7 @@
  • <%= navigation_link( "Contexts", {:controller => "context", :action => "list"}, {:accesskey=>"c", :title=>"Contexts"} ) %>
  • <%= navigation_link( "Projects", {:controller => "project", :action => "list"}, {:accesskey=>"p", :title=>"Projects"} ) %>
  • <%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %>
  • -
  • <%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "n", :title => "Show all notes"} ) %>
  • +
  • <%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %>
  • <%= navigation_link( "Preferences", {:controller => "user", :action => "preferences"}, {:accesskey => "u", :title => "Show my preferences"} ) %>
  • Show
  • Hide