Skip to content

Commit

Permalink
Change comments code to use polymorphism via Jinja Macro
Browse files Browse the repository at this point in the history
Update #63
  • Loading branch information
talha131 committed Nov 28, 2013
1 parent f648103 commit 7083eea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ <h4>Contents</h4>
</nav>
</div>
<div class="span8 article-content">
{% else %}
{% else %}
<div class="span8 offset2 article-content">
{% endif %}

{{ article.content }}
{% include 'comments.html' %}
{% from 'comments.html' import comments with context %}
{{ comments(article) }}
<aside>
<hr/>
{% for an_article in dates %}
Expand Down
6 changes: 4 additions & 2 deletions templates/comments.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
{% macro comments(article) %}
{% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
<section>
{% if article.comments_intro %}
<p id="comment-message">{{ article.comments_intro }} </p>
Expand Down Expand Up @@ -26,4 +27,5 @@
</div>
</div>
</section>
{% endif %}
{% endif %}
{% endmacro %}

0 comments on commit 7083eea

Please sign in to comment.