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

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

{% block title %}{% trans "Mainpage" %}{% endblock %}

{% block content %}
  <div id="articles">
    {% if object_list.count %}
      {% for object in object_list %}
        <div class="article article-index">
          <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_by_more|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 class="span6">
                    <span>
                      <a href="{% url 'radpress-detail' object.slug %}" class="more pull-right">{% trans "Read the rest of this entry" %} →</a>
                    </span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      {% endfor %}
      <h3 class="blog-archives">
        <a href="{% url 'radpress-archive' %}">{% trans "Blog Archives" %}</a>
      </h3>
    {% else %}
      <p class="set-content-margin">{% trans "There's no post for now." %}</p>
    {% endif %}
  </div>
{% endblock %}
