]> git.openstreetmap.org Git - rails.git/blob - app/views/layouts/_header.html.erb
Refactor more controller tests
[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" />
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         <a class='btn btn-outline-primary dropdown-toggle dropdown-toggle-split' data-toggle='dropdown' href='#'></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 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 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(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         <a class="dropdown-toggle nav-link" data-toggle="dropdown" href="#"><%= t "layouts.more" %></a>
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(copyright_path) %>"><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
76           <li class="<%= current_page_class(help_path) %>"><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
77           <li class="<%= current_page_class(about_path) %>"><%= link_to t("layouts.about"), about_path, :class => "dropdown-item" %></li>
78         </ul>
79       </li>
80     </ul>
81     <% if current_user && current_user.id %>
82       <div class='d-inline-flex dropdown user-menu logged-in clearfix'>
83         <a class='dropdown-toggle btn btn-outline-secondary pl-2 py-1 flex-grow-1' data-toggle='dropdown' href="#">
84           <%= user_thumbnail_tiny(current_user, :width => 25, :height => 25) %>
85           <%= render :partial => "layouts/inbox" %>
86           <span class="user-button">
87             <span class='username'>
88               <%= current_user.display_name %>
89             </span>
90           </span>
91         </a>
92         <div class='dropdown-menu dropdown-menu-right'>
93           <%= link_to inbox_messages_path, :class => "dropdown-item" do %>
94             <%= t("users.show.my messages") %>
95             <span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
96           <% end %>
97           <%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
98           <%= link_to t("users.show.my settings"), { :controller => "users", :action => "account", :display_name => current_user.display_name }, { :class => "dropdown-item" } %>
99           <div class="dropdown-divider"></div>
100           <%= yield :greeting %>
101           <%= link_to t("layouts.logout"), logout_path(:referer => request.fullpath), :method => "post", :class => "geolink dropdown-item" %>
102         </div>
103       </div>
104     <% else %>
105       <div class="d-inline-flex btn-group login-menu" role="">
106         <%= link_to t("layouts.log_in"), login_path(:referer => request.fullpath), :class => "geolink btn btn-outline-secondary" %>
107         <%= link_to t("layouts.sign_up"), user_new_path, :class => "btn btn-outline-secondary" %>
108       </ul>
109     <% end %>
110   </nav>
111 </header>