]> git.openstreetmap.org Git - rails.git/blob - app/views/layouts/_header.html.erb
Merge remote-tracking branch 'upstream/pull/5184'
[rails.git] / app / views / layouts / _header.html.erb
1 <header class="d-flex bg-body text-nowrap closed z-3">
2   <h1 class="d-flex m-0 fw-semibold">
3     <a href="<%= root_path %>" class="icon-link gap-1 text-body-emphasis text-decoration-none geolink">
4       <%= image_tag "osm_logo.svg", :alt => t("layouts.logo.alt_text"), :size => 30 %>
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 d-flex gap-2 align-items-center'>
35     <ul class='nav flex-nowrap'>
36       <% if Settings.status != "database_offline" && can?(:index, Issue) %>
37         <li class="compact-hide nav-item">
38           <%= link_to issues_path(:status => "open"), :class => header_nav_link_class(issues_path) do %>
39             <%= t("layouts.issues") %>
40             <%= open_issues_count %>
41           <% end -%>
42         </li>
43       <% end %>
44       <li class="compact-hide nav-item">
45         <%= link_to t("layouts.gps_traces"), traces_path, :class => header_nav_link_class(traces_path) %>
46       </li>
47       <li class="compact-hide nav-item">
48         <%= link_to t("layouts.user_diaries"), diary_entries_path, :class => header_nav_link_class(diary_entries_path) %>
49       </li>
50       <li class="compact-hide nav-item">
51         <%= link_to t("layouts.communities"), communities_path, :class => header_nav_link_class(communities_path) %>
52       </li>
53       <li class="compact-hide nav-item">
54         <%= link_to t("layouts.copyright"), copyright_path, :class => header_nav_link_class(copyright_path) %>
55       </li>
56       <li class="compact-hide nav-item">
57         <%= link_to t("layouts.help"), help_path, :class => header_nav_link_class(help_path) %>
58       </li>
59       <li class="compact-hide nav-item">
60         <%= link_to t("layouts.about"), about_path, :class => header_nav_link_class(about_path) %>
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-body 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>
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><%= link_to t("layouts.gps_traces"), traces_path, :class => "dropdown-item" %></li>
74           <li><%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "dropdown-item" %></li>
75           <li><%= link_to t("layouts.communities"), communities_path, :class => "dropdown-item" %></li>
76           <li><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
77           <li><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
78           <li><%= 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='d-flex gap-1 align-items-center justify-content-center dropdown-toggle btn btn-outline-secondary border-secondary-subtle bg-body text-secondary px-2 py-1 flex-grow-1' type='button' data-bs-toggle='dropdown'>
85           <%= user_thumbnail_tiny(current_user, :class => "user_thumbnail_tiny rounded-1 bg-body") %>
86           <% if current_user.new_messages.size > 0 %>
87             <span class="badge count-number position-static m-1"><%= current_user.new_messages.size %></span>
88           <% end %>
89           <span class='username align-middle text-truncate'>
90             <%= current_user.display_name %>
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"), 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>