Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit e2e4ba39 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Improve rendering of Assemblée "dossiers" in home page.

parent 014d955d
......@@ -268,113 +268,13 @@ export function shortNameFromOrgane(organe) {
function statusFromActes(dossier, actes) {
for (let acte of [...actes].reverse()) {
if (acte.actesLegislatifs) {
let status = statusFromActes(dossier, acte.actesLegislatifs)
if (status !== null) {
return status
}
} else {
let libelle = null
switch (acte.__typename) {
case "AdoptionEurope":
libelle = acte.statutAdoption.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "ConclusionEtapeCc":
libelle = acte.statutConclusion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "Decision":
libelle = acte.statutConclusion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess:
// Not sure for other cases => To improve.
dossier.procedureParlementaire.code === "2" // Proposition de loi ordinaire
&& ["rejeté", "rejetée"].includes(libelle)
&& dossier.actesLegislatifs.length === 1
? false
: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DecisionMotionCensure":
libelle = acte.decision.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess:
// Not sure for other cases => To improve.
dossier.procedureParlementaire.code === "13" // Engagement de la responsabilité gouvernementale
&& libelle === "Motion rejeté(e)"
? false
: true, // TODO: Not sure of this `true` value
label: uncapitalizeFirstLetter(libelle),
}
case "DecisionRecevabiliteBureau":
libelle = acte.decision.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DeclarationGouvernement":
libelle = acte.typeDeclaration.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DepotMotionCensure":
libelle = acte.typeMotionCensure.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DepotRapport":
if (["DossierCommissionEnquete", "DossierMissionControle", "DossierMissionInformation"].includes(dossier.__typename)) {
return {
color: "blue",
finalSuccess: true,
label: "rapport déposé",
}
}
break
case "MotionProcedure":
libelle = acte.typeMotion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "Promulgation":
return {
color: "green",
finalSuccess: true,
label: "promulgué",
}
case "RetraitInitiative":
return {
color: "red",
finalSuccess: false,
label: "retiré",
}
case "SaisineConseilConstit":
libelle = acte.casSaisine.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
default:
// This acte gives no status => continue to previous acte.
}
const status = acte.actesLegislatifs
? statusFromActes(dossier, acte.actesLegislatifs)
: statusFromLeafActe(dossier, acte)
if (status !== null) {
return status
}
// No status found, continue with previous acte.
}
return null
}
......@@ -390,28 +290,137 @@ export function statusFromDossier(dossier) {
}
}
function summaryStepsFromActe(dossier, acte, summarySteps) {
export function statusFromLeafActe(dossier, acte) {
let libelle = null
switch (acte.__typename) {
case "AdoptionEurope":
libelle = acte.statutAdoption.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "ConclusionEtapeCc":
libelle = acte.statutConclusion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "Decision":
libelle = acte.statutConclusion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess:
// Not sure for other cases => To improve.
dossier.procedureParlementaire.code === "2" // Proposition de loi ordinaire
&& ["rejeté", "rejetée"].includes(libelle)
&& dossier.actesLegislatifs.length === 1
? false
: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DecisionMotionCensure":
libelle = acte.decision.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess:
// Not sure for other cases => To improve.
dossier.procedureParlementaire.code === "13" // Engagement de la responsabilité gouvernementale
&& libelle === "Motion rejeté(e)"
? false
: true, // TODO: Not sure of this `true` value
label: uncapitalizeFirstLetter(libelle),
}
case "DecisionRecevabiliteBureau":
libelle = acte.decision.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DeclarationGouvernement":
libelle = acte.typeDeclaration.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DepotMotionCensure":
libelle = acte.typeMotionCensure.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "DepotRapport":
if (
[
"DossierCommissionEnquete",
"DossierMissionControle",
"DossierMissionInformation",
].includes(dossier.__typename)
) {
return {
color: "blue",
finalSuccess: true,
label: "rapport déposé",
}
}
return null
case "MotionProcedure":
libelle = acte.typeMotion.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
case "Promulgation":
return {
color: "green",
finalSuccess: true,
label: "promulgué",
}
case "RetraitInitiative":
return {
color: "red",
finalSuccess: false,
label: "retiré",
}
case "SaisineConseilConstit":
libelle = acte.casSaisine.libelle
return {
color: colorFromCodierLibelle(libelle),
finalSuccess: null,
label: uncapitalizeFirstLetter(libelle),
}
default:
// This acte gives no status.
return null
}
}
export function summaryStepFromRootActe(dossier, acte) {
let organeCodeType = acte.organe.codeType
let organeName = shortNameFromOrgane(acte.organe)
let title = acte.libelleActe.libelleCourt
if (title !== null && title.toLowerCase() === organeName.toLowerCase()) {
title = null
}
const summaryStep = {
return {
color: colorFromOrganeCodeType(organeCodeType),
organeName,
status: statusFromActes(dossier, acte.actesLegislatifs),
title,
}
summarySteps.push(summaryStep)
}
export function summaryStepsFromDossier(dossier) {
const summarySteps = []
for (let acte of dossier.actesLegislatifs) {
summaryStepsFromActe(dossier, acte, summarySteps)
}
return summarySteps
return dossier.actesLegislatifs.map(acte => {
return {
...summaryStepFromRootActe(dossier, acte),
status: statusFromActes(dossier, acte.actesLegislatifs),
}
})
}
export function textFromTypeRapporteur(typeRapporteur) {
......
......@@ -3,9 +3,13 @@ import { generateDossierParlementaireFragments } from "../graphql/assemblee"
import { assembleeGraphqlClient, senatGraphqlClient, textFromFragments } from "../graphql/clients"
import { generateLoiFragments } from "../graphql/senat"
import {
nextActePath,
nextDate,
previousActePath,
previousDate,
statusFromDossier,
statusFromLeafActe,
summaryStepFromRootActe,
summaryStepsFromDossier,
unflattenDossierParlementaire,
} from "./assemblee/helpers"
......@@ -134,6 +138,7 @@ export function newGraphqlAgent() {
}
export function newViewAgent() {
const nowText = new Date().toISOString()
return new ViewAgent(
newGraphqlAgent(),
"data/views/dossiers_actuels.json",
......@@ -144,19 +149,49 @@ export function newViewAgent() {
viewData.dossiersAssembleeAVenir
.map(dossier => dossier.uid)
)
viewData.dossiersAssembleeActuels = [
const dossiersAssembleeActuels = [
...viewData.dossiersAssembleeRecents.filter(dossier => !dossiersUids.has(dossier.uid)),
...viewData.dossiersAssembleeAVenir,
]
delete viewData.dossiersAssembleeAVenir
delete viewData.dossiersAssembleeRecents
viewData.dossiersAssembleeActuels = viewData.dossiersAssembleeActuels
viewData.dossiersAssembleeActuels = dossiersAssembleeActuels
.map(dossier => {
dossier = { ...dossier }
dossier.currentDateKnitted = dossier.nextDateKnitted || dossier.previousDateKnitted || null
{
const actePath = nextActePath(dossier, nowText)
if (actePath === null) {
dossier.nextSummaryStepKnitted = null
} else {
const leafActe = actePath[actePath.length - 1]
dossier.nextSummaryStepKnitted = {
...summaryStepFromRootActe(dossier, actePath[0]),
date: leafActe.dateActe,
libelle: leafActe.libelleActe.libelleCourt || leafActe.libelleActe.nomCanonique,
status: statusFromLeafActe(dossier, leafActe)
}
}
}
{
const actePath = previousActePath(dossier, nowText)
if (actePath === null) {
dossier.previousSummaryStepKnitted = null
} else {
const leafActe = actePath[actePath.length - 1]
dossier.previousSummaryStepKnitted = {
...summaryStepFromRootActe(dossier, actePath[0]),
date: leafActe.dateActe,
libelle: leafActe.libelleActe.libelleCourt || leafActe.libelleActe.nomCanonique,
status: statusFromLeafActe(dossier, leafActe)
}
}
}
dossier.statusKnitted = statusFromDossier(dossier)
dossier.summaryStepsKnitted = summaryStepsFromDossier(dossier)
delete dossier.actesLegislatifs
return dossier
})
......
......@@ -14,11 +14,11 @@
<div
class="bg-{
summaryStep.status === null || summaryStep.status.finalSuccess === null
? "grey-dark"
? summaryStep.color
: summaryStep.status.color
} flex flex-col flex-none mr-1 p-1 text-center text-white"
>
<div class="text-grey-lightest text-xs">Étape</div>
<!-- <div class="text-grey-lightest text-xs">Échellon</div> -->
<div class="flex flex-auto flex-col justify-center">
<span class="inline-block text-3xl">
{dossier.summaryStepsKnitted.length}
......@@ -35,14 +35,14 @@
{/each}
<div class="flex-auto">
{dossier.titreDossier.titre}
<div class="mt-1 text-grey-darker text-xs">
<div class="my-1 text-grey-darker text-sm">
<span>{dossier.procedureParlementaire.libelle}</span>
<!-- <span class="bg-{dossier.statusKnitted.color} px-1 rounded text-white">{dossier.statusKnitted.label}</span> -->
<!-- —
Étape {dossier.summaryStepsKnitted.length} -->
<!-- — -->
<!-- TODO: Remove this dummy `each`. -->
{#each [dossier.summaryStepsKnitted[dossier.summaryStepsKnitted.length - 1]] as summaryStep}
<!-- {#each [dossier.summaryStepsKnitted[dossier.summaryStepsKnitted.length - 1]] as summaryStep}
<span class="bg-{summaryStep.color} my-1 p-1 text-white">
{summaryStep.organeName}{
#if summaryStep.title !== null}
......@@ -53,18 +53,48 @@
{#if summaryStep.status !== null && summaryStep.status.label !== null}
<span class="bg-{summaryStep.status.color} p-1 rounded text-base text-white">{summaryStep.status.label}</span>
{/if}
{/each}
</div>
<div>
<ActePath actePath={previousActePath(dossier, nowText)} title="Dernière étape"/>
</div>
<div>
<ActePath actePath={nextActePath(dossier, nowText)} title="Prochaine étape"/>
{/each} -->
</div>
{#if dossier.previousSummaryStepKnitted !== null}
<!-- TODO: Remove this dummy `each`. -->
{#each [dossier.previousSummaryStepKnitted] as summaryStep}
<div class="my-1 text-sm">
<span class="italic text-grey-darker">Dernière étape {displayDateFromString(summaryStep.date)} :</span>
<span>
{summaryStep.organeName}{
#if summaryStep.title !== null
}, {summaryStep.title}{
/if
}, {summaryStep.libelle
}</span>
{#if summaryStep.status !== null && summaryStep.status.label !== null}
<span class="bg-{summaryStep.status.color} px-1 rounded text-white">{summaryStep.status.label}</span>
{/if}
</div>
{/each}
{/if}
{#if dossier.nextSummaryStepKnitted !== null}
<!-- TODO: Remove this dummy `each`. -->
{#each [dossier.nextSummaryStepKnitted] as summaryStep}
<div class="my-1 text-sm">
<span class="italic text-grey-darker">Prochaine étape {displayDateFromString(summaryStep.date)} :</span>
<span>
{summaryStep.organeName}{
#if summaryStep.title !== null
}, {summaryStep.title}{
/if
}, {summaryStep.libelle
}</span>
{#if summaryStep.status !== null && summaryStep.status.label !== null}
<span class="bg-{summaryStep.status.color} px-1 rounded text-white">{summaryStep.status.label}</span>
{/if}
</div>
{/each}
{/if}
</div>
{#if dossier.currentDateKnitted !== null}
<!-- {#if dossier.currentDateKnitted !== null}
<CalendarDate date={parseDate(dossier.currentDateKnitted)} {now}/>
{/if}
{/if} -->
</a>
</li>
{/each}
......@@ -154,31 +184,21 @@
</aside>
<script>
import parseDate from "date-fns/parse"
import config from "../config"
import { nextActePath, previousActePath } from "../model/assemblee/helpers"
import { displayDateFromString } from "../dates"
import { newViewAgent } from "../model/dossiers_actuels"
import { colorFromEtaloilib } from "../model/senat/helpers"
export default {
components: {
ActePath: "../components/ActePath.html",
CalendarDate: "../components/CalendarDate.html",
},
data() {
return {
legislature: 15,
now: new Date(),
nowText: new Date().toISOString(),
}
},
helpers: {
colorFromEtaloilib,
displayDateFromString,
config,
nextActePath,
parseDate,
previousActePath,
},
oncreate() {
// This fires when the component has been rendered to the DOM.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment