summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-07-10 11:23:31 +0000
committerluxagraf <sng@luxagraf.net>2015-07-10 11:23:31 +0000
commit66e3ed2c34a8e751eb200b9c8e3c593208a2afa2 (patch)
treeba86ceed762928aa6233e16c891dac950a428941
parent157298ce0fba338dd15edb9a23388e8ad107c4fe (diff)
fixed some bugs in enable_comments
-rw-r--r--app/blog/admin.py1
-rw-r--r--design/templates/details/entry.html11
2 files changed, 9 insertions, 3 deletions
diff --git a/app/blog/admin.py b/app/blog/admin.py
index c30244e..34c858d 100644
--- a/app/blog/admin.py
+++ b/app/blog/admin.py
@@ -60,6 +60,7 @@ class EntryAdmin(OSMGeoAdmin):
'meta_description',
('image', 'thumbnail'),
'template_name',
+ 'enable_comments',
),
}),
)
diff --git a/design/templates/details/entry.html b/design/templates/details/entry.html
index 1641ace..ce71987 100644
--- a/design/templates/details/entry.html
+++ b/design/templates/details/entry.html
@@ -71,22 +71,26 @@ class="{%if t == 0 or t == 2 %}single{%endif%}{%if t == 1 or t == 3 %}double{%en
{% include 'mailing_list.html' %}
</div> {% endcomment %}
</main>
-
-{% get_comment_count for object as comment_count %}.
+ {% if object.enable_comments %}
+{% get_comment_count for object as comment_count %}
{%if comment_count > 0 %}
<p class="comments--header">{{comment_count}} Comment{{ comment_count|pluralize }}</p>
{% render_comment_list for object %}
{%endif%}
{% render_comment_form for object %}
+{% else %}
+<p class="comments--header" style="text-align: center">Sorry, comments have been disabled for this post.</p>
+{%endif%}
{% endblock %}
{% block js %}
{% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %}
<script src="/media/js/leaflet-master/leaflet-mod.js"></script>
<script src="/media/js/detail.min.js"></script>
{%endif%}{%endwith%}
-
<script type="text/javascript">
window.onload = function() {
+ {% if object.enable_comments %}
+{% get_comment_count for object as comment_count %}
{%if comment_count > 0 %}
//delay loading of gravatar images using noscript data-hash attribute
dataattr = document.getElementsByClassName("datahashloader");
@@ -98,6 +102,7 @@ window.onload = function() {
c.insertBefore(img, c.childNodes[3]);
}
{%endif%}
+{%endif%}
{% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %}
createMap();
var open = false;