Compare commits
4 Commits
95e4384f22
...
c426c8aa2a
Author | SHA1 | Date | |
---|---|---|---|
c426c8aa2a | |||
a4a79d964e | |||
025b3063a6 | |||
5e7dec08b9 |
@ -54,3 +54,6 @@ once you are able to navigate to the forum, you can log in as the administrator
|
||||
|
||||
# icons
|
||||
the icons in the `icons/` folder are by [Gabriele Malaspina](https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license)
|
||||
|
||||
# credits & acknowledgements
|
||||
see [THIRDPARTY.md](./THIRDPARTY.md)
|
||||
|
33
THIRDPARTY.md
Normal file
33
THIRDPARTY.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Acknowledgements
|
||||
|
||||
## Lapis
|
||||
|
||||
URL: https://leafo.net/lapis/
|
||||
Copyright: `(c) 2023 Leaf Corcoran`
|
||||
License: MIT
|
||||
Repo: https://github.com/leafo/lapis
|
||||
|
||||
## ChicagoFLF
|
||||
|
||||
Affected files: [`fonts/ChicagoFLF.woff2`](./fonts/ChicagoFLF.woff2)
|
||||
No canonical URL that I could find.
|
||||
Obtained from: https://usemodify.com/fonts/chicago/
|
||||
License: Public Domain
|
||||
Designers: Susan Kare, Robin Casady
|
||||
|
||||
## Cadman
|
||||
|
||||
Affected files: [`fonts/Cadman_Bold.woff2`](./fonts/Cadman_Bold.woff2) [`fonts/Cadman_BoldItalic.woff2`](./fonts/Cadman_BoldItalic.woff2) [`fonts/Cadman_Italic.woff2`](./fonts/Cadman_Italic.woff2) [`fonts/Cadman_Roman.woff2`](./fonts/Cadman_Roman.woff2)
|
||||
URL: https://localfonts.eu/shop/cyrillic-script/serbian/serbian-cyrillic-sans-serif/cadman/
|
||||
Copyright: `© 2017-2020 by Paul James Miller. All rights reserved.`
|
||||
License: SIL Open Font License 1.1
|
||||
Designers: Paul James Miller
|
||||
|
||||
## ICONCINO
|
||||
|
||||
Affected files: [`svg-icons/error.etlua`](./svg-icons/error.etlua) [`svg-icons/info.etlua`](./svg-icons/info.etlua) [`svg-icons/lock.etlua`](./svg-icons/lock.etlua) [`svg-icons/sticky.etlua`](./svg-icons/sticky.etlua) [`svg-icons/warn.etlua`](./svg-icons/warn.etlua)
|
||||
URL: https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license
|
||||
Copyright: Gabriele Malaspina
|
||||
Designers: Gabriele Malaspina
|
||||
License: CC0 1.0/CC BY 4.0
|
||||
CC BY 4.0 compliance: Modified to indicate the URL. Modified size.
|
@ -135,4 +135,38 @@ app:post("thread", "/:slug", function(self)
|
||||
return {redirect_to = self:url_for("thread", {slug = thread.slug}, {page = last_page}) .. "#latest-post"}
|
||||
end)
|
||||
|
||||
app:post("thread_lock", "/:slug/lock", function(self)
|
||||
local user = util.get_logged_in_user(self)
|
||||
if not user then
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end
|
||||
local thread = Threads:find({slug = self.params.slug})
|
||||
if not ((thread.user_id == user.id) or user:is_mod()) then
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end
|
||||
local target_op = util.form_bool_to_sqlite(self.params.target_op)
|
||||
thread:update({
|
||||
is_locked = target_op,
|
||||
})
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end)
|
||||
|
||||
app:post("thread_sticky", "/:slug/sticky", function(self)
|
||||
local user = util.get_logged_in_user(self)
|
||||
if not user then
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end
|
||||
|
||||
if not user:is_mod() then
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end
|
||||
|
||||
local thread = Threads:find({slug = self.params.slug})
|
||||
local target_op = util.form_bool_to_sqlite(self.params.target_op)
|
||||
thread:update({
|
||||
is_stickied = target_op,
|
||||
})
|
||||
return {redirect_to = self:url_for("thread", {slug = self.params.slug})}
|
||||
end)
|
||||
|
||||
return app
|
||||
|
@ -194,4 +194,20 @@ app:post("topic_edit", "/:slug/edit", function(self)
|
||||
return {redirect_to = self:url_for("topic", {slug = self.params.slug})}
|
||||
end)
|
||||
|
||||
app:post("topic_delete", "/:slug/delete", function(self)
|
||||
local user = util.get_logged_in_user(self)
|
||||
if not user then
|
||||
return {redirect_to = self:url_for("topic", {slug = self.params.slug})}
|
||||
end
|
||||
|
||||
if not user:is_mod() then
|
||||
return {redirect_to = self:url_for("topic", {slug = self.params.slug})}
|
||||
end
|
||||
|
||||
local topic = Topics:find({slug = self.params.slug})
|
||||
topic:delete()
|
||||
util.inject_infobox(self, "Topic deleted.")
|
||||
return {redirect_to = self:url_for("all_topics")}
|
||||
end)
|
||||
|
||||
return app
|
||||
|
@ -1,8 +1,41 @@
|
||||
/* src: */
|
||||
@font-face {
|
||||
font-family: "body-text";
|
||||
src: url("/static/fonts/DINish[slnt,wdth,wght].woff2") format("woff2");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "site-title";
|
||||
src: url("/static/fonts/ChicagoFLF.woff2");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Cadman";
|
||||
src: url("/static/fonts/Cadman_Roman.woff2");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Cadman";
|
||||
src: url("/static/fonts/Cadman_Bold.woff2");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Cadman";
|
||||
src: url("/static/fonts/Cadman_Italic.woff2");
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Cadman";
|
||||
src: url("/static/fonts/Cadman_BoldItalic.woff2");
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
.currentpage, .pagebutton, input[type=file]::file-selector-button, button.warn, input[type=submit].warn, .linkbutton.warn, button.critical, input[type=submit].critical, .linkbutton.critical, button, input[type=submit], .linkbutton {
|
||||
cursor: default;
|
||||
color: black;
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.9em;
|
||||
font-family: "Cadman";
|
||||
text-decoration: none;
|
||||
border: 1px solid black;
|
||||
border-radius: 3px;
|
||||
@ -11,7 +44,7 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-family: "Cadman";
|
||||
margin: 20px 100px;
|
||||
background-color: rgb(173.5214173228, 183.6737007874, 161.0262992126);
|
||||
}
|
||||
@ -26,7 +59,7 @@ body {
|
||||
justify-content: end;
|
||||
background-color: #c1ceb1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
#bottomnav {
|
||||
@ -49,9 +82,9 @@ body {
|
||||
}
|
||||
|
||||
.site-title {
|
||||
padding-right: 30px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
font-family: "site-title";
|
||||
font-size: 3rem;
|
||||
margin: 0 20px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
@ -86,7 +119,7 @@ body {
|
||||
.post-content-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 0.2fr 2.5fr;
|
||||
grid-template-rows: 70px 2.5fr;
|
||||
gap: 0px 0px;
|
||||
grid-auto-flow: row;
|
||||
grid-template-areas: "post-info" "post-content";
|
||||
@ -156,7 +189,7 @@ pre code {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: last baseline;
|
||||
font-family: sans-serif;
|
||||
font-family: "Cadman";
|
||||
border-top-right-radius: 8px;
|
||||
border-top-left-radius: 8px;
|
||||
background-color: #c1ceb1;
|
||||
@ -348,7 +381,7 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus
|
||||
|
||||
.infobox {
|
||||
border: 2px solid black;
|
||||
background-color: #c1ceb1;
|
||||
background-color: #81a3e6;
|
||||
padding: 20px 15px;
|
||||
}
|
||||
.infobox.critical {
|
||||
|
BIN
fonts/Cadman_Bold.woff2
Normal file
BIN
fonts/Cadman_Bold.woff2
Normal file
Binary file not shown.
BIN
fonts/Cadman_BoldItalic.woff2
Normal file
BIN
fonts/Cadman_BoldItalic.woff2
Normal file
Binary file not shown.
BIN
fonts/Cadman_Italic.woff2
Normal file
BIN
fonts/Cadman_Italic.woff2
Normal file
Binary file not shown.
BIN
fonts/Cadman_Roman.woff2
Normal file
BIN
fonts/Cadman_Roman.woff2
Normal file
Binary file not shown.
BIN
fonts/ChicagoFLF.woff2
Normal file
BIN
fonts/ChicagoFLF.woff2
Normal file
Binary file not shown.
16
js/topic.js
Normal file
16
js/topic.js
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
const deleteDialog = document.getElementById("delete-dialog");
|
||||
const deleteDialogOpenButton = document.getElementById("topic-delete-dialog-open");
|
||||
deleteDialogOpenButton.addEventListener("click", (e) => {
|
||||
deleteDialog.showModal();
|
||||
});
|
||||
const deleteDialogCloseButton = document.getElementById("topic-delete-dialog-close");
|
||||
deleteDialogCloseButton.addEventListener("click", (e) => {
|
||||
deleteDialog.close();
|
||||
})
|
||||
deleteDialog.addEventListener("click", (e) => {
|
||||
if (e.target === deleteDialog) {
|
||||
deleteDialog.close();
|
||||
}
|
||||
})
|
||||
}
|
@ -41,5 +41,9 @@ http {
|
||||
location /static/js/ {
|
||||
alias js/;
|
||||
}
|
||||
|
||||
location /static/fonts/ {
|
||||
alias fonts/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,45 @@
|
||||
|
||||
@use "sass:color";
|
||||
|
||||
@font-face {
|
||||
font-family: "body-text";
|
||||
src: url("/static/fonts/DINish[slnt,wdth,wght].woff2") format("woff2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "site-title";
|
||||
src: url("/static/fonts/ChicagoFLF.woff2");
|
||||
}
|
||||
|
||||
@mixin cadman($var) {
|
||||
font-family: "Cadman";
|
||||
src: url("/static/fonts/Cadman_#{$var}.woff2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
@include cadman("Roman");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
@include cadman("Bold");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
@include cadman("Italic");
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
@include cadman("BoldItalic");
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
$accent_color: #c1ceb1;
|
||||
|
||||
$dark_bg: color.scale($accent_color, $lightness: -25%, $saturation: -97%);
|
||||
@ -17,7 +56,8 @@ $button_color: color.adjust($accent_color, $hue: 90);
|
||||
%button-base {
|
||||
cursor: default;
|
||||
color: black;
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.9em;
|
||||
font-family: "Cadman";
|
||||
text-decoration: none;
|
||||
border: 1px solid black;
|
||||
border-radius: 3px;
|
||||
@ -50,7 +90,8 @@ $button_color: color.adjust($accent_color, $hue: 90);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-family: "Cadman";
|
||||
// font-size: 18px;
|
||||
margin: 20px 100px;
|
||||
background-color: $main_bg;
|
||||
}
|
||||
@ -62,7 +103,7 @@ body {
|
||||
#topnav {
|
||||
@include navbar($accent_color);
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
#bottomnav {
|
||||
@ -82,9 +123,9 @@ body {
|
||||
}
|
||||
|
||||
.site-title {
|
||||
padding-right: 30px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
font-family: "site-title";
|
||||
font-size: 3rem;
|
||||
margin: 0 20px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
@ -120,7 +161,7 @@ body {
|
||||
.post-content-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 0.2fr 2.5fr;
|
||||
grid-template-rows: 70px 2.5fr;
|
||||
gap: 0px 0px;
|
||||
grid-auto-flow: row;
|
||||
grid-template-areas:
|
||||
@ -193,7 +234,7 @@ pre code {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: last baseline;
|
||||
font-family: sans-serif;
|
||||
font-family: "Cadman";
|
||||
border-top-right-radius: 8px;
|
||||
border-top-left-radius: 8px;
|
||||
background-color: $accent_color;
|
||||
@ -349,7 +390,7 @@ input[type="text"], input[type="password"], textarea, select {
|
||||
|
||||
.infobox {
|
||||
border: 2px solid black;
|
||||
background-color: $accent_color;
|
||||
background-color: #81a3e6;
|
||||
padding: 20px 15px;
|
||||
|
||||
&.critical {
|
||||
|
7
util.lua
7
util.lua
@ -137,12 +137,7 @@ function util.bton(b)
|
||||
end
|
||||
|
||||
function util.stob(s)
|
||||
if s == "true" then
|
||||
return true
|
||||
end
|
||||
if s == "false" then
|
||||
return false
|
||||
end
|
||||
return s == "true"
|
||||
end
|
||||
|
||||
function util.form_bool_to_sqlite(s)
|
||||
|
@ -1,6 +1,8 @@
|
||||
<%
|
||||
local is_locked = ntob(thread.is_locked)
|
||||
local is_stickied = ntob(thread.is_stickied)
|
||||
local can_post = (not is_locked and not me:is_guest()) or me:is_mod()
|
||||
local can_lock = me.id == thread.user_id or me:is_mod()
|
||||
%>
|
||||
<% if infobox then %>
|
||||
<% render("views.common.infobox", infobox) %>
|
||||
@ -8,7 +10,24 @@
|
||||
<main>
|
||||
<nav class="darkbg">
|
||||
<h1 class="thread-title"><%= thread.title %></h1>
|
||||
<span>Posted in <a href="<%= url_for("topic", {slug = topic.slug}) %>"><%= topic.name %></a></span>
|
||||
<span>Posted in <a href="<%= url_for("topic", {slug = topic.slug}) %>"><%= topic.name %></a>
|
||||
<% if is_stickied then %> • <i>stickied, so it's probably important</i>
|
||||
<% end %>
|
||||
</span>
|
||||
<% if can_lock then %>
|
||||
<div>
|
||||
<form class="modform" action="<%= url_for("thread_lock", {slug = thread.slug}) %>" method="post">
|
||||
<input type=hidden value="<%= not is_locked %>" name="target_op">
|
||||
<input class="warn" type="submit" value="<%= is_locked and "Unlock thread" or "Lock thread" %>">
|
||||
</form>
|
||||
<% if me:is_mod() then %>
|
||||
<form class="modform" action="<%= url_for("thread_sticky", {slug = thread.slug}) %>" method="post">
|
||||
<input type=hidden value="<%= not is_stickied %>" name="target_op">
|
||||
<input class="warn" type="submit" value="<%= is_stickied and "Unsticky thread" or "Sticky thread" %>">
|
||||
</form>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% for i, post in ipairs(posts) do %>
|
||||
<% render("views.threads.post", {post = post, render_sig = true, is_latest = i == #posts}) %>
|
||||
|
@ -21,6 +21,7 @@
|
||||
<input type="hidden" name="is_locked" value="<%= not is_locked %>">
|
||||
<input class="warn" type="submit" id="lock" value="<%= is_locked and "Unlock topic" or "Lock topic" %>">
|
||||
</form>
|
||||
<button type="button" class="critical" id="topic-delete-dialog-open">Delete</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</nav>
|
||||
@ -70,3 +71,15 @@
|
||||
<nav id="bottomnav">
|
||||
<% render("views.common.pagination", {page_count = pages, current_page = page}) %>
|
||||
</nav>
|
||||
<dialog id="delete-dialog">
|
||||
<div class=delete-dialog-inner>
|
||||
Are you sure you want to delete this topic?
|
||||
<span>
|
||||
<button id=topic-delete-dialog-close>Cancel</button>
|
||||
<button class="critical" form=topic-delete-form>Delete</button>
|
||||
<form id="topic-delete-form" method="post" action="<%= url_for("topic_delete", {slug = topic.slug}) %>"></form>
|
||||
</span>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<script src="/static/js/topic.js"></script>
|
||||
|
@ -6,6 +6,10 @@
|
||||
<% end %>
|
||||
</nav>
|
||||
|
||||
<% if infobox then %>
|
||||
<% render("views.common.infobox", infobox) %>
|
||||
<% end %>
|
||||
|
||||
<% if #topic_list == 0 then %>
|
||||
<p>There are no topics.</p>
|
||||
<% else %>
|
||||
|
Loading…
Reference in New Issue
Block a user