{% extends 'layout.html' %}
{% macro render_link(obj) %}
    <a href="{{ url_for('.edit',id=obj.id) }}">View</a>
{% endmacro %}
{% macro render_post(article) %}
    <div class=container>
        <h1>{{ article.title }}</h1>

        <p>{{ article.date_added|date_pretty }} | {{ article.category }}</p>
        <p>{{ article.content | markdown | truncate(10) }}</p>

        <hr/>
        {{ render_link(article) }}
    </div>
{% endmacro %}
    {% block header %}
        {% include 'header.html' with context %}
    {% endblock header %}
    {% block body %}
    {% if articles %}
        {% for a in articles %}
            {{ render_post(a) }}
        {% endfor %}
    {% endif %}
    {% endblock body %}
{% block footer_js %}
{{ super() }}
<script type=text/javascript>
    $(document).ready(function() {
        $(".autohover").hover(function() {
            $(this).addClass('active');
        }, function() {
            $(this).removeClass('active');
    });
});
    $(document).on("click","#addInput",function(){
            var input = '<input class="form-control" type="text" value="new" />';
            $("#addItem").append(input);
});
</script>

{% endblock footer_js %}
