Skip to content

Commit

Permalink
Fix subtab highlight error
Browse files Browse the repository at this point in the history
Happened when another tab started with the same letters.

Example:
* test
* test_bug (current)
  • Loading branch information
Bastien authored and steveklabnik committed Sep 23, 2012
1 parent 4f366d3 commit f57fd17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/resque/server.rb
Expand Up @@ -26,6 +26,10 @@ def current_section
url_path request.path_info.sub('/','').split('/')[0].downcase url_path request.path_info.sub('/','').split('/')[0].downcase
end end


def current_subtab
url_path request.path_info.sub('/','').split('/')[0, 2].join('/').downcase
end

def current_page def current_page
url_path request.path_info.sub('/','') url_path request.path_info.sub('/','')
end end
Expand All @@ -40,7 +44,7 @@ def path_prefix
end end


def class_if_current(path = '') def class_if_current(path = '')
'class="current"' if current_page[0, path.size] == path 'class="current"' if [current_section, current_subtab].include?(path)
end end


def tab(name) def tab(name)
Expand Down

0 comments on commit f57fd17

Please sign in to comment.