Commit 723a114425f513e21eaec721f86138b735503adf

Make the menu tabs have a selected class depending on context

Commit diff

TODO.txt

 
11new-ui:
2* Make the project tabs active styled depending on context
32* Fix menu bottom spacing issue in safari
43* Clone stats graph on repositories#index
54* divergence from mainline in +/-
toggle raw diff

app/helpers/application_helper.rb

 
3838 end
3939 end
4040
41 def submenu_selected_class_if_current?(section)
42 case section
43 when :overview
44 if %w[projects].include?(controller.controller_name )
45 return "selected"
46 end
47 when :repositories
48 if %w[repositories trees logs commits comitters comments merge_requests
49 blobs committers].include?(controller.controller_name )
50 return "selected"
51 end
52 end
53 end
54
4155 def link_to_with_selected(name, options = {}, html_options = nil)
4256 html_options = current_page?(options) ? {:class => "selected"} : nil
4357 link_to(name, options = {}, html_options)
toggle raw diff

app/views/layouts/application.html.erb

 
5050 <% if @project -%>
5151 <h2 id="project_title"><%= link_to h(@project.title), @project -%></h2>
5252 <ul id="submenu">
53 <li class="selected"><%= link_to "Overview", project_path(@project), :class => "round-tl-5 round-tr-5" -%></li>
54 <li><%= link_to "Repositories", project_repositories_path(@project), :class => "round-tl-5 round-tr-5" -%></li>
53 <li class="<%= submenu_selected_class_if_current?(:overview) -%>">
54 <%= link_to "Project Overview",
55 project_path(@project), :class => "round-tl-5 round-tr-5" -%>
56 </li>
57 <li class="<%= submenu_selected_class_if_current?(:repositories) -%>">
58 <%= link_to "Repositories",
59 project_repositories_path(@project), :class => "round-tl-5 round-tr-5" -%>
60 </li>
5561 </ul>
5662 <% end -%>
5763 </div>
toggle raw diff