<commit_before>{% extends "assignment/base_assignment.html" %}
{% block title %}{{ block.super }} - {% trans "Assignment" %} "{{ assignment }}"{% endblock %}

{% block content %}
<div id="sidebar">

    <div class="box">
    <h4 style="float:left;">{% trans "Status" %}:</h4>
    <h4 style="text-align: right;">
    <a href="{% url print_assignment assignment.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Election' %}"></a>
    </h4>
    <span clear="all"></span>
    {% trans assignment.get_status_display %}
    <h4>{% trans "Number of available posts" %}:</h4>
    {{ assignment.posts }}
    </div>

    <br><br>

    {% if perms.assignment.can_manage_assignment %}
    <div class="box">
    <h4><b>{% trans "Manage election" %}</b></h4>

    <h4>{% trans "Change status" %}:</h4>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'sea' %}';"
        {% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}<br>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'vot' %}';"
        {% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'fin' %}';"
        {% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finish' %}

    <h4></h4>
    <a href="{% url assignment_edit assignment.id %}">
        <button><span class="icon edit">{%trans 'Edit' %}</span></button>
    </a>

    {% if not assignment.itemassignment_set.all %}
    <h4></h4>
    <a href='{% url item_new_default 'ItemAssignment' assignment.id %}'>
        <button type="button">
        <span class="icon item">{%trans 'New agenda item' %}</span>
        </button>
    </a>
    {% endif %}
    </div>
    {% endif %}


</div>

<div style="margin-right: 250px; min-width: 400px;">
    <h1>{{ assignment }}</h1>
    <p>{{ assignment.description }}</p>

    <h3>{% trans "Candidates" %}</h3>
    <ol>
    {% for profile in assignment.profile.all|dictsort:"user.first_name" %}
        <li>{{ profile }}
        {% if perms.assignment.can_manage_assignment %}
        {% if assignment.status == "sea" or assignment.status == "vot" %}
        <a href="{% url assignment_delother assignment.id profile.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Remove candidate' %}"></a>
        {% endif %}
        {% endif %}
        </li>
    {% empty %}
        <li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li>
    {% endfor %}
    </ol>

    {% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %}
    {% if  perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
    <form action="" method="post">{% csrf_token %}
        {% if perms.assignment.can_nominate_self %}
            <p>
            {% if user.profile in assignment.profile.all %}

            <a href='{% url assignment_delrun assignment.id %}'>
                <button type="button">
                <span class="icon removeuser">{%trans 'Withdraw self candidature' %}</span>
                </button>
            </a>
            {% else %}
            {% if user.profile %}
            <a href='{% url assignment_run assignment.id %}'>
                <button type="button">
                <span class="icon adduser">{%trans 'Self candidature' %}</span>
                </button>
            </a>
            {% endif %}
            {% endif %}
            </p>
        {% endif %}
        {% if perms.assignment.can_nominate_other %}
            {% for field in form %}
            <label>{{ field.label }}:</label>
            <nobr>{{ field }}
            {% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
            <a href="{% url user_new %}"><img src="/static/images/icons/list-add-user.png" title="{% trans 'Add new participant' %}"></a>
            {% endif %}
            </nobr>
            {% endfor %}
            <p>
            <button type="submit">
                <span class="icon ok">{%trans 'Apply' %}</span>
            </button>
            </p>
        {% endif %}
    </form>

    {% endif %}
    {% endif %}

    <p><br></p>
    <h3>{% trans "Election results" %}</h3>

{% if assignment.poll_set.all.count > 0 %}
    <table id="election_table" style="width: auto;">
    <tr>
    <th></th>
    {% with ballotnumber=assignment.poll_set.all.count %}
    <th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
    {% trans "ballot" %}</th>
    {% endwith %}
    </tr>
    <tr>
    <th>{% trans "Candidates" %}</th>
    {% for poll in assignment.poll_set.all %}
    {% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
    <th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}<commit_msg>Opened add-user-url in new tab.<commit_after>{% extends "assignment/base_assignment.html" %}
{% block title %}{{ block.super }} - {% trans "Assignment" %} "{{ assignment }}"{% endblock %}

{% block content %}
<div id="sidebar">

    <div class="box">
    <h4 style="float:left;">{% trans "Status" %}:</h4>
    <h4 style="text-align: right;">
    <a href="{% url print_assignment assignment.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Election' %}"></a>
    </h4>
    <span clear="all"></span>
    {% trans assignment.get_status_display %}
    <h4>{% trans "Number of available posts" %}:</h4>
    {{ assignment.posts }}
    </div>

    <br><br>

    {% if perms.assignment.can_manage_assignment %}
    <div class="box">
    <h4><b>{% trans "Manage election" %}</b></h4>

    <h4>{% trans "Change status" %}:</h4>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'sea' %}';"
        {% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}<br>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'vot' %}';"
        {% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br>
    <input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'fin' %}';"
        {% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finish' %}

    <h4></h4>
    <a href="{% url assignment_edit assignment.id %}">
        <button><span class="icon edit">{%trans 'Edit' %}</span></button>
    </a>

    {% if not assignment.itemassignment_set.all %}
    <h4></h4>
    <a href='{% url item_new_default 'ItemAssignment' assignment.id %}'>
        <button type="button">
        <span class="icon item">{%trans 'New agenda item' %}</span>
        </button>
    </a>
    {% endif %}
    </div>
    {% endif %}


</div>

<div style="margin-right: 250px; min-width: 400px;">
    <h1>{{ assignment }}</h1>
    <p>{{ assignment.description }}</p>

    <h3>{% trans "Candidates" %}</h3>
    <ol>
    {% for profile in assignment.profile.all|dictsort:"user.first_name" %}
        <li>{{ profile }}
        {% if perms.assignment.can_manage_assignment %}
        {% if assignment.status == "sea" or assignment.status == "vot" %}
        <a href="{% url assignment_delother assignment.id profile.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Remove candidate' %}"></a>
        {% endif %}
        {% endif %}
        </li>
    {% empty %}
        <li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li>
    {% endfor %}
    </ol>

    {% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %}
    {% if  perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
    <form action="" method="post">{% csrf_token %}
        {% if perms.assignment.can_nominate_self %}
            <p>
            {% if user.profile in assignment.profile.all %}

            <a href='{% url assignment_delrun assignment.id %}'>
                <button type="button">
                <span class="icon removeuser">{%trans 'Withdraw self candidature' %}</span>
                </button>
            </a>
            {% else %}
            {% if user.profile %}
            <a href='{% url assignment_run assignment.id %}'>
                <button type="button">
                <span class="icon adduser">{%trans 'Self candidature' %}</span>
                </button>
            </a>
            {% endif %}
            {% endif %}
            </p>
        {% endif %}
        {% if perms.assignment.can_nominate_other %}
            {% for field in form %}
            <label>{{ field.label }}:</label>
            <nobr>{{ field }}
            {% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
            <a href="{% url user_new %}" target="_blank"><img src="/static/images/icons/list-add-user.png" title="{% trans 'Add new participant' %}"></a>
            {% endif %}
            </nobr>
            {% endfor %}
            <p>
            <button type="submit">
                <span class="icon ok">{%trans 'Apply' %}</span>
            </button>
            </p>
        {% endif %}
    </form>

    {% endif %}
    {% endif %}

    <p><br></p>
    <h3>{% trans "Election results" %}</h3>

{% if assignment.poll_set.all.count > 0 %}
    <table id="election_table" style="width: auto;">
    <tr>
    <th></th>
    {% with ballotnumber=assignment.poll_set.all.count %}
    <th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
    {% trans "ballot" %}</th>
    {% endwith %}
    </tr>
    <tr>
    <th>{% trans "Candidates" %}</th>
    {% for poll in assignment.poll_set.all %}
    {% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
    <th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
{'fraction_non_alphanumeric': 0.19124200736291416, 'fraction_numerical': 0.005425305173416005, 'mean_word_length': 2.641269841269841, 'pattern_counts': {'":': 0, '<': 223, '<?xml version=': 0, '>': 225, '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': '8369', 'n_tokens_mistral': 3585, 'n_tokens_neox': 3189, 'n_words': 750}