Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
irfm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
regardscitoyens
irfm
Commits
66d3f991
Commit
66d3f991
authored
May 06, 2017
by
Nicolas Joyard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout page parlementaire de base
parent
5cf7bf3b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
292 additions
and
49 deletions
+292
-49
irfm/models/constants.py
irfm/models/constants.py
+41
-8
irfm/routes.py
irfm/routes.py
+66
-9
irfm/static/style.css
irfm/static/style.css
+50
-0
irfm/templates/_base.html.j2
irfm/templates/_base.html.j2
+2
-0
irfm/templates/demande.html.j2
irfm/templates/demande.html.j2
+19
-0
irfm/templates/index.html.j2
irfm/templates/index.html.j2
+32
-18
irfm/templates/list.html.j2
irfm/templates/list.html.j2
+20
-14
irfm/templates/parlementaire.html.j2
irfm/templates/parlementaire.html.j2
+62
-0
No files found.
irfm/models/constants.py
View file @
66d3f991
...
...
@@ -30,49 +30,82 @@ ETAPES = [
{
'ordre'
:
10
,
'label'
:
'À envoyer'
,
'description'
:
''
,
'description'
:
"""
La demande d'accès aux relevés de comptes du parlementaire n'a pas
encore été envoyée.
"""
,
'couleur'
:
'#cccccc'
,
},
{
'ordre'
:
15
,
'label'
:
'À confirmer'
,
'description'
:
"""
Un utilisateur a souhaité se charger de l'envoi de la demande, mais
nous n'avons pas encore confirmation de cet envoi.
"""
,
'couleur'
:
'#8888aa'
,
},
{
'ordre'
:
20
,
'label'
:
'Envoyé'
,
'description'
:
''
,
'description'
:
"""
La demande d'accès aux relevés de comptes du parlementaire a été
envoyée, mais nous n'avons pas encore d'avis de réception.
"""
,
'couleur'
:
'#88dddd'
,
},
{
'ordre'
:
30
,
'label'
:
'AR reçu'
,
'description'
:
''
,
'description'
:
"""
Le parlementaire a reçu la demande d'accès à ses relevés de comptes.
"""
,
'couleur'
:
'#8888dd'
,
},
{
'ordre'
:
40
,
'label'
:
'Réponse positive'
,
'description'
:
''
,
'description'
:
"""
Le parlementaire nous a transmis les relevés de compte demandés.
"""
,
'couleur'
:
'#88dd88'
,
},
{
'ordre'
:
50
,
'label'
:
'Réponse négative'
,
'description'
:
''
,
'description'
:
"""
Le parlementaire a refusé de nous transmettre ses relevés de
compte, soit explicitement, soit par voie de presse, soit à
l'expiration d'un délai de 2 mois après réception de la demande.
"""
,
'couleur'
:
'#dd8888'
,
},
{
'ordre'
:
60
,
'label'
:
'Demande CADA'
,
'description'
:
''
,
'description'
:
"""
Suite au refus du parlementaire, nous avons transmis la demande à
la Comission d'Accès aux Documents Administratifs.
"""
,
'couleur'
:
'#ddaa88'
,
},
{
'ordre'
:
70
,
'label'
:
'Accord CADA'
,
'description'
:
''
,
'description'
:
"""
Suite au refus du parlementaire, la Comission d'Accès aux Documents
Administratifs a répondu favorablement à la transmission des
relevés demandés.
"""
,
'couleur'
:
'#44aa44'
,
},
{
'ordre'
:
90
,
'label'
:
'Refus CADA'
,
'description'
:
''
,
'description'
:
"""
Suite au refus du parlementaire, la Comission d'Accès aux Documents
Administratifs a refusé la transmission des relevés demandés.
"""
,
'couleur'
:
'#aa4444'
,
},
]
irfm/routes.py
View file @
66d3f991
# -*- coding: utf-8 -*-
from
flask
import
render_template
from
flask
import
abort
,
render_template
,
url_for
from
sqlalchemy.orm
import
joinedload
,
contains_eager
from
sqlalchemy.sql.expression
import
func
...
...
@@ -20,17 +20,45 @@ def setup_routes(app):
return
{
'piwik'
:
piwik
}
@
app
.
context_processor
def
inject_menu
():
return
{
'menu'
:
[
{
'url'
:
'/'
,
'label'
:
'Accueil'
,
'endpoint'
:
'home'
},
{
'url'
:
'/parlementaires'
,
'label'
:
'Liste des parlementaires'
,
'endpoint'
:
'parlementaires'
},
{
'url'
:
url_for
(
'home'
),
'label'
:
'Accueil'
,
'endpoint'
:
'home'
,
},
{
'url'
:
url_for
(
'parlementaires'
),
'label'
:
'Liste des parlementaires'
,
'endpoint'
:
'parlementaires'
,
},
]
}
@
app
.
template_filter
(
'titre_parlementaire'
)
def
titre_parlementaire
(
parl
):
if
parl
.
sexe
==
'F'
:
return
'Madame la %s'
%
(
'Sénatrice'
if
parl
.
chambre
==
'SEN'
else
'Députée'
)
else
:
return
'Monsieur le %s'
%
(
'Sénateur'
if
parl
.
chambre
==
'SEN'
else
'Député'
)
@
app
.
template_filter
(
'fonc_parlementaire'
)
def
fonc_parlementaire
(
parl
):
if
parl
.
sexe
==
'F'
:
return
'Sénatrice'
if
parl
.
chambre
==
'SEN'
else
'Députée'
else
:
return
'Sénateur'
if
parl
.
chambre
==
'SEN'
else
'Député'
@
app
.
template_filter
(
'label_groupe'
)
def
label_groupe
(
groupe
):
return
'<span title="%s" class="label" '
\
'style="background-color: %s;">%s</span>'
%
(
groupe
.
nom
,
groupe
.
couleur
,
groupe
.
sigle
)
@
app
.
route
(
'/'
,
endpoint
=
'home'
)
def
home
():
...
...
@@ -50,14 +78,16 @@ def setup_routes(app):
return
render_template
(
'index.html.j2'
,
parlementaire
=
pqs
.
first
(),
etapes
=
{
etapes
=
[
e
.
Etape
for
e
in
eqs
],
etapes_data
=
{
'labels'
:
[
e
.
Etape
.
label
for
e
in
eqs
],
'couleurs'
:
[
e
.
Etape
.
couleur
for
e
in
eqs
],
'counts'
:
[
e
.
nb
for
e
in
eqs
]
'datasets'
:
[{
'data'
:
[
e
.
nb
for
e
in
eqs
],
'backgroundColor'
:
[
e
.
Etape
.
couleur
for
e
in
eqs
]
}]
}
)
@
app
.
route
(
'/parlementaires'
,
endpoint
=
'parlementaires'
)
def
parlementaires
():
qs
=
Parlementaire
.
query
.
join
(
Parlementaire
.
etape
)
\
...
...
@@ -70,3 +100,30 @@ def setup_routes(app):
'list.html.j2'
,
parlementaires
=
qs
)
@
app
.
route
(
'/parlementaires/<id>'
,
endpoint
=
'parlementaire'
)
def
parlementaire
(
id
):
parl
=
Parlementaire
.
query
.
filter_by
(
id
=
id
)
\
.
options
(
joinedload
(
Parlementaire
.
groupe
))
\
.
options
(
joinedload
(
Parlementaire
.
etape
))
\
.
first
()
if
not
parl
:
abort
(
404
)
return
render_template
(
'parlementaire.html.j2'
,
parlementaire
=
parl
)
@
app
.
route
(
'/parlementaires/<id>/demande'
,
endpoint
=
'demande'
)
def
demande
(
id
):
parl
=
Parlementaire
.
query
.
filter_by
(
id
=
id
).
first
()
if
not
parl
:
abort
(
404
)
return
render_template
(
'demande.html.j2'
,
parlementaire
=
parl
)
irfm/static/style.css
View file @
66d3f991
.chamber-icon
{
height
:
1.5em
;
}
.parl-card
{
display
:
flex
;
flex-flow
:
row
nowrap
;
align-items
:
center
;
}
.parl-card
.parl-photo
{
margin-right
:
1em
;
flex-grow
:
0
;
flex-shrink
:
0
;
}
.parl-card
.parl-detail
{
flex-grow
:
1
;
flex-shrink
:
0
;
}
.search-vector
{
display
:
none
;
}
td
.col-center
,
th
.col-center
{
text-align
:
center
;
}
td
.col-right
,
th
.col-right
{
text-align
:
right
;
}
#pie-container
{
display
:
flex
;
flex-flow
:
row
nowrap
;
align-items
:
center
;
}
#pie-container
>
*
{
flex-grow
:
0
;
flex-shrink
:
0
;
}
#pie-container
>
:first-child
{
flex-basis
:
70%
;
}
#pie-container
>
:last-child
{
flex-basis
:
30%
;
}
\ No newline at end of file
irfm/templates/_base.html.j2
View file @
66d3f991
...
...
@@ -22,6 +22,8 @@
{% for item in menu %}
<li
role=
"presentation"
{%
if
request.endpoint =
=
item
.
endpoint
%}
class=
"active"
{%
endif
%}
><a
href=
"{{ item.url }}"
>
{{ item.label }}
</a></li>
{% endfor %}
{% block menuitem %}
{% endblock %}
</ul>
</div>
</header>
...
...
irfm/templates/demande.html.j2
0 → 100644
View file @
66d3f991
<pre>
Regards Citoyens
chez Julien Rabier
Bâtiment A2
17 rue Corneille
31100 Toulouse
à
{{ parlementaire.adresse }}
{{ parlementaire|titre_parlementaire }},
Veuillez nous envoyer vos relevés de compte.
Bien cordialement,
Regards Citoyens
</pre>
\ No newline at end of file
irfm/templates/index.html.j2
View file @
66d3f991
...
...
@@ -16,8 +16,18 @@
<header class="panel-heading">
<b>Avancement du projet</b>
</header>
<article class="panel-body">
<canvas id="pie-canvas" height="200"></canvas>
<article class="panel-body" id="pie-container">
<div>
{% for etape in etapes %}
<p>
<span class="label" style="background-color: {{ etape.couleur }};">{{ etape.label }}</span>
<small>{{ etape.description }}</small>
</p>
{% endfor %}
</div>
<div>
<canvas id="pie-canvas" height="10" width="10"></canvas>
</div>
</article>
</section>
...
...
@@ -33,9 +43,14 @@
<header class="panel-heading">
<b>Un parlementaire au hasard...</b>
</header>
<article class="panel-body">
<img src="{{ parlementaire.url_photo }}/120" align="left">
<b>{{ parlementaire.prenom }} {{ parlementaire.nom }}</b>
<article class="panel-body parl-card">
<img class="parl-photo" src="{{ parlementaire.url_photo }}/120" align="left">
<div class="parl-detail">
<b>{{ parlementaire.prenom }} {{ parlementaire.nom }}</b> {{ parlementaire.groupe|label_groupe }}<br>
{{ parlementaire|fonc_parlementaire }} – {{ parlementaire.nom_circo }} n°{{ parlementaire.num_circo }}<br><br>
<a class="btn btn-primary btn-sm" href="{{ url_for('parlementaire', id=parlementaire.id) }}" role="button">Envoyer la demande</a>
</div>
</article>
</section>
</div>
...
...
@@ -46,20 +61,19 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js" integrity="sha256-GcknncGKzlKm69d+sp+k3A2NyQE+jnu43aBl6rrDN2I=" crossorigin="anonymous"></script>
<script>
var chart = new Chart($('#pie-canvas'), {
type: 'pie',
data: {
labels: {{ etapes.labels|tojson }},
datasets: [
{
data: {{ etapes.counts|tojson }},
backgroundColor: {{ etapes.couleurs|tojson }}
$(document).ready(function () {
(function ($) {
var chart = new Chart($('#pie-canvas'), {
type: 'pie',
data: {{ etapes_data|tojson }},
options: {
legend: {
display: false
},
maintainAspectRatio: true
}
]
},
options: {
maintainAspectRatio: false
}
});
})(jQuery);
});
</script>
{% endblock %}
\ No newline at end of file
irfm/templates/list.html.j2
View file @
66d3f991
{% extends "_base.html.j2" %}
{% block header %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='bootstrap-sortable.css') }}">
{% endblock %}
{% block content %}
<section class="panel panel-default">
<header class="panel-heading">
...
...
@@ -17,29 +21,39 @@
<thead>
<tr>
<th colspan="2" data-defaultsort="asc" data-mainsort="1">Parlementaire</th>
<th>Groupe</th>
<th
class="col-center"
>Groupe</th>
<th>Circonscription</th>
<th>Etape</th>
<th class="col-center">Etape</th>
<th></th>
</tr>
</thead>
<tbody>
{% for parl in parlementaires %}
<tr>
<td>
<td
class="col-center"
>
<img class="chamber-icon" src="{{ url_for('static', filename=parl.chambre|lower+'.png') }}">
<span class="search-vector">{{ parl.nom }} {{ parl.prenom }} {{ parl.nom_circo }} {{ parl.num_deptmt }} {{ parl.groupe.sigle }} {{ parl.groupe.nom }}</span>
</td>
<td data-value="{{ parl.nom }} {{ parl.prenom }}">{{ parl.prenom }} {{ parl.nom }}</td>
<td
><span title="{{ parl.groupe.nom }}" class="label" style="background-color: {{ parl.groupe.couleur }};">{{ parl.groupe.sigle }}</span>
</td>
<td
class="col-center">{{ parl.groupe|label_groupe }}
</td>
<td data-value="{{ parl.num_deptmt }} {{ parl.num_circo }}">{{ parl.nom_circo }} n°{{ parl.num_circo }}</td>
<td><span class="label" style="background-color: {{ parl.etape.couleur }};">{{ parl.etape.label }}</span></td>
<td class="col-center">
<span class="label" style="background-color: {{ parl.etape.couleur }};">{{ parl.etape.label }}</span>
</td>
<td class="col-right">
{% if parl.etape.ordre == 10 %}
<a class="btn btn-primary btn-sm" href="{{ url_for('parlementaire', id=parl.id) }}" role="button">Envoyer la demande</a>
{% else %}
<a class="btn btn-default btn-sm" href="{{ url_for('parlementaire', id=parl.id) }}" role="button">Informations</a>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td class="warning" colspan="
5
">
<td class="warning" colspan="
6
">
<em>Aucun parlementaire trouvé :(</em>
</td>
</tr>
...
...
@@ -50,14 +64,6 @@
</section>
{% endblock %}
{% block header %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='bootstrap-sortable.css') }}">
<style>
.search-vector { display: none; }
</style>
{% endblock %}
{% block scripts %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='moment.min.js') }}"></script>
...
...
irfm/templates/parlementaire.html.j2
0 → 100644
View file @
66d3f991
{% extends "_base.html.j2" %}
{% block header %}
<style>
#letter-container {
text-align: center;
}
iframe {
width: 21cm;
height: 29.7cm;
margin-left: auto;
margin-right: auto;
border: 1px solid #ccc;
}
</style>
{% endblock %}
{% block menuitem %}
<li role="presentation" class="active"><a href="#">{{ parlementaire.prenom }} {{ parlementaire.nom }}</a></li>
{% endblock %}
{% block content %}
<div class="col-md-12">
<section class="panel panel-default">
<article class="panel-body parl-card">
<img class="parl-photo" src="{{ parlementaire.url_photo }}/120" align="left">
<div class="parl-detail">
<b>{{ parlementaire.prenom }} {{ parlementaire.nom }}</b> {{ parlementaire.groupe|label_groupe }}<br>
{{ parlementaire|fonc_parlementaire }} – {{ parlementaire.nom_circo }} n°{{ parlementaire.num_circo }}<br><br><br>
</div>
</article>
</section>
</div>
{% if parlementaire.etape.ordre == 10 %}
<div class="col-md-12" id="letter-container">
<button type="button" class="btn btn-primary btn-lg active" id="#print-button">Imprimer la demande</button>
<br><br>
<iframe name="demande" id="demande" src="{{ url_for('demande', id=parlementaire.id) }}">
</iframe>
</div>
{% else %}
WIIIIIII :)
{% endif %}
{% endblock %}
{% block scripts %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
(function ($) {
$('#print-button').click(function() {
frames['demande'].print();
});
})(jQuery);
});
</script>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment