<commit_before>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'gallery/admin/gallery/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}
    <div class="flashmessage success_message full_width album_removed_success hide">
        <div class="title">Success</div>
        <div class="content">
            <p>The album was successfully removed!</p>
        </div>
    </div>
    <div class="flashmessage error_message full_width album_removed_error hide">
    	<div class="title">Error</div>
    	<div class="content">
    		<p>An error occurred while trying to delete the album.</p>
    	</div>
    </div>

    <div id="controller_action">
        <table class="full_width manage">
            <thead>
                <tr>
                    <th>Title</th>
                    <th width="150px">Date</th>
                    <th width="160px">Person</th>
                    <th width="100px">Actions</th>
                </tr>
            </thead>

            <tbody>
                {% for album in paginator %}
                    <tr class="item" data-id="{{ album.getId() }}">
                        <td>{{ album.getTitle(language) }}</td>
                        <td>{{ dateLocalized(album.getDate(), 'dd/MM/y') }}</td>
                        <td>{{ album.getCreatePerson().getFullName() }}</td>
                        <td class="actions">
                            {% if hasAccess('gallery_admin_gallery', 'edit') %}
                                <a href="{{ url('gallery_admin_gallery', {"action": "edit", "id": album.getId()}) }}" class="edit">Edit</a>
                            {% endif %}
                            {% if hasAccess('gallery_admin_gallery', 'photos') %}
                                <a href="{{ url('gallery_admin_gallery', {"action": "photos", "id": album.getId()}) }}" class="gallery_photos">Photos</a>
                            {% endif %}
                            {% if hasAccess('gallery_admin_gallery', 'delete') %}
                                <a href="#" data-id="{{ album.getId() }}" data-title="{{ album.getTitle(language) }}" class="delete">Delete</a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    	{% include 'admin/partials/paginationControl.twig' %}
    </div>

    <div class="modal hide fade" id="removeAlbum">
        <div class="modal-header">
            <span>Litus Admin</span>
            /Delete Album
        </div>
        <div class="modal-body">
            <p>
                You are about to delete the following album: <b class="title"></b>?
                Please note that this operation cannot be undone!
            </p>
            <p>
                Are you sure you want to continue?
            </p>
            <div class="footer">
                <input type="button" class="delete" value="Yes">
                <input type="button" class="cancel" data-dismiss="modal" value="No">
            </div>
        </div>
    </div>
{% endblock %}

{% block content_script %}
	<script type="text/javascript">
		$(document).ready(function () {
			$('.item .delete').click(openRemoveModal);
		});

		function openRemoveModal(e) {
			var $this = $(this);

			e.preventDefault();
			var removeAlbum = $('#removeAlbum');
			removeAlbum.find('.title').html($(this).data('title'));
            var id = $(this).data('id');
			removeAlbum.find('.delete').unbind('click').click(function () {
				$.post('{{ url('gallery_admin_gallery', {"action": "delete"})}}' + $this.data('id'), function  (data) {
				    if (data && 'success' == data.status) {
    					$('.flashmessage').addClass('hide');
    					$('.album_removed_success').removeClass('hide');
                        $('.item-' + id).remove();
    					removeAlbum.modal('hide');
    				} else {
    				    errorRemove();
    				}
				}, 'json').error(errorRemove);
			});<commit_msg>GalleryBundle: Fix to remove table rows when they are deleted client-side<commit_after>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'gallery/admin/gallery/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}
    <div class="flashmessage success_message full_width album_removed_success hide">
        <div class="title">Success</div>
        <div class="content">
            <p>The album was successfully removed!</p>
        </div>
    </div>
    <div class="flashmessage error_message full_width album_removed_error hide">
    	<div class="title">Error</div>
    	<div class="content">
    		<p>An error occurred while trying to delete the album.</p>
    	</div>
    </div>

    <div id="controller_action">
        <table class="full_width manage">
            <thead>
                <tr>
                    <th>Title</th>
                    <th width="150px">Date</th>
                    <th width="160px">Person</th>
                    <th width="100px">Actions</th>
                </tr>
            </thead>

            <tbody>
                {% for album in paginator %}
                    <tr class="item" data-id="{{ album.getId() }}">
                        <td>{{ album.getTitle(language) }}</td>
                        <td>{{ dateLocalized(album.getDate(), 'dd/MM/y') }}</td>
                        <td>{{ album.getCreatePerson().getFullName() }}</td>
                        <td class="actions">
                            {% if hasAccess('gallery_admin_gallery', 'edit') %}
                                <a href="{{ url('gallery_admin_gallery', {"action": "edit", "id": album.getId()}) }}" class="edit">Edit</a>
                            {% endif %}
                            {% if hasAccess('gallery_admin_gallery', 'photos') %}
                                <a href="{{ url('gallery_admin_gallery', {"action": "photos", "id": album.getId()}) }}" class="gallery_photos">Photos</a>
                            {% endif %}
                            {% if hasAccess('gallery_admin_gallery', 'delete') %}
                                <a href="#" data-id="{{ album.getId() }}" data-title="{{ album.getTitle(language) }}" class="delete">Delete</a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    	{% include 'admin/partials/paginationControl.twig' %}
    </div>

    <div class="modal hide fade" id="removeAlbum">
        <div class="modal-header">
            <span>Litus Admin</span>
            /Delete Album
        </div>
        <div class="modal-body">
            <p>
                You are about to delete the following album: <b class="title"></b>?
                Please note that this operation cannot be undone!
            </p>
            <p>
                Are you sure you want to continue?
            </p>
            <div class="footer">
                <input type="button" class="delete" value="Yes">
                <input type="button" class="cancel" data-dismiss="modal" value="No">
            </div>
        </div>
    </div>
{% endblock %}

{% block content_script %}
	<script type="text/javascript">
		$(document).ready(function () {
			$('.item .delete').click(openRemoveModal);
		});

		function openRemoveModal(e) {
			var $this = $(this);

			e.preventDefault();
			var removeAlbum = $('#removeAlbum');
			removeAlbum.find('.title').html($(this).data('title'));
            var id = $(this).data('id');
			removeAlbum.find('.delete').unbind('click').click(function () {
				$.post('{{ url('gallery_admin_gallery', {"action": "delete"})}}' + $this.data('id'), function  (data) {
				    if (data && 'success' == data.status) {
    					$('.flashmessage').addClass('hide');
    					$('.album_removed_success').removeClass('hide');
                        $('.item[data-id='+id+']').remove();
    					removeAlbum.modal('hide');
    				} else {
    				    errorRemove();
    				}
				}, 'json').error(errorRemove);
			});
{'fraction_non_alphanumeric': 0.17113095238095238, 'fraction_numerical': 0.002232142857142857, 'mean_word_length': 1.7600958247775496, 'pattern_counts': {'":': 10, '<': 141, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2893870', 'n_tokens_mistral': 2469, 'n_tokens_neox': 2195, 'n_words': 461}