Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Visam #1083

Closed
wants to merge 121 commits into from
Closed

Visam #1083

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
92e7cdf
Add experimental script
ronnix Feb 26, 2020
1b3cbe7
Add script to create fixtures (WIP)
ronnix Feb 26, 2020
1f2456c
Make Amendement.num a string (WIP)
ronnix Feb 26, 2020
bc0b076
Import articles and alineas from CSV export
davidbgk Feb 26, 2020
a288597
Make input file arg required
ronnix Feb 27, 2020
2c8be4a
Refactor: move bootstrapping and transaction management one level up
ronnix Feb 27, 2020
7a9c305
Refactor: rename function
ronnix Feb 27, 2020
7c607e7
Refactor: rename function
ronnix Feb 27, 2020
44f8087
Find dossier by slug to avoid clashes
ronnix Feb 27, 2020
72700bb
Add loading of amendements and reponses to CSV import script
ronnix Feb 27, 2020
c09e84c
Add extraction of auteur / groupe
ronnix Feb 27, 2020
1ea190a
Update visionneuse with amdt.num with spaces
davidbgk Feb 27, 2020
8c5a756
Add CCFP chambre
ronnix Feb 27, 2020
f9e2dff
Spiking on a derouleur view
davidbgk Feb 27, 2020
663326a
Fix article fetching for CCFP
ronnix Feb 27, 2020
ad09c2c
Don't try to create AN and Sénat lectures for Visam dossiers
ronnix Feb 27, 2020
0214665
Don't try to fetch amendements for CCFP lectures
ronnix Feb 27, 2020
d4bf16e
Do not show refresh button in journal of CCFP lectures
ronnix Feb 27, 2020
d9d16af
Add lecture created event to loading script
ronnix Feb 27, 2020
934d310
Add form to enter a new amendement
ronnix Mar 9, 2020
dc048cd
Change wording to match usage: “Exposé des motifs”
ronnix Mar 9, 2020
5c98988
Remove “N°” from heading
ronnix Mar 9, 2020
e198ea6
Update script to load 1, 2, or 3 columns of data
ronnix Mar 9, 2020
74e5882
Update warning text when no amendement on index
ronnix Mar 9, 2020
6dabffa
Only show link to amendement add form on CCFP lectures
ronnix Mar 9, 2020
4193ec2
Use a dropdown to choose article
ronnix Mar 9, 2020
c8f6d4d
Allow creating multiple dummy dossiers
ronnix Mar 9, 2020
bfd2ad2
Add position to newly created amendement
ronnix Mar 9, 2020
9f40471
Bring back the menu
ronnix Mar 9, 2020
9e619bd
Move button to add amendement below amendements list
ronnix Mar 9, 2020
b8cf99d
Handle required textarea fields on saisie amdt
davidbgk Mar 9, 2020
c97a640
Get the lecture for a given dossier in resources
davidbgk Mar 9, 2020
07e9a5c
Change app name to Visam
ronnix Mar 11, 2020
9005834
Revert "Handle required textarea fields on saisie amdt"
ronnix Mar 11, 2020
0d0fa4d
Update tests for changed wording
ronnix Mar 12, 2020
6833978
Fix order-dependent test
ronnix Mar 12, 2020
dfbad6f
Switch to visam logo
davidbgk Mar 11, 2020
9bcce4b
Use Pyramid asset overrides to customize logo
ronnix Mar 12, 2020
725fa30
Clean html input on saisie amendement
davidbgk Mar 11, 2020
139e84d
Switch to visam favicon
davidbgk Mar 12, 2020
f98fa37
Update certificate generation configuration
davidbgk Mar 12, 2020
ace8b49
Don't serve assets with nginx as it does not know about overrides
ronnix Mar 12, 2020
a130e34
Add conseils
ronnix Mar 11, 2020
09c62f1
Refactor: extract alter_pg_enum helper
ronnix Mar 11, 2020
dfaa748
Add CSFPE chambre
ronnix Mar 11, 2020
445e3e2
Refactor: move Visam-specific config to a separate module
ronnix Mar 12, 2020
226a3b6
Refactor: move Visam include to config file
ronnix Mar 12, 2020
f34fa70
Refactor: move custom Visam app name to includeme()
ronnix Mar 12, 2020
fb11713
Add the ability to access a conseil detail page
davidbgk Mar 12, 2020
ba85e33
Refactor: move Visam-specific views to the visam package
ronnix Mar 12, 2020
0486114
Add test for home redirection override
ronnix Mar 12, 2020
6237d07
Refactor: add dedicated WSGI app and entry point for Visam
ronnix Mar 12, 2020
e3eacc4
Refactor: move custom Visam resources to a separate package
ronnix Mar 12, 2020
e0a9183
Fix app_name global template var
ronnix Mar 12, 2020
babeb4f
Add basic tests for conseils
davidbgk Mar 13, 2020
14e3d04
Redirect to configured home page after login
ronnix Mar 13, 2020
5d736c2
Refactor: move Visam-specific models to separate package
ronnix Mar 13, 2020
4041621
Refactor: move TestApp class out of conftest.py
ronnix Mar 13, 2020
c914ba1
Make contact email address configurable
ronnix Mar 13, 2020
7207fd3
Fix: tie the mailer to the app fixture's registry in tests
ronnix Mar 13, 2020
7c3a45c
Refator: rename view classes
ronnix Mar 13, 2020
f4c29e8
Setup a workflow from conseil to lecture
davidbgk Mar 13, 2020
222687b
Update default pshell variables
davidbgk Mar 13, 2020
4ca4efe
Remove a useless parameter from parse_subdiv
davidbgk Mar 13, 2020
fe7426d
Redirect to the conseil detail page upon creation
davidbgk Mar 13, 2020
a111fe2
Reword the default forbidden view message
davidbgk Mar 13, 2020
e37ed07
Add basic tests related to conseil creation
davidbgk Mar 13, 2020
5a0d109
Add tests for textes creation
davidbgk Mar 13, 2020
61dc11b
Fix support of CSFPE
ronnix Mar 16, 2020
0660ab1
User can add more than one texte to a conseil
ronnix Mar 16, 2020
db7914f
Add rich text editor for texte contents
ronnix Mar 16, 2020
87219a1
Better handling of permissions to add conseil/texte
davidbgk Mar 16, 2020
454a8c6
Allow texte and conseil creations for all users
davidbgk Mar 16, 2020
2dfc979
Fix display of button to add a new amendement for CSFPE
ronnix Mar 17, 2020
a9783cf
Add basic extraction of articles
ronnix Mar 17, 2020
964a0c5
Display conseils in visam menus (no more dossiers)
davidbgk Mar 17, 2020
d400802
Fix type declarations
ronnix Mar 18, 2020
1488845
Add some useful pshell variables
ronnix Mar 18, 2020
5c5928e
Refactor: move Visam-specific templates to the visam package
ronnix Mar 18, 2020
a97d0cc
Refactor: merge related test modules
ronnix Mar 18, 2020
d735574
Don't try to reuse a Lecture when adding a Texte to a Conseil
ronnix Mar 18, 2020
6cfe5f3
Improve resilience of conseils creation
davidbgk Mar 18, 2020
4bb83fb
Avoid creating the same texte+lecture twice
davidbgk Mar 18, 2020
84a918a
Simplify formatting
ronnix Mar 19, 2020
6de2e72
Update texte creation behaviours
ronnix Mar 19, 2020
0b3b8d9
Do not attempt to create missing lectures for visam
davidbgk Mar 19, 2020
66d580f
Show article contents in amendement input form
ronnix Mar 18, 2020
813ba61
Add tests for article selection on saisie amendement
davidbgk Mar 18, 2020
104f84a
Ability to reorder textes for a conseil (front side)
davidbgk Mar 18, 2020
d015d05
Ability to reorder textes for a conseil (back side)
davidbgk Mar 20, 2020
ab12557
Better styles for drag&drop affordance
davidbgk Mar 23, 2020
d27a2bb
Move texte position in conseil to the association table
ronnix Mar 23, 2020
2aae9ec
Deal with reordering of amendements for a lecture
davidbgk Mar 23, 2020
0c5be14
Ability to filter by the beginning of amdt numbers
davidbgk Mar 23, 2020
6b1ad7f
Move lecture resources under /conseils/ in Visam
ronnix Mar 24, 2020
2d3c3b8
Fix filtering integration tests to work with dropzones
ronnix Mar 30, 2020
eed78da
Reorganize views
ronnix Mar 30, 2020
834e55b
Move AmendementSaisi event to Visam models
ronnix Mar 30, 2020
639fb57
Add a User Chambre membership at model level
davidbgk Apr 7, 2020
3536aa0
Dealing with chambre membership restricted views
davidbgk Apr 7, 2020
a3d6699
Deal with admins for chambre restricted views
davidbgk Apr 8, 2020
cb5041b
Restrict seance creation to admins
davidbgk Apr 8, 2020
082c7e3
Set a dedicated auth policy for visam
davidbgk Apr 8, 2020
80588e4
Add views to manage members in conseils
davidbgk Apr 8, 2020
2ed5760
Rename membership events
ronnix Apr 9, 2020
981a67a
Move query filtering to ConseilCollection.models()
ronnix Apr 9, 2020
5596fed
Refactor: rename conseils.id to conseils.pk for consistency
ronnix Apr 14, 2020
0385fd5
Refactor: rename test file
ronnix Mar 30, 2020
51a2b10
Refactor: move logic from template to view function
ronnix Mar 30, 2020
5b57765
Refactor: remove conseil property from Lecture
ronnix Apr 14, 2020
de533bc
Refactor: rename "conseil" to "séance"
ronnix Apr 14, 2020
4277ad2
Ability to put a user into an organisation
davidbgk Apr 20, 2020
3e649ec
Refactor: add User.membership_of()
ronnix Apr 21, 2020
c53a60f
Refactor: make login explicit in Visam integration tests
ronnix Apr 21, 2020
cb70d19
Group of submitted amendement is the user's organisation for this con…
ronnix Apr 21, 2020
c6db993
Admin users can select organisation when adding amendements
ronnix Apr 21, 2020
dd75c5f
Refactor: extract methods
ronnix Apr 21, 2020
d1fcd89
Add special auteur value for amendements from gouvernement
ronnix Apr 21, 2020
4747724
Refactor: add constant for magic auteur value
ronnix Apr 21, 2020
fbaa639
Add debug representations for UserMembership and Organisation
ronnix Apr 21, 2020
2ac1f2a
Explicitly select the Gouvernement option by default
davidbgk Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions admin/files/nginx/https.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ server {
add_header "Pragma" "no-cache";
}

