Skip to content

Commit

Permalink
Fixes current tab highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed May 15, 2009
1 parent 3db3f95 commit 87633f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def add_since_to(title, since)
"#{title} - #{constraint}"
end

def sidebar_tab(name, options={}, html_options={})
style = current_page?(options) ? ' class="current"' : ''
def sidebar_tab(name, time_range, options={}, html_options={})
style = params[:since] == time_range ? ' class="current"' : ''
return <<-HTML
<li#{style}>
#{link_to name, options, html_options}
Expand All @@ -54,6 +54,6 @@ def sidebar_tab(name, options={}, html_options={})
end

def normalize_title(title)
title.starts_with?("Rails Contributors") ? title : "Rails Contributors - #{title}"
title.starts_with?("Rails Contributors") ? title : "Rails Contributors - #{title}"
end
end
8 changes: 4 additions & 4 deletions app/views/commits/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
Commits from
</h4>
<ul id="navigation">
<%= sidebar_tab 'All time', contributor_commits_path(@contributor) %>
<%= sidebar_tab 'This week', contributor_commits_path(@contributor, :since => this_week) %>
<%= sidebar_tab 'This month', contributor_commits_path(@contributor, :since => this_month) %>
<%= sidebar_tab 'This year', contributor_commits_path(@contributor, :since => this_year) %>
<%= sidebar_tab 'All time', nil, contributor_commits_path(@contributor) %>
<%= sidebar_tab 'This week', this_week, contributor_commits_path(@contributor, :since => this_week) %>
<%= sidebar_tab 'This month', this_month, contributor_commits_path(@contributor, :since => this_month) %>
<%= sidebar_tab 'This year', this_year, contributor_commits_path(@contributor, :since => this_year) %>
</ul>
<% end %>
8 changes: 4 additions & 4 deletions app/views/contributors/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
Commits from
</h4>
<ul id="navigation">
<%= sidebar_tab 'All time', contributors_path %>
<%= sidebar_tab 'This week', contributors_path(:since => this_week) %>
<%= sidebar_tab 'This month', contributors_path(:since => this_month) %>
<%= sidebar_tab 'This year', contributors_path(:since => this_year) %>
<%= sidebar_tab 'All time', nil, contributors_path %>
<%= sidebar_tab 'This week', this_week, contributors_path(:since => this_week) %>
<%= sidebar_tab 'This month', this_month, contributors_path(:since => this_month) %>
<%= sidebar_tab 'This year', this_year, contributors_path(:since => this_year) %>
</ul>
<% end %>

0 comments on commit 87633f3

Please sign in to comment.