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

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

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

    {% include 'cudi/admin/article/subject-map/partials/years.twig' %}

    <div id="controller_action">
        <h1>Article</h1>

        <p>Title: <b>{{ article.getTitle() }}</b></p>
        <p>Author: <b>{{ article.getAuthors() }}</b></p>
        <p>Publisher: <b>{{ article.getPublishers() }}</b></p>
        <br />

        {% import 'admin/partials/form.twig' as forms %}
        {{ forms.renderForm(form) }}
        <br style="clear:both"/>

        <table class="manage" id="articleSubjects">
            <tr>
                <th width="90px">Code</th>
                <th>Name</th>
                <th width="80px">Semester</th>
                <th width="80px">Credits</th>
                <th width="80px">Mandatory</th>
                <th width="70px">Actions</th>
            </tr>

            {% for mapping in paginator %}
                <tr class="item item-{{ mapping.getId() }}">
                    <td>{{ mapping.getSubject().getCode() }}</td>
                    <td>{{ mapping.getSubject().getName() }}</td>
                    <td>{{ mapping.getSubject().getSemester() }}</td>
                    <td>{{ mapping.getSubject().getCredits() }}</td>
                    <td>{% if mapping.isMandatory() %}Yes{% else %}No{% endif %}</td>
                    <td class="actions">
                        {% if hasAccess('cudi_admin_article_subject', 'delete') %}
                            <a href="#" class="delete" data-id="{{ mapping.getId() }}" data-article="{{ article.getTitle() }}" data-subject="{{ mapping.getSubject().getName() }}">Delete</a>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
        </table>

        {% include 'admin/partials/paginationControl.twig' %}
    </div>

    <aside>
        {% if hasAccess('cudi_admin_article', 'edit') %}
            <div class="sidebox">
                <div class="title">Back To Article</div>
                <div class="content">
                    <p>
                        <i>Please hit the link below to go back to the article!</i>
                    </p>
                    <p>
                        <a href="{{ url('cudi_admin_article', {"action": "edit", "id": article.getId()}) }}">&rarr; Back To Article</a>
                    </p>
                </div>
            </div>
        {% endif %}
    </aside>

    <div class="modal fade" id="removeMapping" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span>Litus Admin</span>
                    /Delete Mapping
                </div>
                <div class="modal-body">
                    <p>
                        You are about to delete the following mapping: <b class="articleTitle"></b> with <b class="subjectName"></b>!
                        Please note that this operation cannot be undone!
                    </p>
                    <p>
                        Are you sure you want to continue?
                    </p>
                    <div class="footer">
                        <button class="delete">Yes</button>
                        <button class="cancel" data-dismiss="modal">No</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

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

            $('#subject').typeaheadRemote(
                {
                    source: '{{ url("syllabus_admin_subject_typeahead", {"academicyear": currentAcademicYear.getCode() })}}',
                }
            ).change(function (e) {
                if ($(this).data('value')) {
                    $('[name="subject[id]"]').val($(this).data('value').id);
                } else {
                    $('[name="subject[id]"]').val('');
                }
            });
        });

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

            e.preventDefault();
            var removeMapping = $('#removeMapping');
            removeMapping.find('.articleTitle').html($(this).data('article'));
            removeMapping.find('.subjectName').html($(this).data('subject'));
            var id = $this.data('id');
            removeMapping.find('.delete').unbind('click').click(function () {
                $.post('{{ url('cudi_admin_article_subject', {"action": "delete"})}}' + id, function (data) {
                    if (data && 'success' == data.status) {
                        $('.flashmessage').addClass('hide');
                        $('.mapping_removed_success').removeClass('hide');
                        $('.item-' + id).remove();
                        removeMapping.modal('hide');
                    } else {
                        errorRemove();<commit_msg>Fixed length of typeahead field<commit_after>{% extends 'admin/base.twig' %}

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

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

    {% include 'cudi/admin/article/subject-map/partials/years.twig' %}

    <div id="controller_action">
        <h1>Article</h1>

        <p>Title: <b>{{ article.getTitle() }}</b></p>
        <p>Author: <b>{{ article.getAuthors() }}</b></p>
        <p>Publisher: <b>{{ article.getPublishers() }}</b></p>
        <br />

        {% import 'admin/partials/form.twig' as forms %}
        {{ forms.renderForm(form) }}
        <br style="clear:both"/>

        <table class="manage" id="articleSubjects">
            <tr>
                <th width="90px">Code</th>
                <th>Name</th>
                <th width="80px">Semester</th>
                <th width="80px">Credits</th>
                <th width="80px">Mandatory</th>
                <th width="70px">Actions</th>
            </tr>

            {% for mapping in paginator %}
                <tr class="item item-{{ mapping.getId() }}">
                    <td>{{ mapping.getSubject().getCode() }}</td>
                    <td>{{ mapping.getSubject().getName() }}</td>
                    <td>{{ mapping.getSubject().getSemester() }}</td>
                    <td>{{ mapping.getSubject().getCredits() }}</td>
                    <td>{% if mapping.isMandatory() %}Yes{% else %}No{% endif %}</td>
                    <td class="actions">
                        {% if hasAccess('cudi_admin_article_subject', 'delete') %}
                            <a href="#" class="delete" data-id="{{ mapping.getId() }}" data-article="{{ article.getTitle() }}" data-subject="{{ mapping.getSubject().getName() }}">Delete</a>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
        </table>

        {% include 'admin/partials/paginationControl.twig' %}
    </div>

    <aside>
        {% if hasAccess('cudi_admin_article', 'edit') %}
            <div class="sidebox">
                <div class="title">Back To Article</div>
                <div class="content">
                    <p>
                        <i>Please hit the link below to go back to the article!</i>
                    </p>
                    <p>
                        <a href="{{ url('cudi_admin_article', {"action": "edit", "id": article.getId()}) }}">&rarr; Back To Article</a>
                    </p>
                </div>
            </div>
        {% endif %}
    </aside>

    <div class="modal fade" id="removeMapping" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span>Litus Admin</span>
                    /Delete Mapping
                </div>
                <div class="modal-body">
                    <p>
                        You are about to delete the following mapping: <b class="articleTitle"></b> with <b class="subjectName"></b>!
                        Please note that this operation cannot be undone!
                    </p>
                    <p>
                        Are you sure you want to continue?
                    </p>
                    <div class="footer">
                        <button class="delete">Yes</button>
                        <button class="cancel" data-dismiss="modal">No</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

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

            $('#subject').typeaheadRemote(
                {
                    source: '{{ url("syllabus_admin_subject_typeahead", {"academicyear": currentAcademicYear.getCode() })}}',
                },
                {
                    items: 12,
                }
            ).change(function (e) {
                if ($(this).data('value')) {
                    $('[name="subject[id]"]').val($(this).data('value').id);
                } else {
                    $('[name="subject[id]"]').val('');
                }
            });
        });

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

            e.preventDefault();
            var removeMapping = $('#removeMapping');
            removeMapping.find('.articleTitle').html($(this).data('article'));
            removeMapping.find('.subjectName').html($(this).data('subject'));
            var id = $this.data('id');
            removeMapping.find('.delete').unbind('click').click(function () {
                $.post('{{ url('cudi_admin_article_subject', {"action": "delete"})}}' + id, function (data) {
                    if (data && 'success' == data.status) {
                        $('.flashmessage').addClass('hide');
                        $('.mapping_removed_success').removeClass('hide');
                        $('.item-' + id).remove();
                        removeMapping.modal('hide');
                    } else {
                        errorRemove();
{'fraction_non_alphanumeric': 0.16942075337597726, 'fraction_numerical': 0.0024875621890547263, 'mean_word_length': 1.5256899259591654, 'pattern_counts': {'":': 8, '<': 221, '<?xml version=': 0, '>': 221, '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': '3753469', 'n_tokens_mistral': 3200, 'n_tokens_neox': 2933, 'n_words': 599}