{% for gallery in galleries %}
    <tr id="gallery-{{ gallery.id }}" data-gallery-id="{{ gallery.id }}">
        <td class="gg-col-check">
            <input type="checkbox" class="gg-row-checkbox" id="check_{{ gallery.id }}" data-gallery-id="{{ gallery.id }}" name="check_{{ gallery.id }}">
        </td>
        <td class="gg-col-id">{{ gallery.id }}</td>
        <td class="gg-col-thumb">
            {% set cover = '' %}
            {% if gallery.attachment_id == 0 and gallery.link_default|length > 1 %}
                {% set cover = gallery.link_default %}
            {% elseif gallery.attachment_id > 0 %}
                {% set cover = get_attachment(gallery.attachment_id, '150', '150', 'true') %}
            {% endif %}

            {% if cover|length < 1 and gallery.settings.posts.postCover|length > 1 %}
                {% set cover = gallery.settings.posts.postCover %}
            {% endif %}
            <div class="gg-thumb-wrap{{ cover|length < 1 ? ' gg-thumb-empty' : '' }}">
                {% if cover|length > 0 %}
                    <img src="{{ cover }}" alt="{{ gallery.title }}">
                {% else %}
                    <img src="{{ environment.getModule('overview').getLocationUrl() }}/assets/img/plugin-icon.png" alt="{{ gallery.title }}">
                {% endif %}
            </div>
        </td>
        <td class="gg-col-title">
            <a href="{{ environment.generateUrl('galleries', 'settings', { 'gallery_id': gallery.id }) }}" data-toggle="tooltip" title="{{ environment.translate('Edit gallery "%s"') | format(gallery.title) }}">
                {{ gallery.title|title }}
            </a>
            <i class="fa fa-fw fa-pencil"></i>
        </td>
        <td class="gg-col-type">
            <span class="gg-type-badge">{{ gallery.typeLabel }}</span>
        </td>
        <td class="gg-col-count">{{ gallery.total|default(0) }}</td>
        <td class="gg-col-date">{{ gallery.createdFormatted }}</td>
        <td class="gg-col-date">{{ gallery.modifiedFormatted }}</td>
        <td class="gg-col-code">
            <input type="text" id="shortcode-{{ gallery.id }}" readonly class="ggCopyTextCode shortcode" value="[supsystic-gallery id='{{ gallery.id }}']">
            <input type="text" id="phpcode-{{ gallery.id }}" readonly class="ggCopyTextCode phpcode"
                   value="{{ '<?php echo do_shortcode(\'[supsystic-gallery id=' ~ gallery.id ~ ']\') ?>' }}">
        </td>
        <td class="gg-col-actions">
            <a href="{{ environment.generateUrl('galleries', 'settings', { 'gallery_id': gallery.id }) }}"
               class="button background sggActionButtons">
                <i class="fa fa-cogs"></i>
                {{ translate('Settings') }}
            </a>
            <a href="{{ environment.generateUrl('galleries', 'view', { 'gallery_id': gallery.id }) }}"
               class="button background sggActionButtons">
                <i class="fa fa-bars"></i>
                {{ translate('Images list') }}
            </a>
            <a href="{{ environment.generateUrl('galleries', 'preview', { 'gallery_id': gallery.id }) }}"
               class="button background sggActionButtons">
                <i class="fa fa-eye"></i>
                {{ translate('Preview') }}
            </a>
            <br>
            <button class="button button-primary gallery import-to-gallery sggActionButtons" data-folder-id="0"
                    data-gallery-id="{{ gallery.id }}">
                <i class="fa fa-fw fa-camera"></i>
                {{ translate('Add Images') }}
            </button>
            <button type="button" class="button button-primary sggActionButtons gg-clone-gallery" data-gallery-id="{{ gallery.id }}" title="{{ translate('Clone this gallery') }}">
                <i class="fa fa-fw fa-clone"></i>
                {{ translate('Clone') }}
            </button>
            <a id="delete-gallery" data-confirm="{{ translate('Are you sure you want to delete this gallery?') }}" class="button button-primary sggActionButtons" title="Delete this gallery"
               href="{{ environment.generateUrl('galleries', 'delete', { 'gallery_id': gallery.id, '_wpnonce': _wpnonce }) }}">
                <i class="fa fa-trash"></i>
                {{ translate('Delete gallery') }}
            </a>
        </td>
    </tr>
{% endfor %}
