add: block list stacks
This commit is contained in:
parent
9bb5f38f76
commit
b71ae1f5a4
28 changed files with 700 additions and 219 deletions
85
crates/app/src/public/html/stacks/feed.lisp
Normal file
85
crates/app/src/public/html/stacks/feed.lisp
Normal file
|
@ -0,0 +1,85 @@
|
|||
(text "{% extends \"root.html\" %} {% block head %}")
|
||||
(title
|
||||
(text "{{ stack.name }} - {{ config.name }}"))
|
||||
|
||||
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
|
||||
(main
|
||||
("class" "flex flex-col gap-2")
|
||||
(text "{{ macros::timelines_nav(selected=\"stacks\") }}")
|
||||
(div
|
||||
("class" "card-nest w-full")
|
||||
(div
|
||||
("class" "card small flex items-center justify-between gap-2")
|
||||
(div
|
||||
("class" "flex items-center gap-2")
|
||||
(text "{{ icon \"list\" }}")
|
||||
(span
|
||||
(text "{{ stack.name }}")))
|
||||
(text "{% if user and user.id == stack.owner -%}")
|
||||
(a
|
||||
("href" "/stacks/{{ stack.id }}/manage")
|
||||
("class" "button lowered small")
|
||||
(text "{{ icon \"pencil\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.manage\" }}")))
|
||||
(text "{%- endif %}"))
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(text "{% if list|length == 0 -%}")
|
||||
(p
|
||||
(text "No items yet! Maybe ")
|
||||
(a
|
||||
("href" "/stacks/{{ stack.id }}/manage#/users")
|
||||
(text "add a user to this stack"))
|
||||
(text "!"))
|
||||
(text "{%- endif %}")
|
||||
|
||||
(text "{% if stack.mode == 'BlockList' -%}")
|
||||
(text "{% if not is_blocked -%}")
|
||||
(button
|
||||
("onclick" "block_all()")
|
||||
(str (text "stacks:label.block_all")))
|
||||
(text "{% else %}")
|
||||
(button
|
||||
("onclick" "block_all(false)")
|
||||
(str (text "stacks:label.unblock_all")))
|
||||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "flex gap-2 flex-wrap w-full")
|
||||
(text "{% for user in list %} {{ components::user_plate(user=user, secondary=true) }} {% endfor %}"))
|
||||
(text "{% else %}")
|
||||
(text "{% for post in list %}
|
||||
{% if post[2].read_access == \"Everybody\" -%}
|
||||
{% if post[0].context.repost and post[0].context.repost.reposting -%}
|
||||
{{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true) }}
|
||||
{% else %}
|
||||
{{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], poll=post[5]) }}
|
||||
{%- endif %} {%- endif %} {% endfor %}")
|
||||
(text "{%- endif %} {{ components::pagination(page=page, items=list|length) }}"))))
|
||||
|
||||
(script
|
||||
(text "async function block_all(block = true) {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Are you sure you would like to do this?\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(\"/api/v1/stacks/{{ stack.id }}/block\", {
|
||||
method: block ? \"POST\" : \"DELETE\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = \"/settings#/account/blocks\";
|
||||
}
|
||||
});
|
||||
}"))
|
||||
(text "{% endblock %}")
|
Loading…
Add table
Add a link
Reference in a new issue