summaryrefslogtreecommitdiffstats
path: root/app/views/layouts/_project_selector.rhtml
blob: 7a2803534e2f2379f9988a89421fb81f35a23a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
<% user_projects_by_root = User.current.projects.find(:all, :include => :parent).group_by(&:root) %>
<select onchange="if (this.value != '') { window.location = this.value; }">
<option selected="selected"><%= l(:label_jump_to_a_project) %></option>
<option disabled="disabled">---</option>
<% user_projects_by_root.keys.sort.each do |root| %>
    <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %>
    <% user_projects_by_root[root].sort.each do |project| %>
        <% next if project == root %>
        <%= content_tag('option', ('&#187; ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %>
    <% end %>
<% end %>
</select>