<commit_before>{% import '@bolt/_macro/_macro.twig' as macro %}
{% import '@bolt/_macro/_buic.twig' as buic %}

{% set modifiable = permissions.create or permissions.edit or permissions.delete or permissions.publish or permissions.depublish %}

{#
 # GROUPNAME: If we have 'grouping', print the row with the groupname.
 #}
{% if not compact and content.group.name is defined and (loop.first or content.group.name != lastgroup) and request('order') == '' %}
    {% if not loop.first %}</tbody>{% endif %}
    <tbody {% if modifiable %}class="sortable"{% endif %}>
    <tr class="grouping">
        <th colspan="{% block listing_columns %}6{% endblock %}">
            <h3 {% if loop.first %}class="first"{% endif %}>
                {{ content.group.name|default(__('(no group)')) }}
            </h3>
        </th>
    </tr>
{% endif %}

{#
 # HEADER ROW: Print the header for the first row.
 #}
{% if not compact and (loop.first or (content.group.name is defined and content.group.name != lastgroup) and request('order') == '') %}
    {% set lastgroup = content.group.name|default %}
    {% if 'filter' in app.request.query.all|keys %}
        {% set filter = 'filter=' ~ app.request.query.all.filter ~ '&' %}
    {% else %}
        {% set filter = '' %}
    {% endif %}

    <tr>
        {% block listing_header %}
            {% set column_title = content.TitleColumnName()|first %}
            {% set link = '?' ~ filter ~ 'order=' %}
            {% set href = {
                content: link ~ (request('order') == column_title  ? '-' : '') ~ column_title,
                meta:    link ~ (request('order') == 'datecreated' ? '-' : '') ~ 'datecreated',
                id:      link ~ (request('order') == 'id'          ? '-' : '') ~ 'id'
            }%}

            {# COLUMN: Select #}
            {% if not compact and modifiable %}
                <th class="check hidden-xs"><input type="checkbox" name="checkRow" title="{{ __('Select all') }}" /></th>
            {% else %}
                <th style="margin: 0; padding: 0;"></th>
            {% endif %}

            {# COLUMN: ID #}
            <th class="hidden-xs">
                <a href="{{ href.id }}">{{ __('Id') }}</a>
            </th>

            {# COLUMN: Content #}
            <th style="width:80%">
                <a href="{{ href.content }}">{{ __('Title') }} / {{ __('Excerpt') }}</a>
            </th>

            {# COLUMN: Thumbnail #}
            <th>&nbsp;</th>

            {# COLUMN: Meta #}
            <th class="username hidden-xs">
                <a href="{{ href.meta }}">{{ __('Meta') }}</a>
            </th>

            {# COLUMN: Action #}
            <th>
                <a href="?">{{ __('Actions') }}</a>
            </th>
        {% endblock %}
    </tr>
{% endif %}

{#
 # DATA ROW
 #}
<tr {% if content.status!='published' %}class="dim"{% endif %}{% if not compact and modifiable %} id="item_{{ content.id }}"{% endif %}>

    {### BLOCK: ID ###}
    {% block listing_id %}
        {# COLUMN: Select #}
        {% if not compact and permissions.delete %}
            <td class="check hidden-xs"><input type="checkbox" name="checkRow"></td>
        {% else %}
            <td style="margin: 0; padding: 0;"></td>
        {% endif %}

        {# COLUMN: ID #}
        <td class="id hidden-xs">№ {{ content.id }}</td>
    {% endblock %}

    {### BLOCK: CONTENT ###}
    {% block listing_content %}
        {# COLUMN: Content #}
        <td class="excerpt {% if not compact %}large{% endif %}">
            {% set title = content.getTitle|default("<em>(" ~ __("no title …") ~ ")</em>")|raw %}
            <span>
                <strong class="visible-xs">№ {{ content.id }}. </strong>
                <strong>
                    {% if modifiable %}
                        <a href="{{ path('editcontent', {'contenttypeslug': content.contenttype.slug, 'id': content.id}) }}" title="Slug: {{ content.slug }}">
                            {{ title }}
                        </a>
                    {% else %}
                        <strong>
                            {{ title }}
                        </strong>
                     {% endif %}
                </strong>
                {{ content.excerpt(excerptlength - title|length) }}
            </span>
        </td>

        {# COLUMN: Thumbnail #}
        <td class="listthumb">
            {% if content.getImage is not empty %}
                {# Hack to add alt attribute #}
                {#{ content.getImage|popup(thumbsize, thumbsize * 0.75, 'c') }#}
                {% set thumb_height = (thumbsize * 0.75)|round %}
                {% set thumb_small = content.getImage|thumbnail(thumbsize, thumb_height, 'c') %}
                {% set thumb_large = content.getImage|thumbnail(1000, 800, 'r') %}
                {% set thumb_title = __('Image') ~ ': ' ~ content.getImage %}
                <a href="{{ thumb_large }}" class="magnific" title="{{ thumb_title }}">
                    <img src="{{ thumb_small }}" width="{{ thumbsize }}" height="{{ thumb_height }}" alt="{{ __('Thumbnail') }}">
                </a>
            {% endif %}
        </td>
    {% endblock %}

    {% if not compact %}
        {% block listing_meta %}
            {# COLUMN: Meta #}
            <td class="username hidden-xs">
                <i class="fa fa-user fa-fw"></i>
                {% if content.user.displayname is defined %}
                    {{ content.user.displayname|trimtext(15) }}
                {% else %}
                    <s>{{ content.values.ownerid|trimtext(15) }}</s>
                {% endif %}<br>
                {% if content.status == 'timed' %}
                    <i class="fa fa-clock-o status-timed fa-fw"></i> {{ buic.moment(content.datepublish) }}<br>
                {% else %}
                    <i class="fa fa-circle status-{{ content.status }} fa-fw"></i> {{ content.datepublish|localdate('%x') }}<br>
                {% endif %}<commit_msg>Make logik a bit more readable<commit_after>{% import '@bolt/_macro/_macro.twig' as macro %}
{% import '@bolt/_macro/_buic.twig' as buic %}

{% set modifiable = permissions.create or permissions.edit or permissions.delete or permissions.publish or permissions.depublish %}

{% set prop = {
    extended:       not compact,
    has_groupname:  content.group.name is defined,
    nextgroup:      content.group.name|default() != lastgroup,
    unordered:      request('order') == '',
    first:          loop.first
}%}

{#
 # GROUPNAME: If we have 'grouping', print the row with the groupname.
 #}
{% if prop.extended and prop.has_groupname and (prop.first or prop.nextgroup) and prop.unordered %}
    {% if not prop.first %}</tbody>{% endif %}
    <tbody {% if modifiable %}class="sortable"{% endif %}>
    <tr class="grouping">
        <th colspan="{% block listing_columns %}6{% endblock %}">
            <h3 {% if prop.first %}class="first"{% endif %}>
                {{ content.group.name|default(__('(no group)')) }}
            </h3>
        </th>
    </tr>
{% endif %}

{#
 # HEADER ROW: Print the header for the first row.
 #}
{% if prop.extended and (prop.first or (prop.has_groupname and prop.nextgroup) and prop.unordered) %}
    {% set lastgroup = content.group.name|default %}
    {% if 'filter' in app.request.query.all|keys %}
        {% set filter = 'filter=' ~ app.request.query.all.filter ~ '&' %}
    {% else %}
        {% set filter = '' %}
    {% endif %}

    <tr>
        {% block listing_header %}
            {% set column_title = content.TitleColumnName()|first %}
            {% set link = '?' ~ filter ~ 'order=' %}
            {% set href = {
                content: link ~ (request('order') == column_title  ? '-' : '') ~ column_title,
                meta:    link ~ (request('order') == 'datecreated' ? '-' : '') ~ 'datecreated',
                id:      link ~ (request('order') == 'id'          ? '-' : '') ~ 'id'
            }%}

            {# COLUMN: Select #}
            {% if prop.extended and modifiable %}
                <th class="check hidden-xs"><input type="checkbox" name="checkRow" title="{{ __('Select all') }}" /></th>
            {% else %}
                <th style="margin: 0; padding: 0;"></th>
            {% endif %}

            {# COLUMN: ID #}
            <th class="hidden-xs">
                <a href="{{ href.id }}">{{ __('Id') }}</a>
            </th>

            {# COLUMN: Content #}
            <th style="width:80%">
                <a href="{{ href.content }}">{{ __('Title') }} / {{ __('Excerpt') }}</a>
            </th>

            {# COLUMN: Thumbnail #}
            <th>&nbsp;</th>

            {# COLUMN: Meta #}
            <th class="username hidden-xs">
                <a href="{{ href.meta }}">{{ __('Meta') }}</a>
            </th>

            {# COLUMN: Action #}
            <th>
                <a href="?">{{ __('Actions') }}</a>
            </th>
        {% endblock %}
    </tr>
{% endif %}

{#
 # DATA ROW
 #}
<tr {% if content.status!='published' %}class="dim"{% endif %}{% if prop.extended and modifiable %} id="item_{{ content.id }}"{% endif %}>

    {### BLOCK: ID ###}
    {% block listing_id %}
        {# COLUMN: Select #}
        {% if prop.extended and permissions.delete %}
            <td class="check hidden-xs"><input type="checkbox" name="checkRow"></td>
        {% else %}
            <td style="margin: 0; padding: 0;"></td>
        {% endif %}

        {# COLUMN: ID #}
        <td class="id hidden-xs">№ {{ content.id }}</td>
    {% endblock %}

    {### BLOCK: CONTENT ###}
    {% block listing_content %}
        {# COLUMN: Content #}
        <td class="excerpt {% if prop.extended %}large{% endif %}">
            {% set title = content.getTitle|default("<em>(" ~ __("no title …") ~ ")</em>")|raw %}
            <span>
                <strong class="visible-xs">№ {{ content.id }}. </strong>
                <strong>
                    {% if modifiable %}
                        <a href="{{ path('editcontent', {'contenttypeslug': content.contenttype.slug, 'id': content.id}) }}" title="Slug: {{ content.slug }}">
                            {{ title }}
                        </a>
                    {% else %}
                        <strong>
                            {{ title }}
                        </strong>
                     {% endif %}
                </strong>
                {{ content.excerpt(excerptlength - title|length) }}
            </span>
        </td>

        {# COLUMN: Thumbnail #}
        <td class="listthumb">
            {% if content.getImage is not empty %}
                {# Hack to add alt attribute #}
                {#{ content.getImage|popup(thumbsize, thumbsize * 0.75, 'c') }#}
                {% set thumb_height = (thumbsize * 0.75)|round %}
                {% set thumb_small = content.getImage|thumbnail(thumbsize, thumb_height, 'c') %}
                {% set thumb_large = content.getImage|thumbnail(1000, 800, 'r') %}
                {% set thumb_title = __('Image') ~ ': ' ~ content.getImage %}
                <a href="{{ thumb_large }}" class="magnific" title="{{ thumb_title }}">
                    <img src="{{ thumb_small }}" width="{{ thumbsize }}" height="{{ thumb_height }}" alt="{{ __('Thumbnail') }}">
                </a>
            {% endif %}
        </td>
    {% endblock %}

    {% if prop.extended %}
        {% block listing_meta %}
            {# COLUMN: Meta #}
            <td class="username hidden-xs">
                <i class="fa fa-user fa-fw"></i>
                {% if content.user.displayname is defined %}
                    {{ content.user.displayname|trimtext(15) }}
                {% else %}
                    <s>{{ content.values.ownerid|trimtext(15) }}</s>
                {% endif %}<br>
                {% if content.status == 'timed' %}
                    <i class="fa fa-clock-o status-timed fa-fw"></i> {{ buic.moment(content.datepublish) }}<br>
                {% else %}
                    <i class="fa fa-circle status-{{ content.status }} fa-fw"></i> {{ content.datepublish|localdate('%x') }}<br>
                {% endif %}
{'fraction_non_alphanumeric': 0.18740691709415852, 'fraction_numerical': 0.004302498758894589, 'mean_word_length': 1.7167902899527985, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5810426', 'n_tokens_mistral': 3859, 'n_tokens_neox': 3464, 'n_words': 814}