location /repondeur/static/ {
alias /srv/repondeur/src/repondeur/zam_repondeur/static/;
expires 30d;
add_header "Cache-Control" "public";
}

location /_stats/ {
alias /var/cache/munin/www/;
add_header "Cache-Control" "no-store";
Expand Down
2 changes: 1 addition & 1 deletion admin/tasks/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def setup_self_signed_cert(ctx):
" -days 365"
" -sha256"
" -nodes"
f" -subj '/C=FR/OU=Zam/CN={hostname}'"
f" -subj '/C=FR/OU=Visam/CN={hostname}'"
)


Expand Down
3 changes: 3 additions & 0 deletions repondeur/db_migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from alembic import context
from sqlalchemy import engine_from_config, pool

# Make sure all models are loaded
import zam_repondeur.models # noqa
import zam_repondeur.visam.models # noqa
from zam_repondeur.models import Base

# this is the Alembic Config object, which provides
Expand Down
27 changes: 27 additions & 0 deletions repondeur/db_migrations/versions/08e2b571d519_add_conseils_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Add conseils team

Revision ID: 08e2b571d519
Revises: fe0f5eb2cc56
Create Date: 2020-03-13 11:51:03.175180

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "08e2b571d519"
down_revision = "fe0f5eb2cc56"
branch_labels = None
depends_on = None


