1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<% if current_user %>
<%= link_to icon("home", library: "tabler", "aria-hidden": true), admin_path, "aria-label": t(".dashboard"), title: t(".dashboard") %>
<button type="button" id="search_toggle" class="nav_toggle" aria-label="<%= t(".search") %>" title="<%= t(".search") %>">
<%= icon("search", library: "tabler", "aria-hidden": true) %>
</button>
<% end %>
<%= link_to root_path, class: "nav_toggle",
"aria-label" => t(".public_site"), title: t(".public_site") do %>
<%= icon("world", library: "tabler", "aria-hidden": true) %>
<% end %>
<span class="nav_group">
<% locale_target = request.query_parameters.symbolize_keys.except(:controller, :action, :only_path, :host, :port, :protocol, :anchor, :script_name).merge(:locale => (:en unless I18n.locale == :en)) %>
<%= link_to url_for(locale_target),
class: "nav_toggle nav_locale",
"aria-label" => t(".switch_locale"), title: t(".switch_locale") do %>
<%= I18n.locale == :en ? "DE" : "EN" %>
<% end %>
<%= check_box_tag "scheme_override", 1, false, class: "nav_toggle_input" %>
<%= label_tag "scheme_override", class: "nav_toggle",
"aria-label" => t(".scheme_override"), title: t(".scheme_override") do %>
<%= icon("contrast", library: "tabler", "aria-hidden": true) %>
<% end %>
</span>
<%= javascript_tag nonce: true do %>
(function () {
var box = document.getElementById("scheme_override");
try {
if (localStorage.getItem("override-prefers-color-scheme")) box.checked = true;
box.addEventListener("change", function () {
if (box.checked) localStorage.setItem("override-prefers-color-scheme", 1);
else localStorage.removeItem("override-prefers-color-scheme");
});
} catch (e) { /* storage unavailable: the toggle still works per page */ }
})();
<% end %>
<% if current_user %>
<%= button_to logout_path, method: :delete, form: { class: "button_to session_ending" },
aria: { label: t(".log_out") }, title: t(".log_out") do %>
<%= icon("logout", library: "tabler", "aria-hidden": true) %>
<% end %>
<% end %>
|