{% extends "badger/base.html" %}
{% import "badger/includes/macros.html" as macros %}

{% set badge_url = request.build_absolute_uri(badge.get_absolute_url()) %}

{% block pageid %}badge_detail{% endblock %}

{% block extrahead %}
    <link rel="alternate" type="application/atom+xml"
        title="{{ _('Recent awards') }}"
        href="{{ url('badger.feeds.awards_by_badge', format='atom', slug=badge.slug) }}" />
    <link rel="alternate" type="application/json"
        title="{{ _('{title} (JSON)') | f(title=badge) }}"
        href="{{ url('badger.detail_json', slug=badge.slug) }}" />

     <meta property="og:type" content="article"> 
     <meta property="og:url" content="{{ badge_url }}">
     <meta property="og:site_name" content="{{ settings.SITE_TITLE }}">
     <meta property="og:image" content="{{ macros.badge_image_url(badge, MEDIA_URL) }}">
     <meta property="og:title" content="{{ badge.title }}">
     <meta property="og:description" content="{{ badge.description }}"> 
     <meta property="article:published_time" content="{{ badge.modified.isoformat() }}Z"> 
     {% if badge.creator %}
     <meta property="article:author" content="{{ request.build_absolute_uri(badge.creator.get_absolute_url()) }}">
     {% endif %}
     {% for tag in badge.tags.all() %}
     <meta property="article:tag" content="{{ tag.name }}">
     {% endfor %}
{% endblock %}

{% block subcontent %}

<h1>{{ _('Badge: ') }} {{ badge.title }}</h1>
<div class="column-container">
    <div class="column-strip">
        <a href="{{ badge.get_absolute_url() }}" class="image">{{ macros.badge_image(badge, MEDIA_URL, 256) }}</a>
    </div>
    <div class="column-main">
        {% if badge.description %}
            <p>{{ badge.description }}</p>
        {% endif %}

        {% if badge.tags and badge.tags.count() %}
        <ul class="tags">
            {% for tag in badge.tags.all() %}
                <li><a class="tag" href="{{ url('badger.badges_list', tag_name=tag.name) }}"><i class="icon-tag icon-white"></i> {{ tag.name }}</a></li>
            {% endfor %}
        </ul>
        {% endif %}

        {% if award_list | length %}
        <section id="recent_awardees" class="item_flow">
            <header class="page-header">
                <h3>
                    <span>{{ _('Recent awardees') }}</span>
                    <small>(
                        <a href="{{ url('badger.views.awards_list', badge.slug) }}">{{ _('More...') }}</a>
                        <a href="{{ url('badger.feeds.awards_by_badge', 'atom', badge.slug) }}"><img src="{{MEDIA_URL}}/img/feed-icon-14x14.png" /></a>
                    )</small>
                </h3>
            </header>
            <ul class="awardees clear">
                {% for award in award_list %}
                    <li class="awardee">
                        <a href="{{ award.user.get_absolute_url() }}" class="avatar_image"><img src="{{ user_avatar(award.user) }}"
                            alt="{{ award.badge.title }}" width="128" height="128" /></a>            
                        <a href="{{ award.user.get_absolute_url() }}" class="label">
                            <span class="user">{{ award.user }}</span></a>
                    </li>
                {% endfor %}
            </ul>
        </section>
        {% endif %}
    </div>
</div>

{% endblock %}