def upgrade():
op.add_column("conseils", sa.Column("team_pk", sa.Integer(), nullable=False))
op.create_foreign_key(
op.f("conseils_team_pk_fkey"), "conseils", "teams", ["team_pk"], ["pk"]
)


def downgrade():
op.drop_constraint(op.f("conseils_team_pk_fkey"), "conseils", type_="foreignkey")
op.drop_column("conseils", "team_pk")
77 changes: 77 additions & 0 deletions repondeur/db_migrations/versions/243d9fa3359c_user_organisation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""User organisation

Revision ID: 243d9fa3359c
Revises: b09413ecb1a1
Create Date: 2020-04-20 11:03:06.851174

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "243d9fa3359c"
down_revision = "b09413ecb1a1"
branch_labels = None
depends_on = None


def upgrade():
op.drop_column("users_chambres", "organisation")

organisation_table = op.create_table(
"organisations",
sa.Column("pk", sa.Integer(), nullable=False),
sa.Column("name", sa.Text(), nullable=False),
sa.PrimaryKeyConstraint("pk"),
sa.UniqueConstraint("name", name=op.f("organisations_name_key")),
)

# Fill up the table.
op.bulk_insert(
organisation_table,
[
{"name": "Gouvernement"},
{"name": "Employeurs territoriaux"},
{"name": "CFE-CGC"},
{"name": "CFTC"},
{"name": "CGT"},
{"name": "FA-FP"},
{"name": "FSU"},
{"name": "UNSA"},
],
)

