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