{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}

{% block meta_title %}{{ article.title }}{% endblock %}

{% block breadcrumb %}
<li>
    <a href="{{ '/kb'|link }}">{{ 'Knowledge base'|trans }}</a> <span class="divider">/</span>
</li>
<li>
    <a href="{{ '/kb'|link }}/{{ article.category.slug }}">{{ article.category.title }}</a><span class="divider">/</span>
</li>
<li class="active">{{ article.title }}</li>
{% endblock %}

{% block content %}
<div class="content-block" role="main">
    <div class="row">
        <article class=" span12 data-block">
            <div class="data-container">
                <header>
                    <h1>{{ article.title }}</h1>
                    <div class="meta pull-right"><h5>{{ article.created_at|bb_date }}</h5></div>
                    <p>{{ 'Article views'|trans }}: {{ article.views }}</p>
                </header>
                <section>
                    {{ article.content|bbmd }}
                    <hr/>
                    <p><a class="btn btn-small" href="{{ 'kb'|link }}">{{ 'Back to list'|trans }}</a></p>
                </section>
            </div>
        </article>
    </div>
</div>
{% endblock %}

{% block content_after %}
<div class="content-block" role="main">
    <div class="row">
        <article class=" span6 data-block">
            <div class="data-container">
                <header>
                    <h2 class="dark-icon i-kb">{{ 'Similar articles'|trans }}</h2>
                </header>
                <section>
                    <ul class="menu">
                        {% for i, kbarticle in guest.kb_article_get_list({ "kb_article_category_id": article.kb_article_category_id, "per_page": 5 }).list %}
                        <li><a href="{{ '/kb'|link }}/{{ article.category.slug }}/{{ kbarticle.slug }}">{{ kbarticle.title|truncate(45) }}</a></li>
                        {% endfor %}
                    </ul>
                </section>
            </div>
        </article>

        <article class=" span6 data-block">
            <div class="data-container">
                <header>
                    <h2 class="dark-icon i-kb">{{ 'Knowledge base categories'|trans }}</h2>
                </header>
                <section>
                    <ul class="menu">
                        {% for i, category in guest.kb_category_get_list({ "per_page": 5 }).list %}
                        <li><a href="{{ '/kb'|link }}#category-{{ category.id }}">{{ category.title }}</a></li>
                        {% endfor %}
                    </ul>
                </section>
            </div>
        </article>
    </div>
</div>
{% endblock %}
