add: finish forge stuff
This commit is contained in:
parent
53fb4d5778
commit
68071b96c8
21 changed files with 329 additions and 18 deletions
|
@ -27,6 +27,7 @@
|
|||
--color-red: hsl(0, 84%, 40%);
|
||||
--color-green: hsl(100, 84%, 20%);
|
||||
--color-yellow: hsl(41, 63%, 75%);
|
||||
--color-purple: hsl(284, 84%, 20%);
|
||||
--radius: 6px;
|
||||
--circle: 360px;
|
||||
--shadow-x-offset: 0;
|
||||
|
@ -63,6 +64,7 @@
|
|||
--color-red: hsl(0, 94%, 82%);
|
||||
--color-green: hsl(100, 94%, 82%);
|
||||
--color-yellow: hsl(41, 63%, 65%);
|
||||
--color-purple: hsl(284, 94%, 82%);
|
||||
}
|
||||
|
||||
* {
|
||||
|
|
|
@ -179,6 +179,14 @@
|
|||
color: var(--color-green) !important;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color: var(--color-yellow) !important;
|
||||
}
|
||||
|
||||
.purple {
|
||||
color: var(--color-purple) !important;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,6 @@
|
|||
(div
|
||||
("style" "display: contents")
|
||||
(text "{{ self::post(post=post, owner=owner, secondary=secondary, community=community, show_community=show_community, can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}"))
|
||||
|
||||
(text "{%- endmacro %} {% macro post(post, owner, question=false, secondary=false, community=false, show_community=true, can_manage_post=false, repost=false, expect_repost=false, poll=false, dont_show_title=false) -%} {% if community and show_community and community.id != config.town_square or question %}")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
|
@ -174,7 +173,19 @@
|
|||
("class" "flex items-center")
|
||||
("style" "color: var(--color-primary)")
|
||||
(text "{{ icon \"square-asterisk\" }}"))
|
||||
(text "{%- endif %} {% if post.context.repost and post.context.repost.reposting %}")
|
||||
(text "{%- endif %}")
|
||||
(text "{% if community and community.is_forge -%} {% if post.is_open -%}")
|
||||
(span
|
||||
("title" "Open")
|
||||
("class" "flex items-center green")
|
||||
(text "{{ icon \"circle-dot\" }}"))
|
||||
(text "{% else %}")
|
||||
(span
|
||||
("title" "Closed")
|
||||
("class" "flex items-center purple")
|
||||
(text "{{ icon \"circle-check\" }}"))
|
||||
(text "{%- endif %} {%- endif %}")
|
||||
(text "{% if post.context.repost and post.context.repost.reposting %}")
|
||||
(span
|
||||
("title" "Repost")
|
||||
("class" "flex items-center")
|
||||
|
@ -215,7 +226,7 @@
|
|||
; title
|
||||
(text "{% if post.title and community and community.context.enable_titles -%}")
|
||||
(h2 (text "{{ post.title }}"))
|
||||
(hr ("class" "margin"))
|
||||
(hr ("class" "margin") ("style" "margin-top: var(--pad-2)"))
|
||||
(text "{%- endif %}")
|
||||
|
||||
; content
|
||||
|
@ -323,7 +334,23 @@
|
|||
(text "{{ icon \"quote\" }}")
|
||||
(span
|
||||
(text "{{ text \"communities:label.quote_post\" }}")))
|
||||
(text "{%- endif %} {% if user.id != post.owner -%}")
|
||||
(text "{%- endif %}")
|
||||
(text "{% if community and community.is_forge -%} {% if post.is_open -%}")
|
||||
(button
|
||||
("class" "green")
|
||||
("onclick" "trigger('me::update_open', ['{{ post.id }}', false])")
|
||||
(text "{{ icon \"circle-check\" }}")
|
||||
(span
|
||||
(text "{{ text \"forge:action.close\" }}")))
|
||||
(text "{% else %}")
|
||||
(button
|
||||
("class" "purple")
|
||||
("onclick" "trigger('me::update_open', ['{{ post.id }}', true])")
|
||||
(text "{{ icon \"refresh-ccw-dot\" }}")
|
||||
(span
|
||||
(text "{{ text \"forge:action.reopen\" }}")))
|
||||
(text "{%- endif %} {%- endif %}")
|
||||
(text "{% if user.id != post.owner -%}")
|
||||
(b
|
||||
("class" "title")
|
||||
(text "{{ text \"general:label.safety\" }}"))
|
||||
|
@ -1746,3 +1773,42 @@
|
|||
(text "{%- endif %}"))
|
||||
(text "{%- endif %}")
|
||||
(text "{%- endmacro %}")
|
||||
|
||||
(text "{% macro ticket(post, owner) -%}")
|
||||
(div
|
||||
("href" "/post/{{ post.id }}")
|
||||
("class" "card secondary w-fill flex flex-col gap-2")
|
||||
(div
|
||||
("class" "flex gap-2 items-center")
|
||||
; user info
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"24px\", selector_type=\"username\") }}"))
|
||||
(span
|
||||
("class" "name")
|
||||
(text "{{ self::full_username(user=owner) }}"))
|
||||
|
||||
; timestamp
|
||||
(span ("class" "date") (text "{{ post.created }}")))
|
||||
|
||||
; post title
|
||||
(a
|
||||
("href" "/post/{{ post.id }}")
|
||||
("class" "flush flex gap-2 items-center")
|
||||
; open/closed icon
|
||||
(text "{% if community and community.is_forge -%} {% if post.is_open -%}")
|
||||
(span
|
||||
("title" "Open")
|
||||
("class" "flex items-center green")
|
||||
(text "{{ icon \"circle-dot\" }}"))
|
||||
(text "{% else %}")
|
||||
(span
|
||||
("title" "Closed")
|
||||
("class" "flex items-center purple")
|
||||
(text "{{ icon \"circle-check\" }}"))
|
||||
(text "{%- endif %} {%- endif %}")
|
||||
|
||||
(h4
|
||||
("class" "no_p_margin")
|
||||
(text "{{ post.title|markdown|safe }}"))))
|
||||
(text "{%- endmacro %}")
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
("class" "flex flex-col gap-4 w-full")
|
||||
(text "{{ macros::forge_nav(community=community, selected=\"info\") }}")
|
||||
(text "{{ components::community_info(community=community) }}"))
|
||||
; (text "{{ components::community_banner(id=community.id, community=community) }}")
|
||||
(text "{% endblock %}")
|
||||
|
|
18
crates/app/src/public/html/forge/tickets.lisp
Normal file
18
crates/app/src/public/html/forge/tickets.lisp
Normal file
|
@ -0,0 +1,18 @@
|
|||
(text "{% extends \"forge/base.html\" %} {% block content %}")
|
||||
(div
|
||||
("class" "flex flex-col gap-4 w-full")
|
||||
(text "{{ macros::forge_nav(community=community, selected=\"tickets\") }}")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "circle-dot"))
|
||||
(str (text "forge:tab.tickets")))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(text "{% for post in feed -%}")
|
||||
(text "{{ components::ticket(post=post[0], owner=post[1]) }}")
|
||||
(text "{%- endfor %}")
|
||||
(text "{{ components::pagination(page=page, items=feed|length) }}"))))
|
||||
(text "{% endblock %}")
|
|
@ -135,6 +135,31 @@
|
|||
});
|
||||
});
|
||||
|
||||
self.define("update_open", async (_, id, status) => {
|
||||
if (
|
||||
!(await trigger("atto::confirm", [
|
||||
"Are you sure you want to do this?",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`/api/v1/posts/${id}/open`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ open: status }),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger("atto::toast", [
|
||||
res.ok ? "success" : "error",
|
||||
res.message,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
self.define("react", async (_, element, asset, asset_type, is_like) => {
|
||||
await trigger("atto::debounce", ["reactions::toggle"]);
|
||||
fetch("/api/v1/reactions", {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue