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