]> git.openstreetmap.org Git - rails.git/blob - app/views/layouts/_header.html.erb
Merge remote-tracking branch 'upstream/pull/4221'
[rails.git] / app / views / layouts / _header.html.erb
1 <header class="closed clearfix">
2   <h1>
3     <a href="<%= root_path %>" class="geolink">
4       <picture>
5         <source srcset="<%= image_path "osm_logo.svg" %>" type="image/svg+xml" />
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     <div class="btn-group">
15       <div id="edit_tab" class="btn-group <%= current_page_class(edit_path) %>">
16         <%= link_to t("layouts.edit"),
17                     edit_path,
18                     :class => "btn btn-outline-primary geolink editlink",
19                     :id => "editanchor",
20                     :data => { :editor => preferred_editor } %>
21         <button class='btn btn-outline-primary dropdown-toggle dropdown-toggle-split' type='button' data-bs-toggle='dropdown'></button>
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 dropdown-item" %>
29             </li>
30           <% end %>
31         </ul>
32       </div>
33       <%= link_to t("layouts.history"), history_path, :class => "btn btn-outline-primary geolink flex-grow-1 current_page_class(history_path)", :id => "history_tab" %>
34       <%= link_to t("layouts.export"), export_path, :class => "btn btn-outline-primary geolink current_page_class(export_path)", :id => "export_tab" %>
35     </div>
36   </nav>
37   <nav class='secondary'>
38     <ul class='mx-1 px-0'>
39       <% if Settings.status != "database_offline" && can?(:index, Issue) %>
40         <li class="compact-hide nav-item <%= current_page_class(issues_path) %>">
41           <%= link_to issues_path(:status => "open"), :class => "nav-link" do %>
42             <%= t("layouts.issues") %>
43             <%= open_issues_count %>
44           <% end -%>
45         </li>
46       <% end %>
47       <li class="compact-hide nav-item <%= current_page_class(traces_path) %>">
48         <%= link_to t("layouts.gps_traces"), traces_path, :class => "nav-link" %>
49       </li>
50       <li class="compact-hide nav-item <%= current_page_class(diary_entries_path) %>">
51         <%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "nav-link" %>
52       </li>
53       <li class="compact-hide nav-item <%= current_page_class(communities_path) %>">
54         <%= link_to t("layouts.communities"), communities_path, :class => "nav-link" %>
55       </li>
56       <li class="compact-hide nav-item <%= current_page_class(copyright_path) %>">
57         <%= link_to t("layouts.copyright"), copyright_path, :class => "nav-link" %>
58       </li>
59       <li class="compact-hide nav-item <%= current_page_class(help_path) %>">
60         <%= link_to t("layouts.help"), help_path, :class => "nav-link" %>
61       </li>
62       <li class="compact-hide nav-item <%= current_page_class(about_path) %>">
63         <%= link_to t("layouts.about"), about_path, :class => "nav-link" %>
64       </li>
65       <li id="compact-secondary-nav" class="dropdown nav-item">
66         <button class="dropdown-toggle nav-link btn" type="button" data-bs-toggle="dropdown"><%= t "layouts.more" %></button>
67         <ul class="dropdown-menu">
68           <% if Settings.status != "database_offline" && can?(:index, Issue) %>
69             <li class="<%= current_page_class(issues_path) %>">
70               <%= link_to issues_path(:status => "open"), :class => "dropdown-item" do %>
71                 <%= t("layouts.issues") %>
72                 <%= open_issues_count %>
73               <% end -%>
74             </li>
75           <% end %>
76           <li class="<%= current_page_class(traces_path) %>"><%= link_to t("layouts.gps_traces"), traces_path, :class => "dropdown-item" %></li>
77           <li class="<%= current_page_class(diary_entries_path) %>"><%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "dropdown-item" %></li>
78           <li class="<%= current_page_class(communities_path) %>"><%= link_to t("layouts.communities"), communities_path, :class => "dropdown-item" %></li>
79           <li class="<%= current_page_class(copyright_path) %>"><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
80           <li class="<%= current_page_class(help_path) %>"><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
81           <li class="<%= current_page_class(about_path) %>"><%= link_to t("layouts.about"), about_path, :class => "dropdown-item" %></li>
82         </ul>
83       </li>
84     </ul>
85     <% if current_user && current_user.id %>
86       <div class='d-inline-flex dropdown user-menu logged-in clearfix'>
87         <button class='dropdown-toggle btn btn-outline-secondary px-2 py-1 flex-grow-1' type='button' data-bs-toggle='dropdown'>
88           <%= user_thumbnail_tiny(current_user, :width => 25, :height => 25, :class => "user_thumbnail_tiny rounded-1") %>
89           <%= render :partial => "layouts/inbox" %>
90           <span class="user-button">
91             <span class='username'>
92               <%= current_user.display_name %>
93             </span>
94           </span>
95         </button>
96         <div class='dropdown-menu dropdown-menu-end'>
97           <%= link_to t("users.show.my_dashboard"), dashboard_path, :class => "dropdown-item" %>
98           <%= link_to inbox_messages_path, :class => "dropdown-item" do %>
99             <%= t("users.show.my messages") %>
100             <span class='badge count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
101           <% end %>
102           <%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
103           <%= link_to t("users.show.my settings"), edit_account_path, :class => "dropdown-item" %>
104           <%= link_to t("users.show.my_preferences"), preferences_path, :class => "dropdown-item" %>
105           <div class="dropdown-divider"></div>
106           <%= yield :greeting %>
107           <%= link_to t("layouts.logout"), logout_path(:referer => request.fullpath), :method => "post", :class => "geolink dropdown-item" %>
108         </div>
109       </div>
110     <% else %>
111       <div class="d-inline-flex btn-group login-menu" role="">
112         <%= link_to t("layouts.log_in"), login_path(:referer => request.fullpath), :class => "geolink btn btn-outline-secondary" %>
113         <%= link_to t("layouts.sign_up"), user_new_path, :class => "btn btn-outline-secondary" %>
114       </div>
115     <% end %>
116   </nav>
117 </header>