<commit_before>{% set clones = event.clones|rejectattr('is_deleted')|list %}

<div class="action-menu">
    <div class="toolbar">
        {% if can_manage %}
            <div class="group left">
                <a class="i-button icon-copy" href="{{ url_for('event_mgmt.confModifTools-clone', event) }}"
                   title="{% trans %}Clone event{% endtrans %}">Clone</a>
                {% if clones %}
                <a id="action-menu-clones-target" class="i-button clickable-label arrow" >{{ clones|length }}</a>
                {% endif %}
            </div>

            <a id="action-menu-actions-target" class="i-button icon-settings i-button arrow"
               title="{% trans %}Event actions{% endtrans %}"></a>

            <div id="action-menu-actions">
                {% if event.as_legacy.isClosed() %}
                    <button class="i-button icon-lock-center disabled"
                            title="{% trans %}This event is already locked.{% endtrans %}"></button>
                {% elif not can_lock %}
                    <button class="i-button icon-lock-center disabled"
                            title="{% trans %}Only the event creator and category managers may lock an event.{% endtrans %}"></button>
                {% else %}
                    <button class="i-button icon-lock-center js-ajax-dialog-lock"
                            data-href="{{ url_for('event_management.lock', event) }}"
                            title="{% trans %}Lock event{% endtrans %}"
                            {{ 'disabled' if event.as_legacy.isClosed() }}>
                        {% trans %}Lock{% endtrans %}</button>
                {% endif %}

                <button class="i-button icon-remove js-ajax-dialog-delete danger"
                        data-href="{{ url_for('event_management.delete', event) }}"
                        title="{% trans %}Delete event{% endtrans %}"
                        data-qtip-style="danger">
                    {% trans %}Delete{% endtrans %}</button>
            </div>

            <div id="action-menu-clones">
                {% trans %}Events cloned from the current event:{% endtrans %}
                <ul>
                    {% for clone in clones %}
                        <li>
                            <a href="{{ url_for('event_mgmt.conferenceModification', clone) }}"
                               title="{{ clone.title }}" data-qtip-position="left">
                                {{ clone.start_dt | format_date(timezone=clone.tzinfo) }}
                            </a>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
    </div>
</div>

<script>
    (function() {
        'use strict';
        $('.js-ajax-dialog-delete, .js-ajax-dialog-lock').ajaxDialog({
            onClose: function(data) {
                if (data && data.url) {
                    location.href = data.url;
                }
                return true;
            }
        });

        $('#action-menu-clones-target').qbubble({
            content: {
                text: $('#action-menu-clones')
            }
        });

        $('#action-menu-actions-target').qbubble({
            content: {
                text: $('#action-menu-actions')
            }
        });

        $('#action-menu-actions button').on('click', function() {
            $('#action-menu-actions-target').qbubble('hide');
        });
    })();
</script><commit_msg>Add action button to move event to category<commit_after>{% set clones = event.clones|rejectattr('is_deleted')|list %}

<div class="action-menu">
    <div class="toolbar">
        {% if can_manage %}
            <div class="group left">
                <a class="i-button icon-copy" href="{{ url_for('event_mgmt.confModifTools-clone', event) }}"
                   title="{% trans %}Clone event{% endtrans %}">Clone</a>
                {% if clones %}
                <a id="action-menu-clones-target" class="i-button clickable-label arrow" >{{ clones|length }}</a>
                {% endif %}
            </div>

            <a id="action-menu-actions-target" class="i-button icon-settings i-button arrow"
               title="{% trans %}Event actions{% endtrans %}"></a>

            <div id="action-menu-actions">
                {% if event.as_legacy.isClosed() %}
                    <button class="i-button icon-lock-center disabled"
                            title="{% trans %}This event is already locked.{% endtrans %}"></button>
                {% elif not can_lock %}
                    <button class="i-button icon-lock-center disabled"
                            title="{% trans %}Only the event creator and category managers may lock an event.{% endtrans %}"></button>
                {% else %}
                    <button class="i-button icon-lock-center js-ajax-dialog-lock"
                            data-href="{{ url_for('event_management.lock', event) }}"
                            title="{% trans %}Lock event{% endtrans %}"
                            {{ 'disabled' if event.as_legacy.isClosed() }}>
                        {% trans %}Lock{% endtrans %}</button>
                {% endif %}

                <button class="i-button icon-transmission js-ajax-dialog-move"
                        title="{% trans %}Move event to another category{% endtrans %}"
                        data-href="{{ url_for('event_management.move', event) }}"
                        data-category-id="{{ event.category.id }}">
                    {% trans %}Move{% endtrans %}
                </button>
                <button class="i-button icon-remove js-ajax-dialog-delete danger"
                        data-href="{{ url_for('event_management.delete', event) }}"
                        title="{% trans %}Delete event{% endtrans %}"
                        data-qtip-style="danger">
                    {% trans %}Delete{% endtrans %}</button>
            </div>

            <div id="action-menu-clones">
                {% trans %}Events cloned from the current event:{% endtrans %}
                <ul>
                    {% for clone in clones %}
                        <li>
                            <a href="{{ url_for('event_mgmt.conferenceModification', clone) }}"
                               title="{{ clone.title }}" data-qtip-position="left">
                                {{ clone.start_dt | format_date(timezone=clone.tzinfo) }}
                            </a>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
    </div>
</div>

<script>
    (function() {
        'use strict';

        $('.js-ajax-dialog-delete, .js-ajax-dialog-lock').ajaxDialog({
            onClose: function(data) {
                if (data && data.url) {
                    location.href = data.url;
                }
                return true;
            }
        });

        $('.js-ajax-dialog-move').on('click', function(evt) {
            evt.preventDefault();

            var $this = $(this);
            $('<div>').categorynavigator({
                openInDialog: true,
                actionOn: {
                    categoriesWithSubcategories: {
                        disabled: true
                    },
                    categories: {
                        disabled: true,
                        ids: [$this.data('category-id')]
                    }
                },
                onAction: function(category) {
                    var msg = $T.gettext('You are about to move the event to the category "{0}". Are you sure you want to proceed?').format(category.title);
                    confirmPrompt(msg, $T.gettext('Move event')).then(function() {
                        $.ajax({
                            url: $this.data('href'),
                            type: 'POST',
                            data: {'target_category_id': category.id},
                            error: handleAjaxError,
                            success: function(data) {
                                if (data.success) {
                                    location.reload();
                                }
                            }
                        });
                    });
                }
            });
        });

        $('#action-menu-clones-target').qbubble({
            content: {
                text: $('#action-menu-clones')
            }
        });

        $('#action-menu-actions-target').qbubble({
            content: {
                text: $('#action-menu-actions')
            }
        });

        $('#action-menu-actions button').on('click', function() {
            $('#action-menu-actions-target').qbubble('hide');
        });
    })();
</script>
{'fraction_non_alphanumeric': 0.14738636363636365, 'fraction_numerical': 0.00011363636363636364, 'mean_word_length': 1.259563543003851, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '934864', 'n_tokens_mistral': 2363, 'n_tokens_neox': 2137, 'n_words': 461}