forked from hackorum-dev/hackorum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.html.slim
More file actions
84 lines (83 loc) · 3.91 KB
/
application.html.slim
File metadata and controls
84 lines (83 loc) · 3.91 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
doctype html
html data-theme="light"
head
title
- if content_for?(:title)
= "#{content_for(:title)} - Hackorum"
- else
= "Hackorum"
meta[name="viewport" content="width=device-width,initial-scale=1"]
meta[name="apple-mobile-web-app-capable" content="yes"]
meta[name="mobile-web-app-capable" content="yes"]
= csrf_meta_tags
= csp_meta_tag
= yield :head
link[rel="icon" href="/icon.png" type="image/png"]
link[rel="apple-touch-icon" href="/icon.png"]
script
|
(function() {
var storageKey = 'hackorum-theme';
var stored = window.localStorage.getItem(storageKey);
var prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
var theme = stored || (prefersDark ? 'dark' : 'light');
document.documentElement.dataset.theme = theme;
})();
= stylesheet_link_tag "application", "data-turbo-track": "reload"
= javascript_importmap_tags
script[src="https://kit.fontawesome.com/92fb6aa8ba.js"]
- if ENV["UMAMI_WEBSITE_ID"].present?
- umami_host = ENV["UMAMI_HOST"].presence || "https://umami.hackorum.dev"
script[async defer data-website-id=ENV["UMAMI_WEBSITE_ID"] src="#{umami_host}/script.js"]
body
- if user_signed_in? && current_user.username.blank?
.global-warning
span Please set a username in Settings.
nav.main-navigation
.nav-container
.nav-brand
= link_to root_path, class: "brand-link" do
img.brand-icon src="/icon.png" alt="Hackorum" width="24" height="24"
span.brand-text Hackorum
span.tagline PostgreSQL Hackers Archive
.nav-links
= link_to "Topics", topics_path, class: "nav-link"
- search_link = content_for?(:search_sidebar) ? "#search" : topics_path(anchor: "search")
= link_to "Search", search_link, class: "nav-link"
= link_to "Statistics", stats_path, class: "nav-link"
.nav-right
button.nav-link.theme-toggle type="button" aria-label="Toggle theme" data-controller="theme" data-action="click->theme#toggle"
i.fas.fa-moon data-theme-target="icon"
span data-theme-target="label" Theme
.nav-auth
- if user_signed_in?
- if current_user&.person&.default_alias
span.nav-user = current_user.person.default_alias.name
- unread = activity_unread_count
= link_to activities_path, class: "nav-link nav-link-activity", title: "Activity" do
i.fa-regular.fa-bell
- if unread.positive?
span.nav-badge = unread
= link_to "Settings", settings_path, class: "nav-link"
= button_to "Sign out", session_path, method: :delete, class: "nav-link", form: { style: 'display:inline' }, data: { turbo: false }
- else
= link_to "Sign in", new_session_path, class: "nav-link"
= link_to "Register", new_registration_path, class: "nav-link"
- if content_for?(:sidebar)
.page-layout.with-sidebar data-controller="sidebar" data-sidebar-target="layout"
.layout-sidebar#layout-sidebar data-sidebar-target="sidebar"
= yield :sidebar
.layout-sidebar-resizer data-sidebar-target="resizer" role="separator" aria-orientation="vertical" aria-label="Resize sidebar" data-action="mousedown->sidebar#startResize touchstart->sidebar#startResize"
button.sidebar-collapse-button type="button" aria-label="Toggle sidebar" data-action="click->sidebar#toggle" data-sidebar-target="toggleButton"
span data-sidebar-target="toggleIcon" ◀
main.container
- flash.each do |type, message|
.flash class=type
= message
= yield
- else
main.container
- flash.each do |type, message|
.flash class=type
= message
= yield