Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found
Sélectionner une révision Git
  • 162-work-on-home-html
  • 166-codecov
  • 184-returning-meps-with-an-active-mandates-in-django-rql-filter
  • 189-design-v3-views
  • 194-used-solr-search-for-representative-instead-of-default-django-engine
  • 203-fix-deploy
  • compotista_downloader
  • development_features
  • docker
  • docker-compose-rewrite
  • docs_openshift
  • fixClient
  • flavien
  • flavienMain
  • graphene
  • i18n
  • locale
  • master
  • perf-rec
  • restructure
  • restructure_test
  • score_multiplier
  • search_update
  • test
  • update_test
  • design-v2
  • openshift-v0.1.77
  • openshift_build
28 résultats

Cible

Sélectionner le projet cible
  • la-quadrature-du-net/memopol/memopol
  • lnclt/political_memory
  • arthur/political_memory
  • agrausem/political_memory
  • periode/memopol
  • Anthony/memopol
  • Porkepix/memopol
  • jaster/memopol
  • luxcem/memopol
  • TAlone/memopol
10 résultats
Sélectionner une révision Git
  • 162-work-on-home-html
  • 166-codecov
  • 184-returning-meps-with-an-active-mandates-in-django-rql-filter
  • compotista_downloader
  • docker
  • fixClient
  • flavien
  • flavienMain
  • graphene
  • i18n
  • locale
  • master
  • perf-rec
  • restructure
  • restructure_test
  • score_multiplier
  • test
  • design-v2
  • openshift-v0.1.77
  • openshift_build
