add: polls
This commit is contained in:
parent
4dfa09207e
commit
6555324650
29 changed files with 339 additions and 56 deletions
|
@ -151,6 +151,13 @@
|
|||
.querySelector(\"button.primary\")
|
||||
.classList.add(\"hidden\");
|
||||
|
||||
// poll
|
||||
const poll_data = get_poll_data();
|
||||
|
||||
if (!poll_data[0]) {
|
||||
return alert(poll_data[1]);
|
||||
}
|
||||
|
||||
// create body
|
||||
const body = new FormData();
|
||||
|
||||
|
@ -167,6 +174,7 @@
|
|||
community: document.getElementById(
|
||||
\"community_to_post_to\",
|
||||
).selectedOptions[0].value,
|
||||
poll: poll_data[1],
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
(text "{{ text \"communities:label.pinned\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in pinned %} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[2], post=post[0], owner=post[1], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {%- endif %} {% endfor %}")))
|
||||
(text "{% for post in pinned %} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[2], post=post[0], owner=post[1], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, can_manage_post=can_manage_posts, poll=post[4]) }} {%- endif %} {% endfor %}")))
|
||||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
|
@ -22,6 +22,6 @@
|
|||
(text "{{ text \"communities:label.posts\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in feed %} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[2], post=post[0], owner=post[1], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=feed|length) }}"))))
|
||||
(text "{% for post in feed %} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[2], post=post[0], owner=post[1], secondary=true, show_community=false, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, can_manage_post=can_manage_posts, poll=post[4]) }} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=feed|length) }}"))))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -60,6 +60,13 @@
|
|||
e.preventDefault();
|
||||
await trigger(\"atto::debounce\", [\"posts::create\"]);
|
||||
|
||||
// poll
|
||||
const poll_data = get_poll_data();
|
||||
|
||||
if (!poll_data[0]) {
|
||||
return alert(poll_data[1]);
|
||||
}
|
||||
|
||||
// create body
|
||||
const body = new FormData();
|
||||
|
||||
|
@ -75,6 +82,7 @@
|
|||
content: e.target.content.value,
|
||||
community: community ? community : \"{{ config.town_square }}\",
|
||||
answering,
|
||||
poll: poll_data[1],
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -222,6 +222,9 @@
|
|||
(text "{%- endif %} {%- endif %}"))
|
||||
(text "{{ self::post_media(upload_ids=post.uploads) }}")))
|
||||
(text "{%- endif %}")
|
||||
|
||||
(text "{% if poll -%} {{ self::poll(post=post, poll=poll) }} {%- endif %}")
|
||||
|
||||
(div
|
||||
("class" "flex flex-wrap gap-2 fade")
|
||||
(text "{% for tag in post.context.tags %}")
|
||||
|
@ -1205,6 +1208,14 @@
|
|||
(div
|
||||
("class" "flex gap-2")
|
||||
(text "{{ components::emoji_picker(element_id=\"content\", render_dialog=true) }} {% if not quoting -%} {% if is_supporter -%} {{ components::file_picker(files_list_id=\"files_list\") }} {%- endif %} {%- endif %}")
|
||||
|
||||
(button
|
||||
("class" "small square quaternary")
|
||||
("title" "Add poll")
|
||||
("onclick" "document.getElementById('poll_options_dialog').showModal()")
|
||||
("type" "button")
|
||||
(text "{{ icon \"list-todo\" }}"))
|
||||
|
||||
(button
|
||||
("class" "small square quaternary")
|
||||
("title" "More options")
|
||||
|
@ -1323,4 +1334,155 @@
|
|||
}
|
||||
};"))))
|
||||
|
||||
; poll data manager function and dialog
|
||||
;
|
||||
; `get_poll_data` returns `[bool, string | PollData]`, where the string in arg 1
|
||||
; represents an error message if arg 0 is `false`
|
||||
(script
|
||||
(text "window.POLL_OPTION_A = \"\";
|
||||
window.POLL_OPTION_B = \"\";
|
||||
window.POLL_OPTION_C = \"\";
|
||||
window.POLL_OPTION_D = \"\";
|
||||
|
||||
window.get_poll_data = () => {
|
||||
if (!POLL_OPTION_A && !POLL_OPTION_B) {
|
||||
return [true, null];
|
||||
}
|
||||
|
||||
if (POLL_OPTION_A && !POLL_OPTION_B || POLL_OPTION_B && !POLL_OPTION_A) {
|
||||
return [false, \"At least 2 options are required for a poll\"];
|
||||
}
|
||||
|
||||
return [true, {
|
||||
option_a: POLL_OPTION_A,
|
||||
option_b: POLL_OPTION_B,
|
||||
option_c: POLL_OPTION_C,
|
||||
option_d: POLL_OPTION_D
|
||||
}];
|
||||
}"))
|
||||
|
||||
(dialog
|
||||
("id" "poll_options_dialog")
|
||||
(div
|
||||
("class" "inner flex flex-col gap-2")
|
||||
(div
|
||||
("id" "poll_options")
|
||||
("class" "flex flex-col gap-2")
|
||||
|
||||
(b (text "Attach poll"))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(span
|
||||
(b (text "Option A "))
|
||||
(span ("class" "fade red") (text "(required)")))
|
||||
|
||||
(input ("type" "text") ("placeholder" "option A") ("onchange" "window.POLL_OPTION_A = event.target.value")))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(span
|
||||
(b (text "Option B "))
|
||||
(span ("class" "fade red") (text "(required)")))
|
||||
|
||||
(input ("type" "text") ("placeholder" "option B") ("onchange" "window.POLL_OPTION_B = event.target.value")))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(b (text "Option C"))
|
||||
(input ("type" "text") ("placeholder" "option A") ("onchange" "window.POLL_OPTION_C = event.target.value")))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(b (text "Option D"))
|
||||
(input ("type" "text") ("placeholder" "option D") ("onchange" "window.POLL_OPTION_D = event.target.value"))))
|
||||
(hr)
|
||||
(div
|
||||
("class" "flex justify-between")
|
||||
(div)
|
||||
(div
|
||||
("class" "flex gap-2")
|
||||
(button
|
||||
("class" "bold red quaternary")
|
||||
("onclick" "document.getElementById('poll_options_dialog').close()")
|
||||
("type" "button")
|
||||
(text "{{ icon \"x\" }} {{ text \"dialog:action.close\" }}"))))))
|
||||
|
||||
(text "{%- endmacro %}")
|
||||
(text "{% macro poll(post, poll) -%}")
|
||||
(div
|
||||
("class" "card tertiary w-full flex flex-col gap-2")
|
||||
(text "{% set total = poll[0].votes_a + poll[0].votes_b + poll[0].votes_c + poll[0].votes_d %}")
|
||||
|
||||
(text "{% if poll[1] -%}")
|
||||
; already voted, show results
|
||||
(span ("class" "fade") (text "You've already voted!"))
|
||||
|
||||
; option a
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(span (text "{{ poll[0].option_a }} ({{ poll[0].votes_a }} votes)"))
|
||||
(div ("class" "poll_bar") ("style" "width: {{ (poll[0].votes_a / total) * 100 }}%")))
|
||||
|
||||
; option b
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(span (text "{{ poll[0].option_b }} ({{ poll[0].votes_b }} votes)"))
|
||||
(div ("class" "poll_bar") ("style" "width: {{ (poll[0].votes_b / total) * 100 }}%")))
|
||||
|
||||
; option c
|
||||
(text "{% if poll[0].option_c -%}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(span (text "{{ poll[0].option_c }} ({{ poll[0].votes_c }} votes)"))
|
||||
(div ("class" "poll_bar") ("style" "width: {{ (poll[0].votes_c / total) * 100 }}%")))
|
||||
(text "{%- endif %}")
|
||||
|
||||
; option d
|
||||
(text "{% if poll[0].option_d -%}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(span (text "{{ poll[0].option_d }} ({{ poll[0].votes_d }} votes)"))
|
||||
(div ("class" "poll_bar") ("style" "width: {{ (poll[0].votes_d / total) * 100 }}%")))
|
||||
(text "{%- endif %}")
|
||||
(text "{% else %}")
|
||||
; not voted yet, just show options so user can vote
|
||||
|
||||
; option a
|
||||
(button
|
||||
("class" "hover_left_bar tertiary justify-start w-full")
|
||||
("onclick" "trigger('me::vote', ['{{ post.id }}', 'A'])")
|
||||
(icon (text "tally-1"))
|
||||
(text "{{ poll[0].option_a }}"))
|
||||
|
||||
; option b
|
||||
(button
|
||||
("class" "hover_left_bar tertiary justify-start w-full")
|
||||
("onclick" "trigger('me::vote', ['{{ post.id }}', 'B'])")
|
||||
(icon (text "tally-2"))
|
||||
(text "{{ poll[0].option_b }}"))
|
||||
|
||||
; option c
|
||||
(text "{% if poll[0].option_c -%}")
|
||||
(button
|
||||
("class" "hover_left_bar tertiary justify-start w-full")
|
||||
("onclick" "trigger('me::vote', ['{{ post.id }}', 'C'])")
|
||||
(icon (text "tally-3"))
|
||||
(text "{{ poll[0].option_c }}"))
|
||||
(text "{%- endif %}")
|
||||
|
||||
; option d
|
||||
(text "{% if poll[0].option_d -%}")
|
||||
(button
|
||||
("class" "hover_left_bar tertiary justify-start w-full")
|
||||
("onclick" "trigger('me::vote', ['{{ post.id }}', 'D'])")
|
||||
(icon (text "tally-4"))
|
||||
(text "{{ poll[0].option_d }}"))
|
||||
(text "{%- endif %}")
|
||||
(text "{%- endif %}")
|
||||
|
||||
; show expiration date + totals
|
||||
(div
|
||||
("class" "flex w-full flex-wrap gap-2")
|
||||
(span ("class" "notification chip") (text "{{ total }} votes"))))
|
||||
(text "{%- endmacro %}")
|
||||
|
|
|
@ -179,6 +179,13 @@
|
|||
e.preventDefault();
|
||||
await trigger(\"atto::debounce\", [\"posts::create\"]);
|
||||
|
||||
// poll
|
||||
const poll_data = get_poll_data();
|
||||
|
||||
if (!poll_data[0]) {
|
||||
return alert(poll_data[1]);
|
||||
}
|
||||
|
||||
// create body
|
||||
const body = new FormData();
|
||||
|
||||
|
@ -194,6 +201,7 @@
|
|||
content: e.target.content.value,
|
||||
community: \"{{ config.town_square }}\",
|
||||
answering,
|
||||
poll: poll_data[1],
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
(text "{%- endif %}")
|
||||
(div
|
||||
("style" "display: contents;")
|
||||
(text "{% if post.context.repost and post.context.repost.reposting -%} {{ components::repost(repost=reposting, post=post, owner=owner, community=community, show_community=true, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post, owner=owner, question=question, community=community, show_community=true, can_manage_post=can_manage_posts) }} {%- endif %}"))
|
||||
(text "{% if post.context.repost and post.context.repost.reposting -%} {{ components::repost(repost=reposting, post=post, owner=owner, community=community, show_community=true, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post, owner=owner, question=question, community=community, show_community=true, can_manage_post=can_manage_posts, poll=poll) }} {%- endif %}"))
|
||||
(text "{% if user and post.context.comments_enabled -%}")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
|
@ -273,13 +273,20 @@
|
|||
(text "{{ text \"communities:label.replies\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in replies %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false) }} {% endfor %} {{ components::pagination(page=page, items=replies|length) }}"))))
|
||||
(text "{% for post in replies %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, poll=post[4]) }} {% endfor %} {{ components::pagination(page=page, items=replies|length) }}"))))
|
||||
|
||||
(script
|
||||
(text "async function create_reply_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger(\"atto::debounce\", [\"posts::create\"]);
|
||||
|
||||
// poll
|
||||
const poll_data = get_poll_data();
|
||||
|
||||
if (!poll_data[0]) {
|
||||
return alert(poll_data[1]);
|
||||
}
|
||||
|
||||
// create body
|
||||
const body = new FormData();
|
||||
|
||||
|
@ -295,6 +302,7 @@
|
|||
content: e.target.content.value,
|
||||
community: \"{{ community.id }}\",
|
||||
replying_to: \"{{ post.id }}\",
|
||||
poll: poll_data[1],
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -64,6 +64,6 @@
|
|||
(text "{{ text \"communities:label.quotes\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in list %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false) }} {% endfor %} {{ components::pagination(page=page, items=list|length, key=\"quotes\", value=\"true\") }}"))))
|
||||
(text "{% for post in list %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, poll=post[4]) }} {% endfor %} {{ components::pagination(page=page, items=list|length, key=\"quotes\", value=\"true\") }}"))))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
(text "{%- endif %}"))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}")))
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(text "{{ text \"communities:label.pinned\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in pinned %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self) }} {%- endif %} {%- endif %} {% endfor %}")))
|
||||
(text "{% for post in pinned %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %}")))
|
||||
|
||||
(text "{%- endif %} {{ macros::profile_nav(selected=\"posts\") }}")
|
||||
(div
|
||||
|
@ -41,6 +41,6 @@
|
|||
(text "{%- endif %}"))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length, key=\"&tag=\", value=tag) }}")))
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length, key=\"&tag=\", value=tag) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
(text "{%- endif %}"))
|
||||
(div
|
||||
("class" "card flex flex-col gap-4")
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}")))
|
||||
(text "{% for post in posts %} {% 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, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -32,6 +32,6 @@
|
|||
("href" "/stacks/{{ stack.id }}/manage#/users")
|
||||
(text "add a user to this stack"))
|
||||
(text "!"))
|
||||
(text "{%- endif %} {% 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]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}"))))
|
||||
(text "{%- endif %} {% 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 %} {{ components::pagination(page=page, items=list|length) }}"))))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(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[3]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
(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 %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
(text "{{ macros::timelines_nav(selected=\"following\") }} {{ macros::timelines_secondary_nav(posts=\"/following\", questions=\"/following/questions\") }}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(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]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
(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 %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
(text "{% else %}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(text "{% for post in list %} {% 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]) }} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}"))
|
||||
(text "{% for post in list %} {% 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 %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}"))
|
||||
(text "{%- endif %}"))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
(text "{{ macros::timelines_nav(selected=\"popular\") }} {{ macros::timelines_secondary_nav(posts=\"/popular\", questions=\"/popular/questions\") }}")
|
||||
(div
|
||||
("class" "card w-full flex flex-col gap-2")
|
||||
(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]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
(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 %} {{ components::pagination(page=page, items=list|length) }}")))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
|
@ -56,6 +56,6 @@
|
|||
(text "{{ icon \"circle-help\" }}"))
|
||||
(text "{%- endif %}"))))
|
||||
(text "{%- endif %}")
|
||||
(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]) }} {%- endif %} {%- endif %} {% endfor %} {% if profile -%} {{ components::pagination(page=page, items=list|length, key=\"&profile=\" ~ profile.id, value=\"&query=\" ~ query) }} {% else %} {{ components::pagination(page=page, items=list|length, key=\"&query=\" ~ query) }} {%- endif %}"))))
|
||||
(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 %} {% if profile -%} {{ components::pagination(page=page, items=list|length, key=\"&profile=\" ~ profile.id, value=\"&query=\" ~ query) }} {% else %} {{ components::pagination(page=page, items=list|length, key=\"&query=\" ~ query) }} {%- endif %}"))))
|
||||
|
||||
(text "{% endblock %}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue