Merge branch 'develop'. Fixed Disqus commenting.

master
androiddrew 6 years ago
commit d101ba2b84

@ -3,7 +3,7 @@ version: '3.6'
services:
cms:
image: androiddrew/datasketch:0.2.1
image: androiddrew/datasketch:0.2.2
command: gunicorn cms.wsgi:application --bind 0.0.0.0:5000 --workers 3
deploy:
replicas: 1

@ -68,6 +68,12 @@ class BlogPage(Page):
InlinePanel("gallery_images", label="Gallery images"),
]
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
context["post"] = self
return context
class BlogPageGalleryImage(Orderable):
"""

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% load wagtailcore_tags wagtailimages_tags custom_tags %}
{% block body_class %}helvetica{% endblock %}
@ -18,25 +18,6 @@
{% endif %}
{{ page.body|richtext }}
</article>
<div id="disqus_thread" class="mw8 center"></div>
<script>
{% if commenting %}
var disqus_config = function () {
this.page.url = {{ page.full_url }};
this.page.identifier = {{ page.slug }};
};
{% endif %}
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://datasketch-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{% show_comments %}
{% endblock %}

@ -0,0 +1,15 @@
<div id="disqus_thread" class="mw8 center"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ disqus_url }}";
this.page.identifier = "{{ disqus_identifier }}";
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://datasketch-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

@ -0,0 +1,17 @@
from django.template import Library
from django.conf import settings
register = Library()
@register.inclusion_tag("blog/disqus.html", takes_context=True)
def show_comments(context):
if not settings.COMMENTING:
return {}
new_context = {
"disqus_url": context["request"].get_raw_uri(),
"disqus_identifier": context["post"].slug
}
return new_context

@ -1,7 +0,0 @@
from django.conf import settings
def commenting(context):
"""Template context processor used to check if a COMMENTING setting is True"""
return {"commenting": settings.COMMENTING}

@ -72,7 +72,6 @@ TEMPLATES = [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"cms.context_processors.commenting"
]
},
}

Loading…
Cancel
Save