20 résultats
Afficher les modifications
Affichage de
avec 639 ajouts et 0 suppression
{% extends 'representatives/representative_detail.html' %}
{% load i18n %}
{% load fontawesome %}
{% load memopol_tags %}
{% block representative_content %}
{% if not dossiers %}
<p class="no-votes empty text-center">
{% trans "No vote has been recorded for this representative yet." %}
</p>
{% else %}
<div class="panel-group" id="accordion-dossier" role="tablist" aria-multiselectable="true">
{% for pk, d in dossiers.items %}
{% with dossier=d.dossier %}
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="dossier-heading-{{ pk }}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion-dossier" href="#dossier-{{ pk }}" aria-expanded="false" aria-controls="dossier-{{ pk }}">
{{ dossier.title }}
</a>
</h4>
<span class="pull-right">
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</div>
<div id="dossier-{{ pk }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dossier-heading-{{ pk }}">
<div class="panel-body">
<table class="table table-striped table-responsive text-center">
<thead>
<tr>
<th class="text-center">{% trans "Proposal" %}</th>
<th class="text-center">{% trans "Recommendation" %}</th>
<th class="text-center">{% trans "Vote" %}</th>
<th class="text-center nowrap">Points&nbsp;<a data-toggle="tooltip" data-placement="top" title="{% trans "Score is negative or positive depending on whether the representative voted as recommended" %}">{% fontawesome_icon "info-circle" %}</a>
</th>
</tr>
</thead>
<tbody>
{% for vote in d.votes %}
<tr>
<th>{{ vote.proposal.title }}</th>
<td>{{ vote.proposal.recommendation.recommendation|position_icon }}</td>
<td>{{ vote.position|position_icon:vote.proposal.recommendation.recommendation }}</td>
<td>
{{ vote.vote_score.score|score_badge:vote.proposal.recommendation.title }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endwith %}
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Members of the European Parliement" %}{% endblock %}
{% block container-class %}custom-listMEP{% endblock %}
{% block content %}
<h1 class="text-center">{% trans "Representatives" %}</h1>
<p class="lead text-center">
Found {{ paginator.count }} {% trans "representatives" %}.
</p>
{% include "blocks/listheader.html" %}
<div class="row card-list">
{% for mep in object_list %}
{% include "representatives/_representative_card.html" with representative=mep cols=4 %}
{% empty %}
{% trans "No representatives found !" %}
{% endfor %}
</div>
{% include "blocks/listfooter.html" %}
{% endblock %}
- extends 'base.html'
- load humanize
- load memopol_tags
- load representatives_recommendations_tags
- block head
{{ position_form.media }}
- block content
.row
- include 'representatives/_representative_block.html' with representative=representative
.row
- include 'representatives/_representative_menu.html' with representative=representative
.col-md-6
%h2 Mandates
%table.table.table-condensed.mandates
- for mandate in mandates
%tr.mandate
%td= mandate.role
%td
%a{:href => "{% group_url mandate.group %}"}
{{ mandate.group.name }}
- if mandate.group.abbreviation
{{ mandate.group.abbreviation }}
%td
- if mandate.begin_date
= mandate.begin_date|mandate_date:'d/m/Y'
%td
- if mandate.end_date
= mandate.end_date|mandate_date:'d/m/Y'
%td= mandate.constituency.name
\ No newline at end of file
- extends 'base.html'
- load humanize
- load memopol_tags
- load representatives_recommendations_tags
- block head
{{ position_form.media }}
- block content
.row
- include 'representatives/_representative_block.html' with representative=representative
.row
- include 'representatives/_representative_menu.html' with representative=representative
.col-md-6
.positions
%h2 Public positions
%table.table.table-condensed
- for position in representative.positions.all
%tr.position
%td= position.datetime|naturalday:'d/m/Y'
%td
%a{:href => '{{ position.get_absolute_url }}'}
=position.text|truncatewords:8
%td
%a{:href => '{{ position.link }}'}
= position.link
- include 'representatives_positions/_form.html' with form=position_form
- extends 'base.html'
- load humanize
- load representatives_tags
- load representatives_votes_tags
- load memopol_tags
- load representatives_recommendations_tags
- block head
......@@ -10,8 +9,10 @@
- block content
.row
.col-md-6
- include 'representatives/_representative_block.html' with representative=representative
- include 'representatives/_representative_block.html' with representative=representative
.row
- include 'representatives/_representative_menu.html' with representative=representative
.col-md-6
%h2#votes Votes
......@@ -19,6 +20,7 @@
%table.table.table-condensed.votes
%tr
%th Title
%th Date
%th.icon-cell
Memopol recommendation
%th.icon-cell
......@@ -29,45 +31,11 @@
- for vote in votes
%tr
%td= vote.proposal.recommendation.title
%td.date-cell
= vote.proposal.datetime|date:'N j, Y'
%td.icon-cell
= vote.proposal.recommendation.recommendation|position_icon
%td.icon-cell
= vote.position|position_icon
%td.icon-cell
= vote.absolute_score|score_label
%h2 Mandates
%table.table.table-condensed.mandates
- for mandate in mandates
%tr.mandate
%td= mandate.role
%td
%a{:href => "{{ mandate.group.get_absolute_url }}"}
{{ mandate.group.name }}
- if mandate.group.abbreviation
{{ mandate.group.abbreviation }}
%td= mandate.begin_date|mandate_date:'d/m/Y'
%td= mandate.end_date|mandate_date:'d/m/Y'
%td= mandate.constituency.name
.positions
%h2 Public positions
%table.table.table-condensed
- for position in positions
%tr.position
%td= position.datetime|naturalday:'d/m/Y'
%td
%a{:href => '{{ position.get_absolute_url }}'}
=position.text|truncatewords:8
%td
- for tag in position.tags.all
%span.label.label-default
= tag
%td
%a{:href => '{{position.link}}'}
= position.link
- include 'representatives_positions/_form.html' with form=position_form
= vote.score|score_label
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
{% load memopol_tags %}
{% with dossier=object %}
{% block title %}{{ dossier.title }}{% endblock %}
{% block content %}
<div class="row" id="dossier-detail">
<div class="col-sm-12">
<h1 class="text-center">{{ dossier.title }}</h1>
<div class="col-sm-12">
<dl class="dl-horizontal">
<dt>{% trans "Themes" %}</dt>
<dd>
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
{% if not dossier.themes.all|length %}{% trans "None" %}{% endif %}
</dd>
</dl>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-tabs nav-justified" role="tablist">
<li role="presentation" {% if tab == 'recommendations' %}class="active"{% endif %}>
<a href="{% url 'dossier-recommendations' pk=dossier.pk %}" role="tab">
<h3>{% trans "Recommendations" %}</h3>
</a>
</li>
<li role="presentation" {% if tab == 'proposals' %}class="active"{% endif %}>
<a href="{% url 'dossier-proposals' pk=dossier.pk %}" role="tab">
<h3>{% trans "Other proposals" %}</h3>
</a>
</li>
<li role="presentation" {% if tab == 'documents' %}class="active"{% endif %}>
<a href="{% url 'dossier-documents' pk=dossier.pk %}" role="tab">
<h3>{% trans "Documents" %}</h3>
</a>
</li>
</ul>
<div class="tab-content">
{% block dossier_content %}{% endblock %}
</div>
</div>
</div>
{% endblock %}
{% endwith %}
{% extends 'representatives_votes/dossier_detail.html' %}
{% load i18n %}
{% load memopol_tags %}
{% block dossier_content %}
<table class="table table-responsive table-striped">
<tr>
<th>
{% trans "Chamber" %}
</th>
<th>
{% trans "Document type" %}
</th>
<th>
{% trans "Title" %}
</th>
</tr>
{% for document in documents %}
<tr class="document">
<td>
{{ document.chamber|chamber_icon }}
</td>
<td>
<a class="external" href="{{ document.link }}" target="_blank">
{% if document.kind == 'procedure-file' %}
{% trans "Procedure file" %}
{% else %}
{% trans document.kind %}
{% endif %}
</a>
</td>
<td>
<a class="external" href="{{ document.link }}" target="_blank">
{{ document.title }}
</a>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
{% extends 'representatives_votes/dossier_detail.html' %}
{% block dossier_content %}
{% include "blocks/_proposal_list.html" with show_recommendations=False %}
{% endblock %}
{% extends 'representatives_votes/dossier_detail.html' %}
{% block dossier_content %}
{% include "blocks/_proposal_list.html" with show_recommendations=True %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% load memopol_tags %}
{% load humanize %}
{% block title %}{% trans "Dossiers" %}{% endblock %}
{% block content %}
<h1 class="text-center">{% trans "Dossiers" %}</h1>
<p class="lead text-center">
{% blocktrans count counter=paginator.count %}{{ counter }} dossier{% plural %}{{ counter }} dossiers{% endblocktrans %}.
</p>
{% include "blocks/listheader.html" %}
{% include "blocks/_dossier_list.html" with dossiers=object_list %}
{% include "blocks/listfooter.html" %}
{% endblock %}
{{ object.id }}
{{ object.full_name }}
{{ object.slug }}$
{{ object.ascii_name}}
{% load i18n %}
{% blocktrans %}
Memopol is free software, released under the terms of the
<a href="http://www.gnu.org/licenses/agpl.html" target="_blank">GNU aGPL v3+</a>.
{% endblocktrans %}
{% load i18n %}
<p>
{% blocktrans %}
Use this form to submit a public position taken by a representative and
related to one of the themes followed on this instance of Memopol.
Public positions may include blog or social network posts, interviews,
parliament interventions...
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
Be sure to include a relevant excerpt from the public position as well as
a valid link that refers to it. Note that positions will be reviewed by
the staff before publication.
{% endblocktrans %}
</p>
Fichier déplacé
# coding: utf-8
import re
from django import template
from django.contrib.humanize.templatetags.humanize import naturalday
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.utils.safestring import mark_safe
register = template.Library()
link = u'<a class="{network}-link" href="{url}" target="_blank">{label}</a>'
def cssify(string):
return re.sub('[^a-z_-]', '', string.lower())
@register.filter
def country_flag(country, tplace='bottom'):
# Enable using groups instead of countries
code = country.code if hasattr(country, 'code') else country.abbreviation
return mark_safe(
u'<span class="flag-icon flag-icon-{code}" title="{name}"'
u' data-toggle="tooltip" data-placement="{place}"></span>'.format(
code=code.lower(), place=tplace, name=country.name))
@register.filter
def chamber_icon(chamber, tplace='bottom'):
url = static('images/chamber-%s.png' % cssify(chamber.abbreviation))
return mark_safe(
u'<span class="chamber-icon" style="background-image: url({url})"'
u' data-toggle="tooltip" data-placement="{place}"'
u' title="{name}"></span>'.format(
name=chamber.name,
url=url,
place=tplace
)
)
@register.filter
def group_icon(group, tplace='bottom'):
url = static('images/group-%s.png' % cssify('%s-%s' % (
group.chamber.abbreviation, group.abbreviation)))
return mark_safe(
u'<span class="group-icon" style="background-image: url({url})"'
u' data-toggle="tooltip" data-placement="{place}" title="{name}">'
u'</span>'.format(url=url, name=group.name, place=tplace))
@register.filter
def mandate_date(date, arg=None):
if date is None or date.year == 9999:
return 'present'
else:
return naturalday(date, arg)
@register.filter
def position_icon(position, recommendation=None):
color = 'default'
if recommendation:
if position == recommendation:
color = 'success'
else:
color = 'danger'
if position == 'for':
icon = "thumbs-up"
elif position == 'against':
icon = "thumbs-down"
else:
icon = "circle-o"
pattern = '<i class="fa fa-%s text-%s" title="%s"></i>'
return mark_safe(pattern % (icon, color, position))
@register.filter
def proposal_status_label(status, recommendation=None):
color = 'default'
if recommendation:
reco = recommendation.recommendation
if (reco == 'for' and status == 'adopted' or
reco == 'against' and status == 'rejected'):
color = 'success'
elif (reco == 'for' and status == 'rejected' or
reco == 'against' and status == 'adopted'):
color = 'danger'
pattern = '<span class="label label-%s">%s</span>'
return mark_safe(pattern % (color, status))
@register.filter
def score_badge(score, tooltip=None):
score = int(score or 0)
if score > 0:
color = 'success'
elif score < 0:
color = 'danger'
else:
color = 'primary'
attrs = ''
if tooltip:
attrs = 'data-toggle="tooltip" data-placement="%s" title="%s"'
attrs = attrs % ('left', tooltip)
pattern = '<span class="badge badge-%s" %s>%s</span>'
return mark_safe(pattern % (color, attrs, score))
@register.filter
def cast_str(val):
return str(val)
@register.filter
def proposal_themes(proposal):
return set(proposal.themes.all()) | set(proposal.dossier.themes.all())
Fichier déplacé
from django import test
from responsediff.test import ResponseDiffTestMixin
from memopol_scores.models import RepresentativeScore
class BaseTest(ResponseDiffTestMixin, test.TestCase):
fixtures = ['data_sample.json']
"""
Common queries
- 1 for settings
"""
left_pane_queries = 1
def setUp(self):
RepresentativeScore.refresh()
def request_test(self, url=None):
self.assertResponseDiffEmpty(self.client.get(url or self.url))
def selector_test(self, selector, url=None):
self.assertResponseDiffEmpty(self.client.get(url or self.url),
selector)
class RepresentativeBaseTest(BaseTest):
tab = 'none'
base_url = '/representatives/olivier-dussopt-1978-08-16/%s/'
"""
Common queries plus:
- 1 for session key
- 1 for chamber abbreviations (helper for chamber websites)
- 1 for the representative
- 1 for the main mandate
- 1 for emails
- 1 for social websites
- 1 for chamber websites
- 1 for other websites
- 1 for addresses
- 2 for phone numbers related to addresses
- 1 for other phone numbers
- 2 for themes and theme scores
- 1 for DAL to fetch its initial value in the position form
"""
queries = BaseTest.left_pane_queries + 15
@property
def url(self):
return self.base_url % self.tab
def do_query_test(self):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
self.client.get(self.url)
class ThemeBaseTest(BaseTest):
tab = 'none'
base_url = '/themes/etat-durgence/%s/'
"""
Common queries plus:
- 1 for the theme
- 1 for DAL to fetch its initial value in the position form
"""
queries = BaseTest.left_pane_queries + 2
@property
def url(self):
return self.base_url % self.tab
def do_query_test(self):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
self.client.get(self.url)
class DossierBaseTest(BaseTest):
tab = 'none'
base_url = '/dossiers/15409/%s/'
"""
Common queries plus:
- 1 for the dossier
- 1 for related themes
"""
queries = BaseTest.left_pane_queries + 2
@property
def url(self):
return self.base_url % self.tab
def do_query_test(self):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
self.client.get(self.url)
"""
Memopol local settings example.
Edit and rename to local_settings.py to use.
"""
import os
from socket import gethostname
DATA_DIR = 'data'
LOG_DIR = 'log'
PUBLIC_DIR = 'wsgi/static'
DATABASES = {
'default': {
'NAME': os.environ.get('CI_BUILD_REF_NAME'),
'USER': 'memopol_test',
'PASSWORD': 'memopol_test',
'HOST': 'localhost',
'PORT': '5433',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
}
}
ALLOWED_HOSTS = [
gethostname(),
]
SITE_ID = 1
SITE_NAME = 'Memopol'
SITE_DOMAIN = gethostname()
ORGANIZATION_NAME = 'Memopol'
<h1 class="text-center">Pouvoirs publics : prorogation de l'application de la loi sur l'état d'urgence</h1>
\ No newline at end of file
{
"status_code": 200
}
\ No newline at end of file