{% import 'prod/results/macro.html.twig' as result_macro %}

{% set feed = entry.feed %}
{% set images_size = user_setting('images_size') %}
{% set technical_display = user_setting('technical_display') %}
{% set rollover_thumbnail = user_setting('rollover_thumbnail') %}
{% set doctype_display = user_setting('doctype_display') %}

<div class="entry ui-corner-all" id="entry_{{ entry.id }}">
    <table class="head">
        <tr>
            <td>
                <h1 class="title">
                    {% if feed.aggregated %}
                        <img style="height:16px;" src="{% if entry.feed.iconUrl == false %} /assets/common/images/icons/rss32.gif{% else %}/custom/feed_{{ entry.feed.id }}.jpg{% endif %}"/>
                    {% endif %}
                    {{ entry.title }}
                    {% set author = entry.authorName %}
                    <span class="author">
                            {% trans with {'%author%' : author} %}Par %author%{% endtrans %}
                        </span>
                </h1>
            </td>
            <td style="width:60px;text-align:right;">
                {% if entry.feed.isOwner(app.getAuthenticator().user) or entry.isPublisher(app.getAuthenticator().user) %}
                    <a class="tools options feed_edit" href="{{ path('prod_feeds_entry_edit', { 'id' : entry.id }) }}">
                        <img src="/assets/common/images/icons/file-edit.png" title="{{ 'boutton::editer' | trans }}"/>
                    </a>
                    <a class="tools feed_delete"href="{{ path('prod_feeds_entry_delete', { 'id' : entry.id }) }}">
                        <img src="/assets/common/images/icons/delete.png" title="{{ 'boutton::supprimer' | trans }}"/>
                    </a>
                {% endif %}
            </td>
        </tr>
    </table>
    <div class="post_date">
        {% set updated_on = app['date-formatter'].getPrettyString(entry.updatedOn) %}
        {% set created_on = app['date-formatter'].getPrettyString(entry.createdOn) %}
        <span class="created_on">
                {{ created_on }}
            </span>
        {% if created_on != updated_on %}
            <span class="updated_on">
                    (
                {% trans with {'%updated_on%' : updated_on} %}Derniere mise a jour le %updated_on%{% endtrans %}
                )
                </span>
        {% endif %}
        {% if feed.aggregated %}
            <a class="ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : entry.feed.id }) }}">
                {% set feed_name = entry.feed.title %}
                {% trans with {'%feed_name%' : feed_name} %}dans %feed_name%{% endtrans %}
                <img style="height:16px;" src="{% if entry.feed.iconUrl == false %}/assets/common/images/icons/rss32.gif{% else %}/custom/feed_{{ entry.feed.id }}.jpg{% endif %}"/>
            </a>
        {% endif %}
    </div>

    <p>{{ entry.getSubtitle()|nl2br|raw }}</p>

    <div class="contents selectable">
        {% for item in entry.items %}
            {% block item %}
                {% include 'prod/results/item.html.twig' with {
                    'item' : item,
                    'entry': entry,
                    'settings': {
                        'images_size': images_size,
                        'technical_display': technical_display,
                        'rollover_thumbnail': rollover_thumbnail,
                        'doctype_display': doctype_display
                    }
                } %}
            {% endblock %}
        {% endfor %}
    </div>
</div>
