{% extends "base.html" %}
{% load i18n %}
{% load blogtags %}

{% block main_content %}

{% ifequal article.status 0 %}
<p style="color: #fff; background-color: #ff0000">
    Article is not visible yet!
</p>


<h4>
    Published by <a href="{{ article.author.get_google_plus_url }}">{{ article.author.get_full_name }}</a> on {{ article.pubDate|date:"d.n.Y" }}
</h4>
<img src="{% get_gravatar_url_by_email article.author.get_email 48 %}">

{% endifequal %}
<h1 class="header">{{ article.title }}</h1>

{% if article.title_image %}
<img src="{{ article.title_image.image.url }}">
{% endif %}

<p><strong>{{ article.desc }}</strong></p>
<p>{{ article.content|safe }}</p>


{% if user.is_authenticated %}
<a href="/admin/copywriting/article/{{ article.id }}/">edit Article</a></li>
{% endif %}

More Articles from {{ article.author.get_full_name }}
<ul>
{% for latestArticle in latestArticlesList %}
<li><a href="{{ latestArticle.get_absolute_url }}">{{ latestArticle.title }}</a></li>
{% endfor %}
</ul>

<p>
	<a href="/blog/author/{{ article.author.user.username }}">All articles by {{ article.author.get_full_name }}</a>
</p>

Article published under following Tags
<ul>
{% for tag in article.tags.all %}
<li><a href="/blogtags/{{tag}}/">{{ tag }}</a></li>
{% endfor %}
</ul>

<!-- Start: next/prev -->

{% next article as next %}
{% if next %}
    <p>Next Article:<a href="{{ next.get_absolute_url}} "> {{next.title}} </a></p>

{% endif %}

{% prev article as prev %}
{% if prev %}
    <p>Previous Article:<a href="{{ prev.get_absolute_url}} "> {{prev.title}} </a></p>

{% endif %}

<!-- End: next/prev -->

<!-- Start: newest articles -->

{% getNewest 3 as latestArticles %}

Newest articles:

{% for narticle in latestArticles %}
    <li><a href="{{narticle.get_absolute_url}}" >{{ narticle.title }}</a></li>
{% endfor %}

<!-- End: newest articles -->

{% endblock %}

<!-- Start: Comments with disqus.com -->

{% if article.comments_enabled %}  

    <div id="disqus_thread"></div>

    <script type="text/javascript">

        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = '{{disqus_shortname}}';
        var disqus_identifier = '{{ article.slug }}';

        /* * * DON'T EDIT BELOW THIS LINE * * */

        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();

        </script>
{% endif %}

<!-- End: Comments -->
