Merge remote-tracking branch 'upstream/pull/2023'
[rails.git] / app / views / layouts / _header.html.erb
1 <header class="closed">
2   <h1>
3     <a href="<%= root_path %>" class="geolink">
4       <picture>
5         <source srcset="<%= image_path "osm_logo.svg" %>" type="image/svg+xml"></source>
6         <%= image_tag "osm_logo.png", :srcset => image_path("osm_logo.svg"), :alt => t('layouts.logo.alt_text'), :class => 'logo' %>
7       </picture>
8       <%= t 'layouts.project_name.h1' %>
9     </a>
10   </h1>
11   <a href="#" id="menu-icon"></a>
12   <nav class='primary'>
13     <%= content_for :header %>
14     <ul>
15       <li id="edit_tab" class="dropdown <%= current_page_class(edit_path) %>">
16         <%= link_to t('layouts.edit'), edit_path, :class => "tab geolink editlink",
17                     :id => 'editanchor',
18                     :data => { :editor => preferred_editor }
19         %><a class='dropdown-toggle' data-toggle='dropdown' href='#'><b class="caret"></b></a>
20         <ul class='dropdown-menu'>
21           <% Editors::RECOMMENDED_EDITORS.each do |editor| %>
22             <li>
23               <%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
24                           edit_path(:editor => editor),
25                           :data => { :editor => editor },
26                           :class => "geolink editlink" %>
27             </li>
28           <% end %>
29         </ul>
30       </li>
31       <li id="history_tab" class="<%= current_page_class(history_path) %>">
32         <%= link_to t('layouts.history'), history_path, :class => 'tab geolink' %>
33       </li>
34       <li id="export_tab" class="<%= current_page_class(export_path) %>">
35         <%= link_to t('layouts.export'), export_path, :class => 'tab geolink' %>
36       </li>
37     </ul>
38   </nav>
39   <nav class='secondary'>
40     <ul>
41       <% if current_user and ( current_user.administrator? or current_user.moderator? ) %>
42         <li class="compact-hide <%= current_page_class(issues_path) %>">
43           <%= link_to issues_path(:status => 'open') do %>
44             <%= t('layouts.issues') %>
45             <%= open_issues_count %>
46           <% end -%>
47         </li>
48       <% end %>
49       <li class="compact-hide <%= current_page_class(traces_path) %>"><%= link_to t('layouts.gps_traces'), traces_path %></li>
50       <li class="compact-hide <%= current_page_class(diary_path) %>"><%= link_to t('layouts.user_diaries'), diary_path %></li>
51       <li class="compact-hide <%= current_page_class(copyright_path) %>"><%= link_to t('layouts.copyright'), copyright_path %></li>
52       <li class="compact-hide <%= current_page_class(help_path) %>"><%= link_to t('layouts.help'), help_path %></li>
53       <li class="compact-hide <%= current_page_class(about_path) %>"><%= link_to t('layouts.about'), about_path %></li>
54       <li id="compact-secondary-nav" class="dropdown">
55         <a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= t 'layouts.more' %> <b class="caret"></b></a>
56         <ul class="dropdown-menu">
57           <% if can? :index, Issue %>
58             <li class="<%= current_page_class(issues_path) %>">
59               <%= link_to issues_path(:status => 'open') do %>
60                 <%= open_issues_count %>
61                 <%= t('layouts.issues') %>
62               <% end -%>
63             </li>
64           <% end %>
65           <li class="<%= current_page_class(traces_path) %>"><%= link_to t('layouts.gps_traces'), traces_path %></li>
66           <li class="<%= current_page_class(diary_path) %>"><%= link_to t('layouts.user_diaries'), diary_path %></li>
67           <li class="<%= current_page_class(copyright_path) %>"><%= link_to t('layouts.copyright'), copyright_path %></li>
68           <li class="<%= current_page_class(help_path) %>"><%= link_to t('layouts.help'), help_path %></li>
69           <li class="<%= current_page_class(about_path) %>"><%= link_to t('layouts.about'), about_path %></li>
70         </ul>
71       </li>
72     </ul>
73     <% if current_user && current_user.id %>
74       <div class='dropdown user-menu logged-in'>
75         <a class='dropdown-toggle' data-toggle='dropdown' href="#">
76           <%= user_thumbnail_tiny(current_user, :width => 25, :height => 25)
77           %><%= render :partial => 'layouts/inbox'
78         %><span class="user-button"><span class='username'><%= current_user.display_name %></span>
79           <b class="caret"></b></span>
80         </a>
81         <ul class='dropdown-menu'>
82           <li>
83             <%= link_to inbox_messages_path do %>
84               <span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
85               <%= t('users.show.my messages') %>
86             <% end %>
87           </li>
88           <li>
89             <%= link_to t('users.show.my profile'), user_path(current_user) %>
90           </li>
91           <li>
92             <%= link_to t('users.show.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
93           </li>
94           <li class="divider"></li>
95           <li>
96             <%= yield :greeting %>
97           </li>
98           <li>
99             <%= link_to t('layouts.logout'), logout_path(:session => session.id, :referer => request.fullpath) %>
100           </li>
101         </ul>
102       </div>
103     <% else %>
104       <ul class="user-menu clearfix">
105         <li><%= link_to t('layouts.log_in'), login_path(:referer => request.fullpath) %></li>
106         <li><%= link_to t('layouts.sign_up'), user_new_path %></li>
107       </ul>
108     <% end %>
109   </nav>
110 </header>