Parent and child posts
This commit is contained in:
parent
04f888c323
commit
54379b98e0
16 changed files with 334 additions and 58 deletions
|
|
@ -46,6 +46,10 @@
|
|||
</ul>
|
||||
<button hx-post="/post_source" hx-target="#sources" hx-swap="beforeend">+</button>
|
||||
</div>
|
||||
<div>
|
||||
<label>Parent post</label>
|
||||
<input name="parent_post" type="text" value="{% if let Some(parent_id) = post.parent_id %}{{ parent_id }}{% endif %}" />
|
||||
</div>
|
||||
<div>
|
||||
<button>Submit</button>
|
||||
<button hx-get="/post_details/{{ post.id }}">Cancel</button>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
hx-trigger="input changed delay:400ms"
|
||||
hx-target="next .tags-autocomplete"
|
||||
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
|
||||
value=""
|
||||
autofocus
|
||||
/>
|
||||
<ul class="tags-autocomplete" id="search-autocomplete"></ul>
|
||||
|
|
@ -40,7 +39,6 @@
|
|||
hx-trigger="input changed delay:400ms"
|
||||
hx-target="next .tags-autocomplete"
|
||||
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
|
||||
value=""
|
||||
/>
|
||||
<ul class="tags-autocomplete" id="upload-autocomplete"></ul>
|
||||
<input
|
||||
|
|
@ -52,6 +50,13 @@
|
|||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</article>
|
||||
<article>
|
||||
<h2>Create pool</h2>
|
||||
<form method="post" action="/pool">
|
||||
<input class="tags" type="text" id="pool-name" name="name" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</article>
|
||||
<article>
|
||||
<a href="/logout">Log out</a>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
title="{{ post.tags }}"
|
||||
>
|
||||
<img src="/files/{{ post.thumbnail }}" />
|
||||
<div>{{ post.rating }}</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
{% include "post_details.html" %}
|
||||
{% include "post_details.html" %} {% if let Some(parent_post) = parent_post %}
|
||||
<article id="parent-post" hx-swap-oob="outerHTML">
|
||||
<h2>Parent</h2>
|
||||
<a href="/view/{{ parent_post.id }}" title="{{ parent_post.tags }}">
|
||||
<img src="/files/{{ parent_post.thumbnail }}" />
|
||||
<div>{{ parent_post.rating }}</div>
|
||||
</a>
|
||||
</article>
|
||||
{% else %}
|
||||
<article id="parent-post" hx-swap-oob="outerHTML" hidden></article>
|
||||
{% endif %}
|
||||
<ul id="tags-list" hx-swap-oob="outerHTML">
|
||||
{% for tag in tags %}
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<meta property="og:image" content="/files/{{ post.media }}" />
|
||||
<meta property="og:image:width" content="{{ post.width }}" />
|
||||
<meta property="og:image:height" content="{{ post.height }}" />
|
||||
<!-- <meta property="og:image:alt" content="TO-DO" /> -->
|
||||
<meta property="og:image:alt" content="{{ tags_text }}" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="{% if let Some(description) = post.description %}{{ description }}{% endif %}"
|
||||
|
|
@ -34,6 +34,31 @@
|
|||
<h2>Details</h2>
|
||||
{% include "post_details.html" %}
|
||||
</article>
|
||||
{% if let Some(parent_post) = parent_post %}
|
||||
<article id="parent-post">
|
||||
<h2>Parent</h2>
|
||||
<a href="/view/{{ parent_post.id }}" title="{{ parent_post.tags }}">
|
||||
<img src="/files/{{ parent_post.thumbnail }}" />
|
||||
<div>{{ parent_post.rating }}</div>
|
||||
</a>
|
||||
</article>
|
||||
{% else %}
|
||||
<article id="parent-post" hidden></article>
|
||||
{% endif %} {% if !children_posts.is_empty() %}
|
||||
<article>
|
||||
<h2>Child posts</h2>
|
||||
<ul>
|
||||
{% for child_post in children_posts %}
|
||||
<li>
|
||||
<a href="/view/{{ child_post.id }}" title="{{ child_post.tags }}">
|
||||
<img src="/files/{{ child_post.thumbnail }}" />
|
||||
<div>{{ child_post.rating }}</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</article>
|
||||
{% endif %}
|
||||
<article>
|
||||
<h2>Tags</h2>
|
||||
<ul id="tags-list">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue