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 { .lat_padding {
padding: 0px 8px; padding: 0px 8px;
} }

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

Loading…
Cancel
Save