Files
freedit/templates/post.html
GitHub d6f1ace93f Revert "initial adaptations #228"
This reverts commit 0c33dc1cb5.
2025-12-27 19:06:07 +08:00

254 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "layout.html" %}
{% block csp %}
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
img-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none';
font-src 'none'; form-action 'self'; frame-src 'none'; media-src 'none'; manifest-src 'none'; worker-src 'none';">
{% endblock %}
{% block tabs %}
<li><a href="/inn/0">{{ "inn"|l10n(page_data.lang) }}</a></li>
<li><a href="/solo/user/0">{{ "solo"|l10n(page_data.lang) }}</a></li>
{% endblock %}
{% block og %}
<meta property="og:description" content="{{ post.og_content|truncate(1000) }}">
<link rel="alternate" type="application/atom+xml" href="/inn/{{ post.iid }}/atom.xml" />
{% endblock %}
{% block content %}
<div class="media box">
<div class="media-content">
<div class="content">
<p class="title">{% if post.is_pinned %} 📌 {% endif %}{{post.title}}</p>
<a href="/inn/{{post.iid}}">⚓ {{post.inn_name}}</a> &nbsp;&nbsp; 📅 {{post.created_at}} &nbsp;&nbsp;
<a href="/user/{{post.uid}}">👤 {{post.username}}</a> &nbsp;&nbsp; 👁️ {{pageview}} &nbsp;&nbsp;
{% if post.can_edit %}
<a href="/post/edit/{{post.pid}}">{{ "edit"|l10n(page_data.lang) }}</a> &nbsp;&nbsp;
{% endif %}
{% if is_mod %}
<a href="/mod/{{post.iid}}/{{post.pid}}/lock">
{% match post.status.as_str() %}
{% when "LockedByMod" %} {{ "unlock"|l10n(page_data.lang) }}
{% else %} {{ "lock"|l10n(page_data.lang) }}
{% endmatch %}
</a> &nbsp;&nbsp;
<a href="/mod/{{post.iid}}/{{post.pid}}/hide">
{% match post.status.as_str() %}
{% when "HiddenByMod" %} {{ "unhide"|l10n(page_data.lang) }}
{% else %} {{ "hide"|l10n(page_data.lang) }}
{% endmatch %}
</a> &nbsp;&nbsp;
<a href="/mod/{{post.iid}}/{{post.pid}}/pin">
{% if post.is_pinned %}
{{ "unpin"|l10n(page_data.lang) }}
{% else %}
{{ "pin"|l10n(page_data.lang) }}
{% endif %}
</a>
{% else if is_author %}
<a href="/mod/{{post.iid}}/{{post.pid}}/lock">
{% match post.status.as_str() %}
{% when "LockedByUser" %} {{ "unlock"|l10n(page_data.lang) }}
{% when "Normal" %} {{ "lock"|l10n(page_data.lang) }}
{% else %}{% endmatch %}
</a> &nbsp;&nbsp;
<a href="/mod/{{post.iid}}/{{post.pid}}/hide">
{% match post.status.as_str() %}
{% when "HiddenByUser" %} {{ "unhide"|l10n(page_data.lang) }}
{% when "Normal" %} {{ "hide"|l10n(page_data.lang) }}
{% when "LockedByUser" %} {{ "hide"|l10n(page_data.lang) }}
{% else %}{% endmatch %}
</a>
{% endif %}
&nbsp;&nbsp;
{% if can_delete %}
<a href="#delete_post">{{ "delete"|l10n(page_data.lang) }}</a>
<div id="delete_post" class="overlay">
<div class="popup content">
<h3>{{ "delete_permanently"|l10n(page_data.lang) }}</h3>
<a class="close" href="#">&times;</a>
<p>{{ "delete_sure"|l10n(page_data.lang) }}</p>
<a href="/post/{{post.iid}}/{{post.pid}}/delete" class="button is-danger">{{ "delete"|l10n(page_data.lang) }}</a>
</div>
</div>
{% endif %}
</div>
</div>
<div class="media-right">
<figure>
<p class="image is-48x48 is-hidden-mobile">
<a href="/user/{{post.uid}}"><img src="/static/avatars/{{post.uid}}.png" alt="{{post.username}}"></a>
</p>
</figure>
</div>
</div>
<div class="box content">
{{post.content_html}}
{% for tag in post.tags %}
<a href="/inn/tag/{{tag}}"><span class="tag is-light is-info">🏷️ {{tag}}</span></a>
{% endfor %}
</div>
<div class="level is-mobile">
<div class="level-item" id="upvote">
{% if post.is_upvoted %}
<a href="/post/{{post.iid}}/{{post.pid}}/upvote#upvote"><span class="tag is-success is-rounded">👍 󠁮󠁮󠁮󠁮{% if post.upvotes >0 %} {{post.upvotes}} {% endif %}</span></a>
{% else %}
<a href="/post/{{post.iid}}/{{post.pid}}/upvote#upvote"><span class="tag is-info is-light is-rounded">👍 󠁮󠁮󠁮󠁮{% if post.upvotes >0 %} {{post.upvotes}} {% endif %}</span></a>
{% endif %}
{% if post.is_downvoted %}
<a href="/post/{{post.iid}}/{{post.pid}}/downvote#downvote"><span class="tag is-success is-rounded">👎 󠁮󠁮󠁮󠁮{% if post.downvotes >0 %} {{post.downvotes}} {% endif %}</span></a>
{% else %}
<a href="/post/{{post.iid}}/{{post.pid}}/downvote#downvote"><span class="tag is-info is-light is-rounded">👎 󠁮󠁮󠁮󠁮{% if post.downvotes >0 %} {{post.downvotes}} {% endif %}</span></a>
{% endif %}
</div>
</div>
{% if comments.len() > 0 %}
<div class="box">
{% for comment in comments %}
<article class="media" id="{{comment.cid}}">
<figure class="media-left is-hidden-mobile">
<p class="image is-48x48">
<a href="/user/{{comment.uid}}"><img src="/static/avatars/{{comment.uid}}.png"></a>
</p>
</figure>
<div class="media-content">
<div class="content">
<p>
<small>
<a href="/user/{{comment.uid}}">{{comment.username}}</a> &nbsp;&nbsp;
{{comment.created_at}}
{% if comment.is_upvoted %}
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/upvote?anchor={{anchor}}&is_desc={{is_desc}}#{{comment.cid}}"><span class="tag is-success is-rounded">👍 {% if comment.upvotes >0 %} {{comment.upvotes}} {% endif %}</span></a>
{% else %}
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/upvote?anchor={{anchor}}&is_desc={{is_desc}}#{{comment.cid}}"><span class="tag is-info is-light is-rounded">👍 {% if comment.upvotes >0 %} {{comment.upvotes}} {% endif %}</span></a>
{% endif %}
{% if comment.is_downvoted %}
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/downvote?anchor={{anchor}}&is_desc={{is_desc}}#{{comment.cid}}"><span class="tag is-success is-rounded">👎 {% if comment.downvotes >0 %} {{comment.downvotes}} {% endif %}</span></a>
{% else %}
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/downvote?anchor={{anchor}}&is_desc={{is_desc}}#{{comment.cid}}"><span class="tag is-info is-light is-rounded">👎 {% if comment.downvotes >0 %} {{comment.downvotes}} {% endif %}</span></a>
{% endif %}
{% if comment.uid == post.uid %}
[op]
{% endif %}
{% if is_mod %}
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/hide">
{% if comment.is_hidden %}
Open
{% else %}
Hide
{% endif %}
</a>
{% endif %}
{% match page_data.claim %} {% when Some with (val) %}
{% if comment.uid == val.uid %}
<a href="#delete_pop_{{comment.cid}}">Delete</a>
<div id="delete_pop_{{comment.cid}}" class="overlay">
<div class="popup content">
<h3>Delete permanently?</h3>
<a class="close" href="#">&times;</a>
<p>Are you sure you want to delete this comment?</p>
<a href="/post/{{post.iid}}/{{post.pid}}/{{comment.cid}}/delete" class="button is-danger">Delete</a>
</div>
</div>
{% endif %}
{% else %}{% endmatch %}
</small>
</p>
{% if comment.is_hidden %}
<p><i>Hidden by mod.</i></p>
{% else %}
{{comment.content}}
{% endif %}
</div>
</div>
<div class="media-right">
<a href="/post/{{post.iid}}/{{post.pid}}?anchor={{anchor}}&is_desc={{is_desc}}#{{comment.cid}}"><span class="tag is-info">{{comment.cid}}</span></a>
</div>
</article>
{% endfor %}
</div>
{% endif %}
{% if post.status.as_str() != "Normal" %}
<div class="content">
{% include "icons/lock.svg" %}
{{post.status}}
</div>
{% else %}
<form class="box" action="/post/{{post.iid}}/{{post.pid}}" method="POST">
<fieldset>
<div class="field">
<label class="label" for="content">New comment</label>
<div class="control">
<div id="editor" class="editor-container textarea" hidden></div>
<noscript>
<style>
#editor { display: none !important; }
</style>
<textarea class="textarea" name="content"
{% if !has_joined %} disabled {% endif %}
required maxlength="10000"
placeholder="comment, markdown supported"></textarea>
<p class="help">
{{ "javascript_is_required_for_rich_editor"|l10n(page_data.lang) }}
</p>
</noscript>
</div>
</div>
<nav class="level is-mobile">
<div class="level-left">
<div class="level-item">
<a href="/upload" class="button is-success is-rounded" target="_blank">{{ "upload"|l10n(page_data.lang) }}</a>
</div>
</div>
<div class="level-right">
<div class="level-item">
<div class="field is-grouped">
<div class="control">
{% match page_data.claim %}
{% when Some with (val) %}
{% if has_joined %}
<button type="submit" class="button is-link is-rounded">{{ "submit"|l10n(page_data.lang) }}</button>
<button type="submit" class="button is-link is-rounded" formaction="/preview" formtarget="_blank">{{ "preview"|l10n(page_data.lang) }}</button>
{% else %}
<a href="/inn/{{post.iid}}/join" class="button is-success is-rounded">{{ "join_to_comment"|l10n(page_data.lang) }}</a>
{% endif %}
{% else %}
<a class="button is-success is-rounded" href="/signin">{{ "sign_in_to_comment"|l10n(page_data.lang) }}</a>
{% endmatch %}
</div>
</div>
</div>
</div>
</nav>
</fieldset>
</form>
{% endif %}
<nav class="pagination">
{% if anchor < n %}
<a class="pagination-previous" disabled>{{ "prev"|l10n(page_data.lang) }}</a>
{% else %}
<a class="pagination-previous" href="/post/{{post.iid}}/{{post.pid}}?anchor={{anchor- n}}&is_desc={{is_desc}}">{{ "prev"|l10n(page_data.lang) }}</a>
{% endif %}
{% if comments.len() < n %}
<a class="pagination-next" disabled>{{ "next"|l10n(page_data.lang) }}</a>
{% else %}
<a class="pagination-next" href="/post/{{post.iid}}/{{post.pid}}?anchor={{anchor + n}}&is_desc={{is_desc}}">{{ "next"|l10n(page_data.lang) }}</a>
{% endif %}
</nav>
{% if has_joined %}
<script src="/static/js/overtype.min.js?v={{ crate::VERSION }}"></script>
{% endif %}
{% endblock %}