{% extends "radpress/base.html" %}

{% load trans from i18n %}
{% load url from future %}
{% load thumbnail %}

{% block title %}{{ object.title }}{% endblock %}

{% block content %}
  <div class="article">
    <div class="row-fluid">
      <div class="span2">
        <time datetime="{{ object.updated_at.isoformat }}">{{ object.updated_at|date:"m F, Y"|upper }}</time>

        {% if object.tags.count %}
          <div class="tags">
            {% for tag in object.tags.all %}
              <a class="label label-info" href="{% url 'radpress-archive' %}?tag={{ tag.slug }}">
                <i class="icon-tag icon-white"></i>
                {{ tag.name }}
              </a>
            {% endfor %}
          </div>
        {% endif %}
      </div>

      <div class="span10">
        {% if user.is_superuser %}
          <div class="btn-group pull-right">
            <a href="{% url 'admin:radpress_article_change' object.id %}" class="btn btn-mini">
              <i class="icon-edit"></i>
              {% trans "Edit" %}
            </a>
          </div>
        {% endif %}

        <h1 class="entry-title">
          <a href="{% url 'radpress-detail' object.slug %}">
            {{ object.title }}
          </a>
        </h1>

        {% if object.cover_image %}
          <img class="thumbnail cover" src="{% thumbnail object.cover_image.image RADPRESS_COVER_SIZE sharpen crop='smart' %}" />
        {% endif %}

        <div class="article-content">
          {{ object.content_body|safe }}
        </div>

        <div class="article-footer">
          <div class="row-fluid">
            <div class="span6">
              <span>
                {% trans "Written by" %}:

                {% with object.author.get_full_name as full_name %}
                  <b>
                    {% if full_name %}
                      {{ full_name }}
                    {% else %}
                      {{ object.author }}
                    {% endif %}
                  </b>
                {% endwith %}
              </span>
            </div>
          </div>
        </div>
        {% if RADPRESS_DISQUS %}
          <div id="disqus_thread"></div>
          <script type="text/javascript">
            var disqus_shortname = '{{ RADPRESS_DISQUS }}';
            (function() {
                var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
                (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
            })();
          </script>
          <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
          <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
        {% endif %}
      </div>
    </div>
  </div>
{% endblock %}
