minor UI improvements

master
Laurent Morvillier 6 years ago
parent de50d9b4e9
commit 63afd47962
  1. 9
      news/static/news/css/app.css
  2. 193
      news/templates/news/post.html

@ -143,15 +143,6 @@ a h1 {
}
}
/* .post_padding h1 {
line-height: 100%;
}
@media print, screen and (min-width: 40em) {
.post_padding h1 {
line-height: 70%;
}
} */
.lat_padding {
padding: 0px 8px;
}

@ -6,114 +6,125 @@
{% block content %}
<div class="post_padding">
{% if post.style == 1 %}
<div class="quote">
{% endif %}
{% if post.style != 2 %}
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
{% endif %}
{% if post.style == 1 %}
<article>
<div class="post_padding">
{% if post.style == 1 %}
<div class="quote">
{% endif %}
{% if post.style != 2 %}
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
{% endif %}
{% if post.style == 1 %}
</div>
{% endif %}
<div class="details">
{{ post.date }} - {{ post.author.username }}
</div>
</div>
{% if post.style == 3 %}
<iframe class="youtube" src="https://www.youtube.com/embed/{{ post.url }}"></iframe>
{% elif post.style != 1 %}
<img src="{% static 'media/' %}{{ post.image_url }}"/>
{% endif %}
<div class="details">
{{ post.date }} - {{ post.author.username }}
</div>
</div>
<div class="post_padding">
{% if post.style == 3 %}
<iframe class="youtube" src="https://www.youtube.com/embed/{{ post.url }}"></iframe>
{% elif post.style != 1 %}
<img src="{% static 'media/' %}{{ post.image_url }}"/>
{% endif %}
<div class="post_padding">
{% if post.style == 0 %}
<p class="contentbody">
{{ post.body }}
</p>
{% endif %}
<br/>
{% if user.is_authenticated %}
<form action="{% url 'news:comment' post.id %}" method="post">
{% csrf_token %}
<p>Add comment</p>
<p>
<textarea name="body" rows="3" cols="50"></textarea>
</p>
<button class="primary_button" type="submit">Submit</button>
</form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to comment the post
{% if post.style == 0 %}
<p class="contentbody">
{{ post.body }}
</p>
{% endif %}
<script type="text/javascript">
function myFunction(divID) {
var x = document.getElementById("div_" + divID);
if (x.style.display === "none") {
x.style.display = "block";
window.location.hash = "sub_" + divID;
document.getElementById("text_" + divID).focus();
} else {
x.style.display = "none";
</article>
<br/>
<div class="lat_padding">
{% if user.is_authenticated %}
<form action="{% url 'news:comment' post.id %}" method="post">
{% csrf_token %}
<p>Add comment</p>
<p>
<textarea name="body" rows="3" cols="50"></textarea>
</p>
<button class="primary_button" type="submit">Submit</button>
</form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to comment the post
</p>
{% endif %}
<script type="text/javascript">
function myFunction(divID) {
var x = document.getElementById("div_" + divID);
if (x.style.display === "none") {
x.style.display = "block";
window.location.hash = "sub_" + divID;
document.getElementById("text_" + divID).focus();
} else {
x.style.display = "none";
}
}
}
</script>
<br/>
<!-- Comments -->
{% for comment in comments %}
{% for n in comment.level %}<ul>{% endfor %}
<span class="details info">{{ comment.author.username }} - {{ comment.date }} - score: {{ comment.score }}</span>
<br/>
{{ comment.body }}
<div>
{% if comment.upvoted == False and user.is_authenticated %}
<form action="{% url 'news:upvote' comment.id %}" method="post" class="inline">
{% csrf_token %}
<button class="primary_button" type="submit">+1</button>
</form>
{% endif %}
{% if comment.is_deletable %}
<form action="{% url 'news:delete_comment' comment.id %}" method="post" class="inline">
{% csrf_token %}
<button class="secondary_button" type="submit">delete</button>
</form>
{% endif %}
<button class="secondary_button inline" onclick="myFunction('{{ comment.id }}')">reply</button>
<div id="div_{{ comment.id }}" class="inline reply_form" style="display:none">
{% if user.is_authenticated %}
<form action="{% url 'news:comment_with_parent' post.id comment.id %}" method="post">
</script>
<br/>
<!-- Comments -->
{% for comment in comments %}
{% for n in comment.level %}<ul>{% endfor %}
<span class="details info">{{ comment.author.username }} - {{ comment.date }} - score: {{ comment.score }}</span>
<br/>
{{ comment.body }}
<div>
{% if comment.upvoted == False and user.is_authenticated %}
<form action="{% url 'news:upvote' comment.id %}" method="post" class="inline">
{% csrf_token %}
<textarea id="text_{{ comment.id}}" name="body" rows="3" cols="50"></textarea>
<button id="sub_{{ comment.id}}" class="primary_button" type="submit">Submit</button>
<button class="primary_button" type="submit">+1</button>
</form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to reply
</p>
{% endif %}
{% if comment.is_deletable %}
<form action="{% url 'news:delete_comment' comment.id %}" method="post" class="inline">
{% csrf_token %}
<button class="secondary_button" type="submit">delete</button>
</form>
{% endif %}
<button class="secondary_button inline" onclick="myFunction('{{ comment.id }}')">reply</button>
<div id="div_{{ comment.id }}" class="inline reply_form" style="display:none">
{% if user.is_authenticated %}
<form action="{% url 'news:comment_with_parent' post.id comment.id %}" method="post">
{% csrf_token %}
<textarea id="text_{{ comment.id}}" name="body" rows="3" cols="50"></textarea>
<button id="sub_{{ comment.id}}" class="primary_button" type="submit">Submit</button>
</form>
{% else %}
<p>
Please <a href="{% url 'news:signin' %}">login</a> to reply
</p>
{% endif %}
</div>
</div>
</div>
{% for n in comment.level %}</ul>{% endfor %}
{% for n in comment.level %}</ul>{% endfor %}
{% endfor %}
{% endfor %}
</div>
</div>
{% endblock content %}

Loading…
Cancel
Save