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
147 lines (146 loc) · 8.12 KB
/
application.html.slim
File metadata and controls
147 lines (146 loc) · 8.12 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
doctype html
html data-theme="light"
head
title = meta_title
meta[name="description" content=meta_description]
meta[property="og:site_name" content="Hackorum"]
meta[property="og:title" content=meta_title]
meta[property="og:description" content=meta_description]
meta[property="og:url" content=meta_url]
meta[property="og:image" content=meta_image_url]
meta[property="og:image:alt" content=meta_title]
meta[property="og:type" content=meta_type]
meta[name="twitter:card" content=twitter_card]
meta[name="twitter:title" content=meta_title]
meta[name="twitter:description" content=meta_description]
meta[name="twitter:image" content=meta_image_url]
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 class=(content_for?(:sidebar) ? "has-sidebar" : nil) data-controller="sidebar swipe-nav"
- if user_signed_in? && current_user.username.blank?
.global-warning
span Please set a username in Settings.
- starred_active = controller_name == "topics" && action_name == "index" && params[:filter].to_s == "starred_by_me"
nav.main-navigation
.nav-container
.nav-brand
- if content_for?(:sidebar)
button.nav-burger type="button" aria-label="Toggle sidebar" data-action="click->sidebar#toggleMobile"
i.fa-solid.fa-bars
= link_to root_path, class: "brand-link" do
img.brand-icon src="/icon.png" alt="Hackorum" width="24" height="24"
span.brand-text Hackorum
details.mobile-nav-dropdown
summary.mobile-nav-toggle aria-label="Open menu"
span.mobile-nav-label Menu
i.fa-solid.fa-caret-down
.mobile-nav-menu data-action="click->sidebar#closeMenuOnNavigate"
= link_to "Topics", topics_path, class: "nav-link"
- if user_signed_in?
- icon_class = starred_active ? "fa-solid fa-star" : "fa-regular fa-star"
- link_classes = ["nav-link"]
- link_classes << "is-active" if starred_active
= link_to topics_path(filter: "starred_by_me"), class: link_classes.join(" "), title: "Starred by me", aria: { label: "Starred by me" } do
i class=icon_class aria-hidden="true"
span.sr-only Starred
= link_to "Search", topics_path(anchor: "search"), class: "nav-link"
= link_to "Statistics", stats_path, class: "nav-link"
= link_to "Reports", reports_path, class: "nav-link"
= link_to "Help", help_index_path, class: "nav-link"
- if user_signed_in?
- if current_user&.person&.default_alias
= link_to current_user.person.default_alias.name, person_path(current_user.person.default_alias.email), class: "nav-link nav-user"
= link_to "Settings", settings_root_path, class: "nav-link"
- if current_admin?
= link_to "Admin", admin_root_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"
span.tagline PostgreSQL Hackers Archive
- if user_signed_in?
- unread = activity_unread_count
- starred_href = starred_active ? topics_path : topics_path(filter: "starred_by_me")
- starred_title = starred_active ? "All topics" : "Starred by me"
= link_to starred_href, class: "nav-link nav-mobile-star#{' is-active' if starred_active}", title: starred_title, aria: { label: starred_title } do
i class=(starred_active ? "fa-solid fa-star" : "fa-regular fa-star") aria-hidden="true"
span.sr-only Starred
= link_to activities_path, class: "nav-link nav-link-activity nav-mobile-bell", title: "Activity" do
i.fa-regular.fa-bell
- if unread.positive?
span.nav-badge = unread
.nav-menu
.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 "Reports", reports_path, class: "nav-link"
.nav-right
.nav-auth
- if user_signed_in?
- if current_user&.person&.default_alias
= link_to current_user.person.default_alias.name, person_path(current_user.person.default_alias.email), class: "nav-link nav-user"
- 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
- else
= link_to "Sign in", new_session_path, class: "nav-link"
= link_to "Register", new_registration_path, class: "nav-link"
details.nav-overflow-dropdown data-controller="nav-dropdown"
summary.nav-link.nav-overflow-toggle aria-label="Menu" data-action="click->sidebar#closeMenuOnNavigate"
i.fa-solid.fa-bars
.nav-overflow-menu
= link_to "Statistics", stats_path, class: "nav-link"
= link_to "Help", help_index_path, class: "nav-link"
- if user_signed_in?
= link_to "Settings", settings_root_path, class: "nav-link"
- if current_admin?
= link_to "Admin", admin_root_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-sidebar-target="layout"
.layout-sidebar#layout-sidebar data-sidebar-target="sidebar" data-action="click->sidebar#closeOnNavigate"
= 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" ◀
.layout-sidebar-overlay data-sidebar-target="overlay" data-action="click->sidebar#closeMobile"
main.container
- flash.each do |type, message|
.flash class=type
= flash_icon(type)
= message
= yield
- else
main.container
- flash.each do |type, message|
.flash class=type
= flash_icon(type)
= message
= yield