# Set default organisation to `Gouvernement` for existing users memberships.
op.add_column(
"users_chambres", sa.Column("organisation_pk", sa.Integer(), nullable=True),
)
op.execute(
"""
UPDATE users_chambres SET organisation_pk=(
SELECT pk FROM organisations WHERE name='Gouvernement'
)
"""
)
op.alter_column("users_chambres", "organisation_pk", nullable=False)

op.create_foreign_key(
op.f("users_chambres_organisation_pk_fkey"),
"users_chambres",
"organisations",
["organisation_pk"],
["pk"],
)


def downgrade():
op.drop_constraint(
op.f("users_chambres_organisation_pk_fkey"),
"users_chambres",
type_="foreignkey",
)
op.drop_column("users_chambres", "organisation_pk")
op.drop_table("organisations")
op.add_column(
"users_chambres",
sa.Column("organisation", sa.INTEGER(), autoincrement=False, nullable=True),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Add chambre constraint

Revision ID: 245e371cbf82
Revises: 95dfdcde1955
Create Date: 2020-03-11 17:52:02.715512

"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "245e371cbf82"
down_revision = "95dfdcde1955"
branch_labels = None
depends_on = None


def upgrade():
op.create_check_constraint(
op.f("ck_conseils_chambre"), "conseils", "chambre NOT IN ('AN', 'SENAT')",
)


def downgrade():
op.drop_constraint(op.f("ck_conseils_chambre"), "conseils")
27 changes: 27 additions & 0 deletions repondeur/db_migrations/versions/3fe97532ba21_add_ccfp_chambre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Add CCFP chambre

Revision ID: 3fe97532ba21
Revises: f2882be74177
Create Date: 2020-02-27 14:25:49.524626

"""
from alembic import op

from zam_repondeur.models._helpers import alter_pg_enum

# revision identifiers, used by Alembic.
revision = "3fe97532ba21"
down_revision = "f2882be74177"
branch_labels = None
depends_on = None


COLUMNS_TO_CONVERT = [("lectures", "chambre"), ("textes", "chambre")]


def upgrade():
alter_pg_enum(op, "chambre", ["AN", "SENAT", "CCFP"], COLUMNS_TO_CONVERT)


def downgrade():
alter_pg_enum(op, "chambre", ["AN", "SENAT"], COLUMNS_TO_CONVERT)
43 changes: 43 additions & 0 deletions repondeur/db_migrations/versions/95dfdcde1955_add_conseils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Add conseils

Revision ID: 95dfdcde1955
Revises: 3fe97532ba21
Create Date: 2020-03-11 15:56:00.842219

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.postgresql import ENUM

# revision identifiers, used by Alembic.
revision = "95dfdcde1955"
down_revision = "3fe97532ba21"
branch_labels = None
depends_on = None


formation_type = ENUM(
"ASSEMBLEE_PLENIERE", "FORMATION_SPECIALISEE", name="formation", create_type=False
)


def upgrade():
formation_type.create(op.get_bind(), checkfirst=False)
op.create_table(
"conseils",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column(
"chambre",
ENUM("AN", "SENAT", "CCFP", name="chambre", create_type=False),
nullable=False,
),
sa.Column("date", sa.Date(), nullable=False),
sa.Column("formation", formation_type, nullable=False,),
sa.Column("urgence_declaree", sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)


def downgrade():
op.drop_table("conseils")
formation_type.drop(op.get_bind(), checkfirst=False)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Rename conseils to seances

Revision ID: b09413ecb1a1
Revises: e39d4c9a9459
Create Date: 2020-04-14 10:02:40.581873

"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "b09413ecb1a1"
down_revision = "e39d4c9a9459"
branch_labels = None
depends_on = None


def upgrade():
op.drop_constraint(
"conseils_lectures_conseil_pk_fkey", "conseils_lectures", type_="foreignkey"
)
op.rename_table(old_table_name="conseils", new_table_name="seances")
op.rename_table(
old_table_name="conseils_lectures", new_table_name="seances_lectures"
)
op.alter_column("seances_lectures", "conseil_pk", new_column_name="seance_pk")
op.create_foreign_key(
op.f("seances_lectures_seance_pk_fkey"),
"seances_lectures",
"seances",
["seance_pk"],
["pk"],
onupdate="CASCADE",
ondelete="CASCADE",
)


def downgrade():
op.drop_constraint(
"seances_lectures_seance_pk_fkey", "seances_lectures", type_="foreignkey"
)
op.rename_table(old_table_name="seances", new_table_name="conseils")
op.rename_table(
old_table_name="seances_lectures", new_table_name="conseils_lectures"
)
op.alter_column("conseils_lectures", "seance_pk", new_column_name="conseil_pk")
op.create_foreign_key(
op.f("conseils_lectures_conseil_pk_fkey"),
"conseils_lectures",
"conseils",
["conseil_pk"],
["pk"],
onupdate="CASCADE",
ondelete="CASCADE",
)
46 changes: 46 additions & 0 deletions repondeur/db_migrations/versions/caaa6d0c7254_add_csfpe_chambre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Add CSFPE chambre

Revision ID: caaa6d0c7254
Revises: 245e371cbf82
Create Date: 2020-03-11 17:19:11.567332

"""
from contextlib import contextmanager

from alembic import op

from zam_repondeur.models._helpers import alter_pg_enum

# revision identifiers, used by Alembic.
revision = "caaa6d0c7254"
down_revision = "245e371cbf82"
branch_labels = None
depends_on = None


COLUMNS_TO_CONVERT = [
("lectures", "chambre"),
("textes", "chambre"),
("conseils", "chambre"),
]


def upgrade():
with release_check_constraint():
alter_pg_enum(
op, "chambre", ["AN", "SENAT", "CCFP", "CSFPE"], COLUMNS_TO_CONVERT
)


def downgrade():
with release_check_constraint():
alter_pg_enum(op, "chambre", ["AN", "SENAT", "CCFP"], COLUMNS_TO_CONVERT)


@contextmanager
def release_check_constraint():
op.drop_constraint(op.f("ck_conseils_chambre"), "conseils")
yield
op.create_check_constraint(
op.f("ck_conseils_chambre"), "conseils", "chambre NOT IN ('AN', 'SENAT')",
)
54 changes: 54 additions & 0 deletions repondeur/db_migrations/versions/e39d4c9a9459_rename_id_to_pk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Rename id to pk

Revision ID: e39d4c9a9459
Revises: fb1d734cc205
Create Date: 2020-04-14 08:44:22.021370

"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "e39d4c9a9459"
down_revision = "fb1d734cc205"
branch_labels = None
depends_on = None


def upgrade():
# Rename conseils.id
op.alter_column("conseils", "id", new_column_name="pk")

# Rename conseils_lectures.conseil_id
op.drop_constraint(
"conseils_lectures_conseil_id_fkey", "conseils_lectures", type_="foreignkey"
)
op.alter_column("conseils_lectures", "conseil_id", new_column_name="conseil_pk")
op.create_foreign_key(
op.f("conseils_lectures_conseil_pk_fkey"),
"conseils_lectures",
"conseils",
["conseil_pk"],
["pk"],
onupdate="CASCADE",
ondelete="CASCADE",
)


def downgrade():
# Rename conseils_lectures.conseil_ipk
op.drop_constraint(
"conseils_lectures_conseil_pk_fkey", "conseils_lectures", type_="foreignkey"
)
op.alter_column("conseils_lectures", "conseil_pk", new_column_name="conseil_id")
op.create_foreign_key(
op.f("conseils_lectures_conseil_id_fkey"),
"conseils_lectures",
"conseils",
["conseil_id"],
["pk"],
onupdate="CASCADE",
ondelete="CASCADE",
)

# Rename conseils.pk
op.alter_column("conseils", "pk", new_column_name="id")
Loading