mirror of
https://github.com/sb745/NyaaV3.git
synced 2025-12-23 04:35:45 +02:00
view: various small improvements
1. Don't render an edit form for comments that can no longer be edited. 2. Use the markdown editor that has a preview, because duh. 3. Don't make the infobubble JS error out on pages without the infobubble.
This commit is contained in:
parent
5da7635164
commit
97aef583d6
3 changed files with 7 additions and 3 deletions
|
|
@ -352,6 +352,7 @@ a.text-purple:hover, a.text-purple:active, a.text-purple:focus {
|
|||
|
||||
#comment {
|
||||
height: 8em;
|
||||
min-height: 8em;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
|
|
|
|||
|
|
@ -268,6 +268,9 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
// Info bubble stuff
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var bubble = document.getElementById('infobubble');
|
||||
if (!bubble) {
|
||||
return;
|
||||
}
|
||||
if (Number(localStorage.getItem('infobubble_dismiss_ts')) < Number(bubble.dataset.ts)) {
|
||||
bubble.removeAttribute('hidden');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<meta property="og:description" content="{{ category_name(torrent.sub_category.id_as_string) }} | {{ torrent.filesize | filesizeformat(True) }} | Uploaded by {{ uploader_name }} on {{ torrent.created_time.strftime('%Y-%m-%d') }}">
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
{% from "_formhelpers.html" import render_field, render_markdown_editor %}
|
||||
<div class="panel panel-{% if torrent.deleted %}deleted{% elif torrent.remake %}danger{% elif torrent.trusted %}success{% else %}default{% endif %}">
|
||||
<div class="panel-heading"{% if torrent.hidden %} style="background-color: darkgray;"{% endif %}>
|
||||
<h3 class="panel-title">
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
<div class="row comment-body">
|
||||
{# Escape newlines into html entities because CF strips blank newlines #}
|
||||
<div markdown-text class="comment-content" id="torrent-comment{{ comment.id }}">{{- comment.text | escape | replace('\r\n', '\n') | replace('\n', ' '|safe) -}}</div>
|
||||
{% if g.user.id == comment.user_id and comment_form %}
|
||||
{% if g.user.id == comment.user_id and comment_form and not comment.editing_limit_exceeded and (not torrent.comment_locked or g.user.is_moderator) %}
|
||||
<form class="edit-comment-box" action="{{ url_for('torrents.edit_comment', torrent_id=torrent.id, comment_id=comment.id) }}" method="POST">
|
||||
{{ comment_form.csrf_token }}
|
||||
<div class="form-group">
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
{{ comment_form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ render_field(comment_form.comment, class_='form-control') }}
|
||||
{{ render_markdown_editor(comment_form.comment) }}
|
||||
</div>
|
||||
</div>
|
||||
{% if config.USE_RECAPTCHA and g.user.age < config['ACCOUNT_RECAPTCHA_AGE'] %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue