add: better quote post ui
This commit is contained in:
parent
fb2a9285d2
commit
2b91422d18
8 changed files with 138 additions and 102 deletions
|
@ -54,6 +54,23 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %} {% if quoting -%}
|
||||
<div
|
||||
class="card secondary w-full flex items-center justify-between gap-2 small"
|
||||
>
|
||||
<a
|
||||
class="flex items-center gap-2 flush"
|
||||
href="/post/{{ quoting[1].id }}"
|
||||
>
|
||||
{{ icon "quote" }}
|
||||
<span>{{ quoting[0].username }}'s post</span>
|
||||
</a>
|
||||
|
||||
<a href="?" class="button quaternary small">
|
||||
{{ icon "x" }}
|
||||
<span>{{ text "dialog:action.cancel" }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<div class="card-nest">
|
||||
|
@ -91,7 +108,7 @@
|
|||
<form
|
||||
class="card flex flex-col gap-2"
|
||||
id="create_form"
|
||||
onsubmit="create_post_from_form_town_square(event)"
|
||||
onsubmit="create_post_from_form(event)"
|
||||
>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="content"
|
||||
|
@ -115,7 +132,7 @@
|
|||
{{ components::create_post_options() }}
|
||||
|
||||
<div class="flex gap-2">
|
||||
{% if draft -%}
|
||||
{% if not quoting -%} {% if draft -%}
|
||||
<button
|
||||
class="secondary small square"
|
||||
title="Save as Draft"
|
||||
|
@ -133,7 +150,7 @@
|
|||
>
|
||||
{{ icon "notepad-text-dashed" }}
|
||||
</button>
|
||||
{%- endif %}
|
||||
{%- endif %} {%- endif %}
|
||||
|
||||
<button class="primary">
|
||||
{{ text "communities:action.create" }}
|
||||
|
@ -143,8 +160,9 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
{% if not quoting -%}
|
||||
<script>
|
||||
async function create_post_from_form_town_square(e) {
|
||||
async function create_post_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger("atto::debounce", ["posts::create"]);
|
||||
|
||||
|
@ -289,6 +307,27 @@
|
|||
});
|
||||
}
|
||||
</script>
|
||||
{% else %}
|
||||
<script>
|
||||
async function create_post_from_form(e) {
|
||||
const id = await trigger("me::repost", [
|
||||
"{{ quoting[1].id }}",
|
||||
e.target.content.value,
|
||||
document.getElementById("community_to_post_to")
|
||||
.selectedOptions[0].value,
|
||||
false,
|
||||
]);
|
||||
|
||||
// update settings
|
||||
await update_settings_maybe(id);
|
||||
|
||||
// redirect
|
||||
setTimeout(() => {
|
||||
window.location.href = `/post/${id}`;
|
||||
}, 100);
|
||||
}
|
||||
</script>
|
||||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue