<commit_before>{% extends "base.html" %}

{% block sidelinks %}
    <li><a href="{% url meps:mep_raw mep_id %}">{% trans "View Raw JSON" %}</a></li>
{% endblock %}

{% block content %}
<article>
<header><h1 id="name">{{ mep.infos.name.first }} {{ mep.infos.name.last|upper }}{% trans ", member of the european parliament" %}</h1></header>

<section id="summary">
<h1 class="collapsible expanded">{% trans "General information" %}</h1>

<ul id="infos" class="body">

<div class="quickView">
<img class="mugshot" src="http://www.europarl.europa.eu/mepphoto/{{ mep.extid }}.jpg" onerror="onMugshotError(this);"/>
<span>{{ mep.infos.name.first }} {{ mep.infos.name.last|upper }} <img src="{{ MEDIA_URL }}img/countries/small/{{ mep.infos.constituency.country.code }}.png"/> </span>
<img class="grouplogo" src="{{ MEDIA_URL }}img/groups/eu/{{ mep.infos.group.abbreviation|cut:"/" }}.png"/><a href="{% url meps:index_by_group mep.infos.group.abbreviation %}">{{ mep.infos.group.abbreviation }}</a>
</div>

<li><i>{% if mep.infos.gender == "F" %}{% trans "Born on (female)" %}{% else %}{% trans "Born on" %}{% endif %}</i>
{% blocktrans with mep.infos.birth.date.day as day and mep.infos.birth.date.month as month and mep.infos.birth.date.year as year and mep.infos.birth.place.city as city %}{{ day }}/{{ month }}/{{ year }} <i>at</i> {{ city }}{% endblocktrans %}</li>
<li><i>{% trans "Country" %}</i>:  <img src="{{ MEDIA_URL }}img/countries/small/{{ mep.infos.constituency.country.code }}.png"/> {{ mep.infos.constituency.country.name }} </li>
<li><i>{% trans "Political group: " %}</i><a href="{% url meps:index_by_group mep.infos.group.abbreviation %}">{{ mep.infos.group.name }} ({{ mep.infos.group.abbreviation }})</a></li>
{% if mep.infos.group.party %}<li><i>{% trans "Party: " %}</i>{{ mep.infos.group.party }}</li>{% endif %}
</ul>

<div id="contact">
	<h2 class="collapsible expanded">{% trans "Contact" %}</h2>

		<ul class="body">
		{% for city,addr in mep.contact.address.items %}
		<li><b>{{ addr.label|default:_("Other adresse") }}</b><br/>
			{% if addr.building %} {% trans "Building" %} {{ addr.building.name }} {{ addr.office}}<br/>{% endif %}
			{{ addr.street }}, {{ addr.postcode }} {{ addr.city }}<br/>
			{% if addr.phone %}{% trans "Tel.: " %}{% for phone in addr.phone %} <a href="callto://{{ phone|cut:" " }}">{{ phone }}</a>&nbsp;{% endfor %}<br/>{% endif %}
			{% if addr.fax %}{% trans "Fax: " %}{{ addr.fax }}{% endif %}
			 
		</li>
		{% endfor %}
		
		
		<li><i>{% trans "E-mail&nbsp;: " %}</i><a href="mailto:{{ mep.contact.email.text }}">{{ mep.contact.email.text }}</a></li>
			
		{% for webaddr in mep.contact.web %}
		<li>
		    <i>{% trans "Web&nbsp;: " %}</i><a target="_" href="{{ webaddr.text }}">{{ webaddr.type|default:webaddr.text }}</a>
		</li>
		{% endfor %}
		
		</ul>
</div>

{% if mep.functions %}
<div id="functions">
    <h2 class="collapsible collapsed">{% trans "Functions" %}</h2>
    <ul class="body">
    {% for function in mep.functions %}
        <li>{{ function.role }} - {{ function.label }}</li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.cv.position %}
<div id="cv">
    <h2 class="collapsible collapsed">{% trans "CV" %}</h2>
    <ul class="body">
    {% for line in mep.cv.position %}
        <li>{{ line }}</li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.opinions %}
<div id="opinions">
    <h2 class="collapsible collapsed">{% trans "Opinions (memopol v1)" %}</h2>
    <ul class="body">
    {% for line in mep.opinions %}
        <li><b>{{ line.title }}</b> (le {{ line.date }})<br/>{% autoescape off %}{{ line.content }}{% endautoescape %} &nbsp; <a target="_" href="{{ line.url }}"><br/>{% trans "Read more..." %}</a> </li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.scores %}
    <div id="scores">
        <h2 class="collapsible collapsed">{% trans "Scores" %} (TODO moyenne: {{average}})</h2>
        <ul class="body">
        {% for score in score_list %}
        <li style="background:{{ score.color }}">

            {{ score.label }}: <strong>{{ score.value }}</strong> ({% trans "on" %} {{ score.date }})<br/><a target="_" href="http://www.laquadrature.net/wiki/{{ score.wiki }}">{% trans "Read more..." %}</a>
            </li>
        {% endfor %}
        </ul>
        <img src="/static/img/trends/meps/{{ mep_id }}-scores.png" />
    </div>
{% endif %}

</section>


<section id="positions">
    <h1>{% trans "Opinions" %}</h1>

    {% for pos in positions %}
        {% if pos.visible %}
        <article><h2>{% trans "Opinion" %}</h2>{{ pos.content }}</article>
        {% endif %}
    {% endfor %}

    <aside id="positionsnote">
    {% ifequal visible_count 0 %}
    {% ifnotequal positions|length visible_count %}
    {% trans "Some opinions are awaiting moderation." %}
    {% else %}
    {% trans "No opinion is currently recorded, but you can contribute by adding one!" %}
    {% endifnotequal %}
    {% endifequal %}
    </aside>



<script type="text/javascript">

function addPositionSubmitButtonClicked()
{
    var contents = jQuery("#text").val();
    if (contents.length == 0)
    {
        msg("{% trans "The input text is empty, please enter some text..." %}", 1, "red");
        return;
    }

    var btn = jQuery(this);
    startSpinner(btn);
    disable("#addPositionCancelButton");

    ajax_addPosition("{{mep_id}}", contents, function(json) {

        stopSpinner(btn);
        enable("#addPositionCancelButton");

        if (json['success'])
        {
            changeVisibility({addPosition: false, addPositionButton: true});
            jQuery("#text").val("");
            msg("{% trans "Your contribution has been recorded" %}", 1);
        }
        else
        {
            msg("{% trans "An error appeared, your contribution was not recorded" %}", 0, "red");
        }
    });
}

</script>


<div id="addPosition" class="uiform" style="display: none" tabindex="1">
    <h3>{% trans "Add an opinion" %}</h3>
    <p>{% trans "This form allows you to add an opinion of one MEP. This opinion will only be published after being moderated."%}</p>
    <br/>
    <textarea rows="5" cols="80" name="text" id="text" placeholder="{% trans "Enter this MEP's opinion here" %}"></textarea>
    <br/>
    <button id="addPositionSubmitButton" class="submit">{% trans "Add" %}</button>
    <button id="addPositionCancelButton" class="cancel">{% trans "Cancel" %}</button>
</div>

<button id="addPositionButton" class="submit">{% trans "Add this opinion" %}</button>
</section>

</article>




{% endblock %}
{% block documentReady %}

    activateCollapsible();

    onClickChangeVisibility("addPositionButton", {addPosition: true, addPositionButton: false});
    onClickChangeVisibility("addPositionCancelButton", {addPosition: false, addPositionButton: true});
    jQuery("#addPositionSubmitButton").click(addPositionSubmitButtonClicked);

{% endblock %}<commit_msg>[mod] template per mep, button 'add this opinion' -> 'add an opinion'<commit_after>{% extends "base.html" %}

{% block sidelinks %}
    <li><a href="{% url meps:mep_raw mep_id %}">{% trans "View Raw JSON" %}</a></li>
{% endblock %}

{% block content %}
<article>
<header><h1 id="name">{{ mep.infos.name.first }} {{ mep.infos.name.last|upper }}{% trans ", member of the european parliament" %}</h1></header>

<section id="summary">
<h1 class="collapsible expanded">{% trans "General information" %}</h1>

<ul id="infos" class="body">

<div class="quickView">
<img class="mugshot" src="http://www.europarl.europa.eu/mepphoto/{{ mep.extid }}.jpg" onerror="onMugshotError(this);"/>
<span>{{ mep.infos.name.first }} {{ mep.infos.name.last|upper }} <img src="{{ MEDIA_URL }}img/countries/small/{{ mep.infos.constituency.country.code }}.png"/> </span>
<img class="grouplogo" src="{{ MEDIA_URL }}img/groups/eu/{{ mep.infos.group.abbreviation|cut:"/" }}.png"/><a href="{% url meps:index_by_group mep.infos.group.abbreviation %}">{{ mep.infos.group.abbreviation }}</a>
</div>

<li><i>{% if mep.infos.gender == "F" %}{% trans "Born on (female)" %}{% else %}{% trans "Born on" %}{% endif %}</i>
{% blocktrans with mep.infos.birth.date.day as day and mep.infos.birth.date.month as month and mep.infos.birth.date.year as year and mep.infos.birth.place.city as city %}{{ day }}/{{ month }}/{{ year }} <i>at</i> {{ city }}{% endblocktrans %}</li>
<li><i>{% trans "Country" %}</i>:  <img src="{{ MEDIA_URL }}img/countries/small/{{ mep.infos.constituency.country.code }}.png"/> {{ mep.infos.constituency.country.name }} </li>
<li><i>{% trans "Political group: " %}</i><a href="{% url meps:index_by_group mep.infos.group.abbreviation %}">{{ mep.infos.group.name }} ({{ mep.infos.group.abbreviation }})</a></li>
{% if mep.infos.group.party %}<li><i>{% trans "Party: " %}</i>{{ mep.infos.group.party }}</li>{% endif %}
</ul>

<div id="contact">
	<h2 class="collapsible expanded">{% trans "Contact" %}</h2>

		<ul class="body">
		{% for city,addr in mep.contact.address.items %}
		<li><b>{{ addr.label|default:_("Other adresse") }}</b><br/>
			{% if addr.building %} {% trans "Building" %} {{ addr.building.name }} {{ addr.office}}<br/>{% endif %}
			{{ addr.street }}, {{ addr.postcode }} {{ addr.city }}<br/>
			{% if addr.phone %}{% trans "Tel.: " %}{% for phone in addr.phone %} <a href="callto://{{ phone|cut:" " }}">{{ phone }}</a>&nbsp;{% endfor %}<br/>{% endif %}
			{% if addr.fax %}{% trans "Fax: " %}{{ addr.fax }}{% endif %}
			 
		</li>
		{% endfor %}
		
		
		<li><i>{% trans "E-mail&nbsp;: " %}</i><a href="mailto:{{ mep.contact.email.text }}">{{ mep.contact.email.text }}</a></li>
			
		{% for webaddr in mep.contact.web %}
		<li>
		    <i>{% trans "Web&nbsp;: " %}</i><a target="_" href="{{ webaddr.text }}">{{ webaddr.type|default:webaddr.text }}</a>
		</li>
		{% endfor %}
		
		</ul>
</div>

{% if mep.functions %}
<div id="functions">
    <h2 class="collapsible collapsed">{% trans "Functions" %}</h2>
    <ul class="body">
    {% for function in mep.functions %}
        <li>{{ function.role }} - {{ function.label }}</li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.cv.position %}
<div id="cv">
    <h2 class="collapsible collapsed">{% trans "CV" %}</h2>
    <ul class="body">
    {% for line in mep.cv.position %}
        <li>{{ line }}</li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.opinions %}
<div id="opinions">
    <h2 class="collapsible collapsed">{% trans "Opinions (memopol v1)" %}</h2>
    <ul class="body">
    {% for line in mep.opinions %}
        <li><b>{{ line.title }}</b> (le {{ line.date }})<br/>{% autoescape off %}{{ line.content }}{% endautoescape %} &nbsp; <a target="_" href="{{ line.url }}"><br/>{% trans "Read more..." %}</a> </li>
    {% endfor %}
    </ul>
</div>
{% endif %}

{% if mep.scores %}
    <div id="scores">
        <h2 class="collapsible collapsed">{% trans "Scores" %} (TODO moyenne: {{average}})</h2>
        <ul class="body">
        {% for score in score_list %}
        <li style="background:{{ score.color }}">

            {{ score.label }}: <strong>{{ score.value }}</strong> ({% trans "on" %} {{ score.date }})<br/><a target="_" href="http://www.laquadrature.net/wiki/{{ score.wiki }}">{% trans "Read more..." %}</a>
            </li>
        {% endfor %}
        </ul>
        <img src="/static/img/trends/meps/{{ mep_id }}-scores.png" />
    </div>
{% endif %}

</section>


<section id="positions">
    <h1>{% trans "Opinions" %}</h1>

    {% for pos in positions %}
        {% if pos.visible %}
        <article><h2>{% trans "Opinion" %}</h2>{{ pos.content }}</article>
        {% endif %}
    {% endfor %}

    <aside id="positionsnote">
    {% ifequal visible_count 0 %}
    {% ifnotequal positions|length visible_count %}
    {% trans "Some opinions are awaiting moderation." %}
    {% else %}
    {% trans "No opinion is currently recorded, but you can contribute by adding one!" %}
    {% endifnotequal %}
    {% endifequal %}
    </aside>



<script type="text/javascript">

function addPositionSubmitButtonClicked()
{
    var contents = jQuery("#text").val();
    if (contents.length == 0)
    {
        msg("{% trans "The input text is empty, please enter some text..." %}", 1, "red");
        return;
    }

    var btn = jQuery(this);
    startSpinner(btn);
    disable("#addPositionCancelButton");

    ajax_addPosition("{{mep_id}}", contents, function(json) {

        stopSpinner(btn);
        enable("#addPositionCancelButton");

        if (json['success'])
        {
            changeVisibility({addPosition: false, addPositionButton: true});
            jQuery("#text").val("");
            msg("{% trans "Your contribution has been recorded" %}", 1);
        }
        else
        {
            msg("{% trans "An error appeared, your contribution was not recorded" %}", 0, "red");
        }
    });
}

</script>


<div id="addPosition" class="uiform" style="display: none" tabindex="1">
    <h3>{% trans "Add an opinion" %}</h3>
    <p>{% trans "This form allows you to add an opinion of one MEP. This opinion will only be published after being moderated."%}</p>
    <br/>
    <textarea rows="5" cols="80" name="text" id="text" placeholder="{% trans "Enter this MEP's opinion here" %}"></textarea>
    <br/>
    <button id="addPositionSubmitButton" class="submit">{% trans "Add" %}</button>
    <button id="addPositionCancelButton" class="cancel">{% trans "Cancel" %}</button>
</div>

<button id="addPositionButton" class="submit">{% trans "Add an opinion" %}</button>
</section>

</article>




{% endblock %}
{% block documentReady %}

    activateCollapsible();

    onClickChangeVisibility("addPositionButton", {addPosition: true, addPositionButton: false});
    onClickChangeVisibility("addPositionCancelButton", {addPosition: false, addPositionButton: true});
    jQuery("#addPositionSubmitButton").click(addPositionSubmitButtonClicked);

{% endblock %}
{'fraction_non_alphanumeric': 0.22601356225652863, 'fraction_numerical': 0.004328379743182802, 'mean_word_length': 3.4878601489155066, 'pattern_counts': {'":': 0, '<': 295, '<?xml version=': 0, '>': 296, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1861019', 'n_tokens_mistral': 5200, 'n_tokens_neox': 4732, 'n_words': 1136}