diff --git a/Gemfile b/Gemfile
index 3a224b34a..20ddf1137 100644
--- a/Gemfile
+++ b/Gemfile
@@ -76,7 +76,7 @@ gem 'zipline'
gem 'zxcvbn-ruby', require: 'zxcvbn'
group :test do
- gem 'capybara', '3.13.2' # Integration testing
+ gem 'capybara' # Integration testing
gem 'capybara-email' # Access emails during integration tests
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
gem 'capybara-selenium'
diff --git a/Gemfile.lock b/Gemfile.lock
index 9efd53568..b516e9f39 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -119,13 +119,13 @@ GEM
browser (2.5.3)
builder (3.2.3)
byebug (10.0.2)
- capybara (3.13.2)
+ capybara (3.29.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
- regexp_parser (~> 1.2)
+ regexp_parser (~> 1.5)
xpath (~> 3.2)
capybara-email (3.0.1)
capybara (>= 2.4, < 4.0)
@@ -719,7 +719,7 @@ DEPENDENCIES
brakeman
browser
byebug
- capybara (= 3.13.2)
+ capybara
capybara-email
capybara-screenshot
capybara-selenium
diff --git a/app/assets/images/marianne.svg b/app/assets/images/marianne.svg
index 586b104f7..8ed835709 100644
--- a/app/assets/images/marianne.svg
+++ b/app/assets/images/marianne.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/assets/stylesheets/new_design/new_header.scss b/app/assets/stylesheets/new_design/new_header.scss
index e22cffc73..5dd761b73 100644
--- a/app/assets/stylesheets/new_design/new_header.scss
+++ b/app/assets/stylesheets/new_design/new_header.scss
@@ -23,29 +23,28 @@ $header-mobile-breakpoint: 550px;
}
.header-logo {
- display: inline-block;
- height: 100%;
- background-size: contain;
- background-position: center;
- background-repeat: no-repeat;
+ display: flex;
+ flex-wrap: wrap;
- // Logo large
- background-image: image-url("header/logo-ds-wide.svg");
- width: 360px;
- margin-right: 4 * $default-spacer;
-
- // Logo normal
- @media (max-width: $header-landing-breakpoint) {
- background-image: image-url("header/logo-ds.svg");
- width: 132px;
- margin-right: $default-spacer;
+ img {
+ margin-right: 10px;
}
- // Logo narrow
- @media (max-width: $header-mobile-breakpoint) {
- background-image: image-url("header/logo-ds-narrow.svg");
- width: 32px;
- margin-right: 0;
+ .site-title {
+ font-size: 24px;
+ font-weight: bold;
+
+ &.small {
+ @media (min-width: $header-mobile-breakpoint) {
+ display: none;
+ }
+ }
+
+ &.big {
+ @media (max-width: $header-mobile-breakpoint) {
+ display: none;
+ }
+ }
}
}
diff --git a/app/assets/stylesheets/new_design/spinner.scss b/app/assets/stylesheets/new_design/spinner.scss
index fba2cee82..2c1a3c460 100644
--- a/app/assets/stylesheets/new_design/spinner.scss
+++ b/app/assets/stylesheets/new_design/spinner.scss
@@ -9,13 +9,19 @@
text-indent: -9999em;
animation: load4 1.3s infinite linear;
transform: translateZ(0);
-}
-.right-spinner {
- position: absolute;
- top: 3.7em;
- right: 1.2em;
- transform: scale(0.3);
+ &.right {
+ position: absolute;
+ top: 3.7em;
+ right: 1.2em;
+ transform: scale(0.3);
+ }
+
+ &.left {
+ top: 1.2em;
+ left: 1.2em;
+ transform: scale(0.4);
+ }
}
@keyframes load4 {
diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb
index 91bdb5cd5..346f16ea7 100644
--- a/app/controllers/admin/procedures_controller.rb
+++ b/app/controllers/admin/procedures_controller.rb
@@ -19,7 +19,7 @@ class Admin::ProceduresController < AdminController
def archived
@procedures = smart_listing_create :procedures,
- current_administrateur.procedures.archivees.order(published_at: :desc),
+ current_administrateur.procedures.closes.order(published_at: :desc),
partial: "admin/procedures/list",
array: true
@@ -52,7 +52,7 @@ class Admin::ProceduresController < AdminController
def destroy
procedure = current_administrateur.procedures.find(params[:id])
- if procedure.publiee_ou_archivee?
+ if procedure.publiee_ou_close?
return render json: {}, status: 401
end
@@ -95,9 +95,9 @@ class Admin::ProceduresController < AdminController
def archive
procedure = current_administrateur.procedures.find(params[:procedure_id])
- procedure.archive!
+ procedure.close!
- flash.notice = "Démarche archivée"
+ flash.notice = "Démarche close"
redirect_to admin_procedures_path
rescue ActiveRecord::RecordNotFound
@@ -131,7 +131,7 @@ class Admin::ProceduresController < AdminController
def new_from_existing
significant_procedure_ids = Procedure
- .publiees_ou_archivees
+ .publiees_ou_closes
.joins(:dossiers)
.group("procedures.id")
.having("count(dossiers.id) >= ?", SIGNIFICANT_DOSSIERS_THRESHOLD)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 527bf34c7..e5cba17b3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -285,7 +285,7 @@ class ApplicationController < ActionController::Base
DS_ID: current_administrateur&.id,
DS_NB_DEMARCHES_BROUILLONS: nb_demarches_by_state['brouillon'],
DS_NB_DEMARCHES_ACTIVES: nb_demarches_by_state['publiee'],
- DS_NB_DEMARCHES_ARCHIVES: nb_demarches_by_state['archivee']
+ DS_NB_DEMARCHES_ARCHIVES: nb_demarches_by_state['close']
}
}
end
diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb
index 185cb540d..26e083e98 100644
--- a/app/controllers/instructeurs/procedures_controller.rb
+++ b/app/controllers/instructeurs/procedures_controller.rb
@@ -10,7 +10,7 @@ module Instructeurs
.procedures
.with_attached_logo
.includes(:defaut_groupe_instructeur)
- .order(archived_at: :desc, published_at: :desc, created_at: :desc)
+ .order(closed_at: :desc, archived_at: :desc, published_at: :desc, created_at: :desc)
dossiers = current_instructeur.dossiers.joins(:groupe_instructeur)
@dossiers_count_per_procedure = dossiers.all_state.group('groupe_instructeurs.procedure_id').reorder(nil).count
diff --git a/app/controllers/manager/procedures_controller.rb b/app/controllers/manager/procedures_controller.rb
index 846e103de..4bc2dee8b 100644
--- a/app/controllers/manager/procedures_controller.rb
+++ b/app/controllers/manager/procedures_controller.rb
@@ -22,16 +22,6 @@ module Manager
redirect_to manager_procedure_path(procedure)
end
- def draft
- if procedure.dossiers.empty?
- procedure.draft!
- flash[:notice] = "La démarche a bien été passée en brouillon."
- else
- flash[:alert] = "Impossible de repasser en brouillon une démarche à laquelle sont rattachés des dossiers."
- end
- redirect_to manager_procedure_path(procedure)
- end
-
def hide
procedure.hide!
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."
diff --git a/app/controllers/new_administrateur/groupe_instructeurs_controller.rb b/app/controllers/new_administrateur/groupe_instructeurs_controller.rb
index 06cdf829c..620623ac5 100644
--- a/app/controllers/new_administrateur/groupe_instructeurs_controller.rb
+++ b/app/controllers/new_administrateur/groupe_instructeurs_controller.rb
@@ -49,7 +49,8 @@ module NewAdministrateur
end
def add_instructeur
- emails = params['emails'].map(&:strip).map(&:downcase)
+ emails = params['emails'].presence || []
+ emails = emails.map(&:strip).map(&:downcase)
correct_emails, bad_emails = emails
.partition { |email| URI::MailTo::EMAIL_REGEXP.match?(email) }
diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb
index 5d23ead64..fea994a0a 100644
--- a/app/controllers/stats_controller.rb
+++ b/app/controllers/stats_controller.rb
@@ -4,7 +4,7 @@ class StatsController < ApplicationController
MEAN_NUMBER_OF_CHAMPS_IN_A_FORM = 24.0
def index
- procedures = Procedure.publiees_ou_archivees
+ procedures = Procedure.publiees_ou_closes
dossiers = Dossier.state_not_brouillon
@procedures_numbers = procedures_numbers(procedures)
diff --git a/app/controllers/users/commencer_controller.rb b/app/controllers/users/commencer_controller.rb
index 841acd58a..a6d4ea649 100644
--- a/app/controllers/users/commencer_controller.rb
+++ b/app/controllers/users/commencer_controller.rb
@@ -53,7 +53,7 @@ module Users
def procedure_not_found
procedure = Procedure.find_by(path: params[:path])
- if procedure&.archivee?
+ if procedure&.close?
flash.alert = t('errors.messages.procedure_archived')
else
flash.alert = t('errors.messages.procedure_not_found')
diff --git a/app/dashboards/administrateur_dashboard.rb b/app/dashboards/administrateur_dashboard.rb
index 5afb5004a..48fd715dd 100644
--- a/app/dashboards/administrateur_dashboard.rb
+++ b/app/dashboards/administrateur_dashboard.rb
@@ -15,7 +15,8 @@ class AdministrateurDashboard < Administrate::BaseDashboard
procedures: Field::HasMany.with_options(limit: 20),
registration_state: Field::String.with_options(searchable: false),
current_sign_in_at: Field::DateTime,
- features: FeaturesField
+ features: FeaturesField,
+ email: Field::Email
}.freeze
# COLLECTION_ATTRIBUTES
@@ -46,7 +47,9 @@ class AdministrateurDashboard < Administrate::BaseDashboard
# FORM_ATTRIBUTES
# an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages.
- FORM_ATTRIBUTES = [].freeze
+ FORM_ATTRIBUTES = [
+ :email
+ ].freeze
# Overwrite this method to customize how procedures are displayed
# across all pages of the admin dashboard.
diff --git a/app/dashboards/procedure_dashboard.rb b/app/dashboards/procedure_dashboard.rb
index 97967bc00..a21b26b7a 100644
--- a/app/dashboards/procedure_dashboard.rb
+++ b/app/dashboards/procedure_dashboard.rb
@@ -26,7 +26,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
auto_archive_on: Field::DateTime,
published_at: Field::DateTime,
hidden_at: Field::DateTime,
- archived_at: Field::DateTime,
+ closed_at: Field::DateTime,
whitelisted_at: Field::DateTime,
service: Field::BelongsTo,
initiated_mail_template: MailTemplateField,
@@ -68,7 +68,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:published_at,
:whitelisted_at,
:hidden_at,
- :archived_at,
+ :closed_at,
:types_de_champ,
:types_de_champ_private,
:for_individual,
diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql
index 318d46fe3..100e53bd8 100644
--- a/app/graphql/schema.graphql
+++ b/app/graphql/schema.graphql
@@ -1,10 +1,12 @@
type Avis {
- answer: String
attachmentUrl: URL
- createdAt: ISO8601DateTime!
- email: String!
+ dateQuestion: ISO8601DateTime!
+ dateReponse: ISO8601DateTime
+ expert: Profile
id: ID!
+ instructeur: Profile!
question: String!
+ reponse: String
}
type CarteChamp implements Champ {
@@ -160,12 +162,30 @@ Une demarche
"""
type Demarche {
annotationDescriptors: [ChampDescriptor!]!
- archivedAt: ISO8601DateTime
champDescriptors: [ChampDescriptor!]!
- createdAt: ISO8601DateTime!
"""
- Déscription de la démarche.
+ Date de la création.
+ """
+ dateCreation: ISO8601DateTime!
+
+ """
+ Date de la dernière modification.
+ """
+ dateDerniereModification: ISO8601DateTime!
+
+ """
+ Date de la fermeture.
+ """
+ dateFermeture: ISO8601DateTime
+
+ """
+ Date de la publication.
+ """
+ datePublication: ISO8601DateTime!
+
+ """
+ Description de la démarche.
"""
description: String!
@@ -225,21 +245,24 @@ type Demarche {
L'état de la démarche.
"""
state: DemarcheState!
+
+ """
+ Le titre de la démarche.
+ """
title: String!
- updatedAt: ISO8601DateTime!
}
enum DemarcheState {
- """
- Archivée
- """
- archivee
-
"""
Brouillon
"""
brouillon
+ """
+ Close
+ """
+ close
+
"""
Publiée
"""
@@ -280,6 +303,11 @@ type Dossier {
avis: [Avis!]!
champs: [Champ!]!
+ """
+ Date de la dernière modification.
+ """
+ dateDerniereModification: ISO8601DateTime!
+
"""
Date de dépôt.
"""
@@ -309,11 +337,6 @@ type Dossier {
L'état du dossier.
"""
state: DossierState!
-
- """
- Date de dernière mise à jour.
- """
- updatedAt: ISO8601DateTime!
usager: Profile!
}
diff --git a/app/graphql/types/avis_type.rb b/app/graphql/types/avis_type.rb
index 3e6371427..3901d37ad 100644
--- a/app/graphql/types/avis_type.rb
+++ b/app/graphql/types/avis_type.rb
@@ -1,12 +1,17 @@
module Types
class AvisType < Types::BaseObject
global_id_field :id
- field :email, String, null: false
+
field :question, String, null: false, method: :introduction
- field :answer, String, null: true
- field :created_at, GraphQL::Types::ISO8601DateTime, null: false
+ field :reponse, String, null: true, method: :answer
+ field :date_question, GraphQL::Types::ISO8601DateTime, null: false, method: :created_at
+ field :date_reponse, GraphQL::Types::ISO8601DateTime, null: true, method: :updated_at
+
field :attachment_url, Types::URL, null: true, extensions: [
{ Extensions::Attachment => { attachment: :piece_justificative_file } }
]
+
+ field :instructeur, Types::ProfileType, null: false, method: :claimant
+ field :expert, Types::ProfileType, null: true, method: :instructeur
end
end
diff --git a/app/graphql/types/demarche_type.rb b/app/graphql/types/demarche_type.rb
index 4b1ed3129..6b464370c 100644
--- a/app/graphql/types/demarche_type.rb
+++ b/app/graphql/types/demarche_type.rb
@@ -10,13 +10,14 @@ module Types
global_id_field :id
field :number, Int, "Le numero de la démarche.", null: false, method: :id
- field :title, String, null: false, method: :libelle
- field :description, String, "Déscription de la démarche.", null: false
+ field :title, String, "Le titre de la démarche.", null: false, method: :libelle
+ field :description, String, "Description de la démarche.", null: false
field :state, DemarcheState, "L'état de la démarche.", null: false
- field :created_at, GraphQL::Types::ISO8601DateTime, null: false
- field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
- field :archived_at, GraphQL::Types::ISO8601DateTime, null: true
+ field :date_creation, GraphQL::Types::ISO8601DateTime, "Date de la création.", null: false, method: :created_at
+ field :date_publication, GraphQL::Types::ISO8601DateTime, "Date de la publication.", null: false, method: :published_at
+ field :date_derniere_modification, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification.", null: false, method: :updated_at
+ field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true, method: :closed_at
field :groupe_instructeurs, [Types::GroupeInstructeurType], null: false
diff --git a/app/graphql/types/dossier_type.rb b/app/graphql/types/dossier_type.rb
index eecdc8816..fa571275b 100644
--- a/app/graphql/types/dossier_type.rb
+++ b/app/graphql/types/dossier_type.rb
@@ -11,11 +11,11 @@ module Types
global_id_field :id
field :number, Int, "Le numero du dossier.", null: false, method: :id
field :state, DossierState, "L'état du dossier.", null: false
- field :updated_at, GraphQL::Types::ISO8601DateTime, "Date de dernière mise à jour.", null: false
field :date_passage_en_construction, GraphQL::Types::ISO8601DateTime, "Date de dépôt.", null: false, method: :en_construction_at
field :date_passage_en_instruction, GraphQL::Types::ISO8601DateTime, "Date de passage en instruction.", null: true, method: :en_instruction_at
field :date_traitement, GraphQL::Types::ISO8601DateTime, "Date de traitement.", null: true, method: :processed_at
+ field :date_derniere_modification, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification.", null: false, method: :updated_at
field :archived, Boolean, null: false
diff --git a/app/helpers/dossier_helper.rb b/app/helpers/dossier_helper.rb
index bc6f7a218..e279f199b 100644
--- a/app/helpers/dossier_helper.rb
+++ b/app/helpers/dossier_helper.rb
@@ -44,7 +44,7 @@ module DossierHelper
end
def dossier_submission_is_closed?(dossier)
- dossier.brouillon? && dossier.procedure.archivee?
+ dossier.brouillon? && dossier.procedure.close?
end
def dossier_display_state(dossier, lower: false)
diff --git a/app/helpers/procedure_helper.rb b/app/helpers/procedure_helper.rb
index ba5ff74d5..135582b43 100644
--- a/app/helpers/procedure_helper.rb
+++ b/app/helpers/procedure_helper.rb
@@ -14,7 +14,7 @@ module ProcedureHelper
end
def procedure_modal_text(procedure, key)
- action = procedure.archivee? ? :reopen : :publish
+ action = procedure.close? ? :reopen : :publish
t(action, scope: [:modal, :publish, key])
end
diff --git a/app/javascript/components/Loadable.js b/app/javascript/components/Loadable.js
new file mode 100644
index 000000000..3356f628e
--- /dev/null
+++ b/app/javascript/components/Loadable.js
@@ -0,0 +1,8 @@
+import React from 'react';
+import Loadable from 'react-loadable';
+
+const loading = () =>
;
+
+export default function(loader) {
+ return Loadable({ loader, loading });
+}
diff --git a/app/javascript/components/TypesDeChampEditor/TypesDeChampEditor.js b/app/javascript/components/TypesDeChampEditor/TypesDeChampEditor.js
new file mode 100644
index 000000000..b5fdba47f
--- /dev/null
+++ b/app/javascript/components/TypesDeChampEditor/TypesDeChampEditor.js
@@ -0,0 +1,62 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import { library } from '@fortawesome/fontawesome-svg-core';
+import {
+ faArrowCircleDown,
+ faArrowDown,
+ faArrowsAltV,
+ faArrowUp,
+ faPlus,
+ faTrash
+} from '@fortawesome/free-solid-svg-icons';
+
+import Flash from './Flash';
+import OperationsQueue from './OperationsQueue';
+import TypeDeChamps from './components/TypeDeChamps';
+
+library.add(
+ faArrowCircleDown,
+ faArrowDown,
+ faArrowsAltV,
+ faArrowUp,
+ faPlus,
+ faTrash
+);
+
+class TypesDeChampEditor extends Component {
+ constructor(props) {
+ super(props);
+ const defaultTypeDeChampAttributes = {
+ type_champ: 'text',
+ types_de_champ: [],
+ private: props.isAnnotation,
+ libelle: `${
+ props.isAnnotation ? 'Nouvelle annotation' : 'Nouveau champ'
+ } ${props.typeDeChampsTypes[0][0]}`
+ };
+ this.state = {
+ flash: new Flash(props.isAnnotation),
+ queue: new OperationsQueue(props.baseUrl),
+ defaultTypeDeChampAttributes,
+ typeDeChampsTypes: props.typeDeChampsTypes,
+ directUploadUrl: props.directUploadUrl,
+ isAnnotation: props.isAnnotation
+ };
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+TypesDeChampEditor.propTypes = {
+ baseUrl: PropTypes.string,
+ directUploadUrl: PropTypes.string,
+ isAnnotation: PropTypes.bool,
+ typeDeChamps: PropTypes.array,
+ typeDeChampsTypes: PropTypes.array
+};
+
+export default TypesDeChampEditor;
diff --git a/app/javascript/components/TypesDeChampEditor/index.js b/app/javascript/components/TypesDeChampEditor/index.js
index a5e224343..8cb4f529e 100644
--- a/app/javascript/components/TypesDeChampEditor/index.js
+++ b/app/javascript/components/TypesDeChampEditor/index.js
@@ -1,66 +1,3 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { library } from '@fortawesome/fontawesome-svg-core';
-import {
- faArrowDown,
- faArrowsAltV,
- faArrowUp,
- faArrowCircleDown,
- faPlus,
- faTrash
-} from '@fortawesome/free-solid-svg-icons';
+import Loadable from '../Loadable';
-import Flash from './Flash';
-import OperationsQueue from './OperationsQueue';
-import TypeDeChamps from './components/TypeDeChamps';
-
-library.add(
- faArrowDown,
- faArrowsAltV,
- faArrowUp,
- faArrowCircleDown,
- faPlus,
- faTrash
-);
-
-class TypesDeChampEditor extends Component {
- constructor(props) {
- super(props);
- const defaultTypeDeChampAttributes = {
- type_champ: 'text',
- types_de_champ: [],
- private: props.isAnnotation,
- libelle: `${
- props.isAnnotation ? 'Nouvelle annotation' : 'Nouveau champ'
- } ${props.typeDeChampsTypes[0][0]}`
- };
- this.state = {
- flash: new Flash(props.isAnnotation),
- queue: new OperationsQueue(props.baseUrl),
- defaultTypeDeChampAttributes,
- typeDeChampsTypes: props.typeDeChampsTypes,
- directUploadUrl: props.directUploadUrl,
- isAnnotation: props.isAnnotation
- };
- }
-
- render() {
- return (
-
- );
- }
-}
-
-TypesDeChampEditor.propTypes = {
- baseUrl: PropTypes.string,
- directUploadUrl: PropTypes.string,
- isAnnotation: PropTypes.bool,
- typeDeChamps: PropTypes.array,
- typeDeChampsTypes: PropTypes.array
-};
-
-export function createReactUJSElement(props) {
- return React.createElement(TypesDeChampEditor, props);
-}
-
-export default TypesDeChampEditor;
+export default Loadable(() => import('./TypesDeChampEditor'));
diff --git a/app/javascript/new_design/autosave.js b/app/javascript/new_design/autosave.js
index 75e8db7d6..9e03fa632 100644
--- a/app/javascript/new_design/autosave.js
+++ b/app/javascript/new_design/autosave.js
@@ -19,7 +19,7 @@ const autosaveController = new AutosaveController();
// Whenever a 'change' event is triggered on one of the form inputs, try to autosave.
const formSelector = 'form#dossier-edit-form.autosave-enabled';
-const formInputsSelector = `${formSelector} input:not([type=input]), ${formSelector} select, ${formSelector} textarea`;
+const formInputsSelector = `${formSelector} input:not([type=file]), ${formSelector} select, ${formSelector} textarea`;
delegate(
'change',
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
index aefdead6f..8d0eb5d3c 100644
--- a/app/javascript/packs/application.js
+++ b/app/javascript/packs/application.js
@@ -6,9 +6,7 @@ import '@rails/actiontext';
import 'whatwg-fetch'; // window.fetch polyfill
import Chartkick from 'chartkick';
import Highcharts from 'highcharts';
-
-import ReactUJS from '../shared/react-ujs';
-import reactComponents from '../shared/react-components';
+import ReactRailsUJS from 'react_ujs';
import '../shared/page-update-event';
import '../shared/activestorage/ujs';
@@ -61,8 +59,18 @@ Rails.start();
Turbolinks.start();
ActiveStorage.start();
-const loader = new ReactUJS(reactComponents);
-loader.start();
+// If Turbolinks is imported via Webpacker (and thus not available globally),
+// ReactRailsUJS will be unable to locate it.
+// https://github.com/reactjs/react-rails#event-handling
+
+// eslint-disable-next-line no-undef
+ReactRailsUJS.useContext(require.context('components', true));
+// Add Turbolinks to the global namespace:
+window.Turbolinks = Turbolinks;
+// Remove previous event handlers and add new ones:
+ReactRailsUJS.detectEvents();
+// (Optional) Clean up global namespace:
+delete window.Turbolinks;
// Expose globals
window.DS = window.DS || DS;
diff --git a/app/javascript/shared/react-components.js b/app/javascript/shared/react-components.js
deleted file mode 100644
index bc422a4b5..000000000
--- a/app/javascript/shared/react-components.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default function reactComponents(className) {
- switch (className) {
- case 'TypesDeChampEditor':
- return import('components/TypesDeChampEditor').then(
- mod => mod.createReactUJSElement
- );
- }
-}
diff --git a/app/javascript/shared/react-ujs.js b/app/javascript/shared/react-ujs.js
deleted file mode 100644
index c6e937984..000000000
--- a/app/javascript/shared/react-ujs.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import ReactDOM from 'react-dom';
-
-// This attribute holds the name of component which should be mounted
-// example: `data-react-class="MyApp.Items.EditForm"`
-const CLASS_NAME_ATTR = 'data-react-class';
-
-// This attribute holds JSON stringified props for initializing the component
-// example: `data-react-props="{\"item\": { \"id\": 1, \"name\": \"My Item\"} }"`
-const PROPS_ATTR = 'data-react-props';
-
-// This attribute holds which method to use between: ReactDOM.hydrate, ReactDOM.render
-const RENDER_ATTR = 'data-hydrate';
-
-function findDOMNodes() {
- return document.querySelectorAll(`[${CLASS_NAME_ATTR}]`);
-}
-
-export default class ReactUJS {
- constructor(loadComponent) {
- this.loadComponent = loadComponent;
- }
-
- async mountComponents() {
- const nodes = findDOMNodes();
-
- for (let node of nodes) {
- const className = node.getAttribute(CLASS_NAME_ATTR);
- const createReactUJSElement = await this.loadComponent(className).catch(
- () => null
- );
-
- if (!createReactUJSElement) {
- const message = "Cannot find component: '" + className + "'";
- // eslint-disable-next-line no-console
- console.error(
- '%c[react-rails] %c' + message + ' for element',
- 'font-weight: bold',
- '',
- node
- );
- throw new Error(
- message + '. Make sure your component is available to render.'
- );
- } else {
- const propsJson = node.getAttribute(PROPS_ATTR);
- const props = propsJson && JSON.parse(propsJson);
- const hydrate = node.getAttribute(RENDER_ATTR);
-
- if (hydrate && typeof ReactDOM.hydrate === 'function') {
- ReactDOM.hydrate(createReactUJSElement(props), node);
- } else {
- ReactDOM.render(createReactUJSElement(props), node);
- }
- }
- }
- }
-
- start() {
- addEventListener('ds:page:update', () => this.mountComponents());
- }
-}
diff --git a/app/jobs/auto_archive_procedure_job.rb b/app/jobs/auto_archive_procedure_job.rb
index 48484cefd..2d06cfbea 100644
--- a/app/jobs/auto_archive_procedure_job.rb
+++ b/app/jobs/auto_archive_procedure_job.rb
@@ -8,7 +8,7 @@ class AutoArchiveProcedureJob < ApplicationJob
.state_en_construction
.find_each(&:passer_automatiquement_en_instruction!)
- procedure.archive!
+ procedure.close!
end
end
end
diff --git a/app/jobs/find_dubious_procedures_job.rb b/app/jobs/find_dubious_procedures_job.rb
index f457ba871..187f1ad25 100644
--- a/app/jobs/find_dubious_procedures_job.rb
+++ b/app/jobs/find_dubious_procedures_job.rb
@@ -20,7 +20,7 @@ class FindDubiousProceduresJob < ApplicationJob
.joins(:procedure)
.where("unaccent(types_de_champ.libelle) ~* unaccent(?)", forbidden_regexp)
.where(type_champ: [TypeDeChamp.type_champs.fetch(:text), TypeDeChamp.type_champs.fetch(:textarea)])
- .where(procedures: { archived_at: nil, whitelisted_at: nil })
+ .where(procedures: { closed_at: nil, whitelisted_at: nil })
dubious_procedures_and_tdcs = forbidden_tdcs
.group_by(&:procedure_id)
diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb
index d097ebd74..1e94b2004 100644
--- a/app/models/administrateur.rb
+++ b/app/models/administrateur.rb
@@ -14,7 +14,7 @@ class Administrateur < ApplicationRecord
before_validation -> { sanitize_email(:email) }
scope :inactive, -> { joins(:user).where(users: { last_sign_in_at: nil }) }
- scope :with_publiees_ou_archivees, -> { joins(:procedures).where(procedures: { aasm_state: [:publiee, :archivee] }) }
+ scope :with_publiees_ou_closes, -> { joins(:procedures).where(procedures: { aasm_state: [:publiee, :archivee, :close] }) }
# validate :password_complexity, if: Proc.new { |a| Devise.password_length.include?(a.password.try(:size)) }
diff --git a/app/models/dossier.rb b/app/models/dossier.rb
index 0b2bc94a1..ab339ebd3 100644
--- a/app/models/dossier.rb
+++ b/app/models/dossier.rb
@@ -257,7 +257,7 @@ class Dossier < ApplicationRecord
end
def can_transition_to_en_construction?
- !procedure.archivee? && brouillon?
+ !procedure.close? && brouillon?
end
def can_be_updated_by_user?
diff --git a/app/models/procedure.rb b/app/models/procedure.rb
index ddb533995..257490810 100644
--- a/app/models/procedure.rb
+++ b/app/models/procedure.rb
@@ -1,7 +1,7 @@
require Rails.root.join('lib', 'percentile')
class Procedure < ApplicationRecord
- self.ignored_columns = ['logo', 'logo_secure_token']
+ self.ignored_columns = ['logo', 'logo_secure_token', 'test_started_at']
include ProcedureStatsConcern
@@ -46,8 +46,8 @@ class Procedure < ApplicationRecord
default_scope { where(hidden_at: nil) }
scope :brouillons, -> { where(aasm_state: :brouillon) }
scope :publiees, -> { where(aasm_state: :publiee) }
- scope :archivees, -> { where(aasm_state: :archivee) }
- scope :publiees_ou_archivees, -> { where(aasm_state: [:publiee, :archivee]) }
+ scope :closes, -> { where(aasm_state: [:archivee, :close]) }
+ scope :publiees_ou_closes, -> { where(aasm_state: [:publiee, :close, :archivee]) }
scope :by_libelle, -> { order(libelle: :asc) }
scope :created_during, -> (range) { where(created_at: range) }
scope :cloned_from_library, -> { where(cloned_from_library: true) }
@@ -77,7 +77,7 @@ class Procedure < ApplicationRecord
validates :lien_site_web, presence: true, if: :publiee?
validate :validate_for_publication, on: :publication
validate :check_juridique
- validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,50}\z/ }, uniqueness: { scope: [:path, :archived_at, :hidden_at], case_sensitive: false }
+ validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,50}\z/ }, uniqueness: { scope: [:path, :closed_at, :archived_at, :hidden_at], case_sensitive: false }
# FIXME: remove duree_conservation_required flag once all procedures are converted to the new style
validates :duree_conservation_dossiers_dans_ds, allow_nil: false, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: MAX_DUREE_CONSERVATION }, if: :durees_conservation_required
validates :duree_conservation_dossiers_hors_ds, allow_nil: false, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :durees_conservation_required
@@ -95,26 +95,22 @@ class Procedure < ApplicationRecord
aasm whiny_persistence: true do
state :brouillon, initial: true
state :publiee
- state :archivee
+ state :close
state :hidden
event :publish, before: :before_publish, after: :after_publish do
transitions from: :brouillon, to: :publiee
- transitions from: :archivee, to: :publiee
+ transitions from: :close, to: :publiee
end
- event :archive, after: :after_archive do
- transitions from: :publiee, to: :archivee
+ event :close, after: :after_close do
+ transitions from: :publiee, to: :close
end
event :hide, after: :after_hide do
transitions from: :brouillon, to: :hidden
transitions from: :publiee, to: :hidden
- transitions from: :archivee, to: :hidden
- end
-
- event :draft, after: :after_draft do
- transitions from: :publiee, to: :brouillon
+ transitions from: :close, to: :hidden
end
end
@@ -126,7 +122,7 @@ class Procedure < ApplicationRecord
other_procedure = other_procedure_with_path(path)
if other_procedure.present? && administrateur.owns?(other_procedure)
- other_procedure.archive!
+ other_procedure.close!
end
publish!
@@ -231,9 +227,10 @@ class Procedure < ApplicationRecord
end
def validate_for_publication
- old_attributes = self.slice(:aasm_state, :archived_at)
+ old_attributes = self.slice(:aasm_state, :archived_at, :closed_at)
self.aasm_state = :publiee
self.archived_at = nil
+ self.closed_at = nil
is_valid = validate
@@ -276,16 +273,24 @@ class Procedure < ApplicationRecord
update(csv_export_queued: false, xlsx_export_queued: false, ods_export_queued: false)
end
+ def closed_at
+ read_attribute(:closed_at).presence || archived_at
+ end
+
+ def close?
+ aasm_state == 'close' || aasm_state == 'archivee'
+ end
+
def locked?
- publiee_ou_archivee?
+ publiee_ou_close?
end
def accepts_new_dossiers?
- !archivee?
+ !close?
end
- def publiee_ou_archivee?
- publiee? || archivee?
+ def publiee_ou_close?
+ publiee? || close?
end
def expose_legacy_carto_api?
@@ -366,8 +371,8 @@ class Procedure < ApplicationRecord
}, &method(:clone_attachments))
procedure.path = SecureRandom.uuid
procedure.aasm_state = :brouillon
- procedure.test_started_at = nil
procedure.archived_at = nil
+ procedure.closed_at = nil
procedure.published_at = nil
procedure.lien_notice = nil
@@ -604,15 +609,16 @@ class Procedure < ApplicationRecord
end
def before_publish
- update!(archived_at: nil)
+ update!(archived_at: nil, closed_at: nil)
end
def after_publish
update!(published_at: Time.zone.now)
end
- def after_archive
- update!(archived_at: Time.zone.now)
+ def after_close
+ now = Time.zone.now
+ update!(archived_at: now, closed_at: now)
purge_export_files
end
@@ -623,10 +629,6 @@ class Procedure < ApplicationRecord
purge_export_files
end
- def after_draft
- update!(published_at: nil)
- end
-
def update_juridique_required
self.juridique_required ||= (cadre_juridique.present? || deliberation.attached?)
true
diff --git a/app/serializers/procedure_serializer.rb b/app/serializers/procedure_serializer.rb
index 778e236e6..cb7bc50cb 100644
--- a/app/serializers/procedure_serializer.rb
+++ b/app/serializers/procedure_serializer.rb
@@ -20,7 +20,7 @@ class ProcedureSerializer < ActiveModel::Serializer
belongs_to :service, serializer: ServiceSerializer
def archived_at
- object.archived_at&.in_time_zone('UTC')
+ object.closed_at&.in_time_zone('UTC')
end
def link
@@ -32,7 +32,8 @@ class ProcedureSerializer < ActiveModel::Serializer
end
def state
- object.aasm_state
+ state = object.aasm_state
+ state == 'close' ? 'archivee' : state
end
def geographic_information
diff --git a/app/services/administrateur_usage_statistics_service.rb b/app/services/administrateur_usage_statistics_service.rb
index 5c85f2a96..1cb9d5b57 100644
--- a/app/services/administrateur_usage_statistics_service.rb
+++ b/app/services/administrateur_usage_statistics_service.rb
@@ -35,7 +35,7 @@ class AdministrateurUsageStatisticsService
nb_instructeurs: nb_instructeurs_by_administrateur_id[administrateur.id],
ds_nb_demarches_actives: nb_demarches_by_administrateur_id_and_state[[administrateur.id, "publiee"]],
- ds_nb_demarches_archives: nb_demarches_by_administrateur_id_and_state[[administrateur.id, "archivee"]],
+ ds_nb_demarches_archives: nb_demarches_by_administrateur_id_and_state[[administrateur.id, "close"]],
ds_nb_demarches_brouillons: nb_demarches_by_administrateur_id_and_state[[administrateur.id, "brouillon"]],
nb_demarches_test: nb_dossiers_by_procedure_id
diff --git a/app/views/admin/procedures/_list.html.haml b/app/views/admin/procedures/_list.html.haml
index e47503397..d87130174 100644
--- a/app/views/admin/procedures/_list.html.haml
+++ b/app/views/admin/procedures/_list.html.haml
@@ -19,13 +19,13 @@
%td.col-xs-6= link_to(procedure.libelle, admin_procedure_href)
- if procedure.publiee?
%td.procedure-lien= link_to(procedure_lien(procedure), procedure_lien(procedure))
- - if procedure.publiee_ou_archivee?
+ - if procedure.publiee_ou_close?
%td= link_to(procedure.published_at.present? ? try_format_datetime(procedure.published_at) : "", admin_procedure_href)
- else
%td= link_to(try_format_datetime(procedure.created_at), admin_procedure_href)
%td
= link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn')
- - if !procedure.publiee_ou_archivee?
+ - if !procedure.publiee_ou_close?
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), data: { method: :delete, confirm: "Confirmez-vous la suppression de la démarche ? \n\n Attention : toute suppression est définitive et s’appliquera aux éventuels autres administrateurs de cette démarche !" }, class: 'btn-sm btn-danger')
= smart_listing.paginate
diff --git a/app/views/admin/procedures/_onglets.html.haml b/app/views/admin/procedures/_onglets.html.haml
index b797ca951..d5bb2970a 100644
--- a/app/views/admin/procedures/_onglets.html.haml
+++ b/app/views/admin/procedures/_onglets.html.haml
@@ -13,5 +13,5 @@
%li{ class: @archived_class }
%a{ :href => "#{url_for :admin_procedures_archived}" }
%h5{ style: 'color: black;' }
- Archivées
+ Closes
%br
diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml
index 13c81bac4..622022ba3 100644
--- a/app/views/admin/procedures/show.html.haml
+++ b/app/views/admin/procedures/show.html.haml
@@ -24,7 +24,7 @@
%i.fa.fa-exchange
Envoyer une copie
- - if @procedure.archivee?
+ - if @procedure.close?
%a.btn.btn-default#reopen-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
%i.fa.fa-rocket
Réactiver
@@ -49,8 +49,8 @@
- else
Publication
%div{ style: 'margin-top: 30px;' }
- - if @procedure.archivee?
- Cette démarche est archivée et n’est donc plus accessible par le public.
+ - if @procedure.close?
+ Cette démarche est close et n’est donc plus accessible par le public.
- elsif @procedure.publiee?
Cette démarche est publiée, certains éléments ne peuvent plus être modifiés.
Pour y accéder vous pouvez utiliser le lien :
diff --git a/app/views/instructeurs/procedures/index.html.haml b/app/views/instructeurs/procedures/index.html.haml
index 70488d4f4..a45f8815f 100644
--- a/app/views/instructeurs/procedures/index.html.haml
+++ b/app/views/instructeurs/procedures/index.html.haml
@@ -61,6 +61,6 @@
.stats-legend
= t('pluralize.archived', count: archived_count)
- - if p.archivee?
+ - if p.close?
.procedure-status
- %span.label Archivée
+ %span.label Close
diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml
index 23abde450..fae04f47a 100644
--- a/app/views/layouts/_new_header.haml
+++ b/app/views/layouts/_new_header.haml
@@ -3,14 +3,17 @@
- dossier = controller.try(:dossier_for_help)
- procedure = controller.try(:procedure_for_help)
-%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
+%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' }
.header-inner-content
.flex.align-center
- if params[:controller] == 'users/commencer'
= link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration"
- else
- = link_to '', root_path_for_profile(nav_bar_profile), class: "header-logo", title: "Revenir à l’accueil"
+ = link_to root_path_for_profile(nav_bar_profile), class: 'header-logo', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do
+ = image_tag 'marianne.svg', alt: '', width: 65
+ %span.big.site-title> demarches-simplifiees.fr
+ %span.small.site-title> d-s.fr
- if nav_bar_profile == :instructeur && instructeur_signed_in?
- current_url = request.path_info
@@ -34,7 +37,7 @@
%ul.header-right-content
- if nav_bar_profile == :instructeur && instructeur_signed_in?
%li
- .header-search
+ .header-search{ role: 'search' }
= form_tag instructeur_recherche_path, method: :get, class: "form" do
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
%button{ title: "Rechercher" }
@@ -42,7 +45,7 @@
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
%li
- .header-search
+ .header-search{ role: 'search' }
= form_tag recherche_dossiers_path, method: :post, class: "form" do
= text_field_tag :dossier_id, "", placeholder: "Numéro de dossier"
%button{ title: "Rechercher" }
diff --git a/app/views/layouts/_outdated_browser_banner.html.haml b/app/views/layouts/_outdated_browser_banner.html.haml
index 228248723..3e36890a6 100644
--- a/app/views/layouts/_outdated_browser_banner.html.haml
+++ b/app/views/layouts/_outdated_browser_banner.html.haml
@@ -2,7 +2,7 @@
- if !browser.modern?
#outdated-browser-banner
.container
- Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement. Nous vous recommendons fortement de
+ Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement. Nous vous recommandons fortement de
%a{ href: "https://browser-update.org/fr/update.html", target: "_blank", rel: "noopener" }mettre à jour votre navigateur
%span<>
\.
diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml
index 3a8c3aec8..e1a5393bd 100644
--- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml
+++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml
@@ -23,9 +23,9 @@
%a#archived-procedures{ :href => "#{url_for :admin_procedures_archived}" }
.procedure-list-element{ class: @archived_class }
- Archivées
+ Closes
.badge.progress-bar-purple
- = current_administrateur.procedures.archivees.count
+ = current_administrateur.procedures.closes.count
.split-hr-left
= render partial: 'layouts/switch_devise_profile_module'
diff --git a/app/views/manager/procedures/show.html.erb b/app/views/manager/procedures/show.html.erb
index 95216c8d4..49fef4973 100644
--- a/app/views/manager/procedures/show.html.erb
+++ b/app/views/manager/procedures/show.html.erb
@@ -39,10 +39,6 @@ as well as a link to its edit page.
<%= link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button' %>
<% end %>
- <% if procedure.publiee? && procedure.dossiers.empty? %>
- <%= link_to 'repasser en test', draft_manager_procedure_path(procedure), method: :post, class: 'button' %>
- <% end %>
-
<% if !procedure.hidden? %>
<%= link_to 'supprimer la démarche', hide_manager_procedure_path(procedure), method: :post, class: 'button', data: { confirm: "Confirmez-vous la suppression de la démarche ?" } %>
<% end %>
diff --git a/app/views/root/_footer.html.haml b/app/views/root/_footer.html.haml
index 7a49639b8..da808b1d1 100644
--- a/app/views/root/_footer.html.haml
+++ b/app/views/root/_footer.html.haml
@@ -1,4 +1,4 @@
-%footer.landing-footer
+%footer.landing-footer{ role: 'contentinfo' }
.container
%ul.footer-columns
diff --git a/app/views/root/administration.html.haml b/app/views/root/administration.html.haml
index df176903f..6401ce84d 100644
--- a/app/views/root/administration.html.haml
+++ b/app/views/root/administration.html.haml
@@ -141,7 +141,7 @@
%ul.numbers
%li.number
.number-value
- = number_with_delimiter(Administrateur.with_publiees_ou_archivees.uniq.count, :locale => :fr)
+ = number_with_delimiter(Administrateur.with_publiees_ou_closes.uniq.count, :locale => :fr)
.number-label<
administrations
%br<>
diff --git a/app/views/root/landing.html.haml b/app/views/root/landing.html.haml
index 3c72e717c..7a276b1b6 100644
--- a/app/views/root/landing.html.haml
+++ b/app/views/root/landing.html.haml
@@ -6,7 +6,7 @@
.container
.hero-wrapper
.hero-text
- %p.hero-tagline
+ %h1.hero-tagline
%em.hero-tagline-em Effectuer
%br<>
%em.hero-tagline-em une démarche administrative
@@ -14,16 +14,16 @@
%em.hero-tagline-em en ligne
.hero-illustration
- %img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "dématérialisez" }
+ %img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: '' }
.landing-panel.usagers-panel
.container
.role-panel-wrapper
.role-panel-30.role-usagers-image
- %img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: "usager" }
+ %img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: '' }
.role-panel-70
- %h1.role-panel-title Vous souhaitez effectuer une demande auprès d'une administration ?
+ %h2.role-panel-title Vous souhaitez effectuer une demande auprès d'une administration ?
%p.role-panel-explanation Réalisez vos demandes en toute simplicité et retrouvez vos dossiers en ligne
= link_to "Comment trouver ma démarche ?",
@@ -43,7 +43,7 @@
%ul.numbers
%li.number
.number-value
- = number_with_delimiter(Procedure.includes(:administrateurs).publiees_ou_archivees.flat_map(&:administrateurs).uniq.count, :locale => :fr)
+ = number_with_delimiter(Procedure.includes(:administrateurs).publiees_ou_closes.flat_map(&:administrateurs).uniq.count, :locale => :fr)
.number-label<
administrations
%br<>
@@ -67,7 +67,7 @@
.container
.cta-panel-wrapper
%div
- %h1.cta-panel-title Une question, un problème ?
+ %h2.cta-panel-title Une question, un problème ?
%p.cta-panel-explanation Notre équipe est disponible pour vous renseigner et vous aider
%div
= contact_link "Contactez-nous",
@@ -80,7 +80,7 @@
.container
.cta-panel-wrapper
%div
- %h1.cta-panel-title Administration : vous voulez dématerialiser ?
+ %h2.cta-panel-title Administration : vous voulez dématerialiser ?
%p.cta-panel-explanation Proposez à vos usagers de remplir leurs dossiers en ligne
%div
= link_to "Découvrez notre outil",
diff --git a/app/views/shared/dossiers/_submit_is_over.html.haml b/app/views/shared/dossiers/_submit_is_over.html.haml
index 212f6e00f..9711e95bd 100644
--- a/app/views/shared/dossiers/_submit_is_over.html.haml
+++ b/app/views/shared/dossiers/_submit_is_over.html.haml
@@ -2,7 +2,7 @@
.card.featured
.card-title
Le dépôt de dossier est fermé
- - if dossier.procedure.archived_at.present?
- Il n'est plus possible de déposer de dossier pour cette démarche en ligne depuis le #{try_format_date(dossier.procedure.archived_at)}.
+ - if dossier.procedure.closed_at.present?
+ Il n'est plus possible de déposer de dossier pour cette démarche en ligne depuis le #{try_format_date(dossier.procedure.closed_at)}.
- else
Il n'est plus possible de déposer de dossier pour cette démarche en ligne.
diff --git a/app/views/shared/dossiers/editable_champs/_siret.html.haml b/app/views/shared/dossiers/editable_champs/_siret.html.haml
index 5dbb2520e..a2c27ad80 100644
--- a/app/views/shared/dossiers/editable_champs/_siret.html.haml
+++ b/app/views/shared/dossiers/editable_champs/_siret.html.haml
@@ -5,7 +5,7 @@
required: champ.mandatory?,
pattern: "[0-9]{14}",
title: "Le numéro de SIRET doit comporter exactement 14 chiffres"
-.spinner.right-spinner.hidden
+.spinner.right.hidden
%div{ class: "siret-info-#{form.index}" }
- if champ.etablissement.present?
= render partial: 'shared/dossiers/editable_champs/etablissement_titre', locals: { etablissement: champ.etablissement }
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 78416e63d..686df7f57 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -186,7 +186,7 @@ fr:
etablissement_fail: 'Désolé, nous n’avons pas réussi à enregistrer l’établissement correspondant à ce numéro SIRET'
france_connect:
connexion: "Erreur lors de la connexion à France Connect."
- procedure_archived: "Cette démarche en ligne a été fermée, il n'est plus possible de déposer de dossier."
+ procedure_archived: "Cette démarche en ligne a été close, il n'est plus possible de déposer de dossier."
procedure_not_draft: "Cette démarche n’est maintenant plus en brouillon."
cadastres_empty:
one: "Aucune parcelle cadastrale sur la zone sélectionnée"
diff --git a/config/locales/models/procedure/fr.yml b/config/locales/models/procedure/fr.yml
index ce2e28fd7..b441c4524 100644
--- a/config/locales/models/procedure/fr.yml
+++ b/config/locales/models/procedure/fr.yml
@@ -12,5 +12,5 @@ fr:
duree_conservation_dossiers_hors_ds: Durée de conservation des dossiers hors demarches-simplifiees.fr
aasm_state/brouillon: Brouillon
aasm_state/publiee: Publiée
- aasm_state/archivee: Archivée
+ aasm_state/close: Close
aasm_state/hidden: Suprimée
diff --git a/db/migrate/20191114084643_add_closed_at_to_procedures.rb b/db/migrate/20191114084643_add_closed_at_to_procedures.rb
new file mode 100644
index 000000000..6f290e1f9
--- /dev/null
+++ b/db/migrate/20191114084643_add_closed_at_to_procedures.rb
@@ -0,0 +1,5 @@
+class AddClosedAtToProcedures < ActiveRecord::Migration[5.2]
+ def change
+ add_column :procedures, :closed_at, :datetime
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f19d1d49e..009fa088b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_11_13_142816) do
+ActiveRecord::Schema.define(version: 2019_11_14_113700) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -488,6 +488,7 @@ ActiveRecord::Schema.define(version: 2019_11_13_142816) do
t.boolean "csv_export_queued"
t.boolean "xlsx_export_queued"
t.boolean "ods_export_queued"
+ t.datetime "closed_at"
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
diff --git a/lib/tasks/deployment/20191114084623_archivee_to_close.rake b/lib/tasks/deployment/20191114084623_archivee_to_close.rake
new file mode 100644
index 000000000..eef2ea434
--- /dev/null
+++ b/lib/tasks/deployment/20191114084623_archivee_to_close.rake
@@ -0,0 +1,15 @@
+namespace :after_party do
+ desc 'Deployment task: archivee_to_close'
+ task archivee_to_close: :environment do
+ puts "Running deploy task 'archivee_to_close'"
+
+ Procedure.where(aasm_state: :archivee).update_all(aasm_state: :close)
+ Procedure.where(aasm_state: :close, closed_at: nil).find_each do |procedure|
+ procedure.update_column(:closed_at, procedure.archived_at)
+ end
+
+ # Update task as completed. If you remove the line below, the task will
+ # run with every deploy (or every time you call after_party:run).
+ AfterParty::TaskRecord.create version: '20191114084623'
+ end
+end
diff --git a/package.json b/package.json
index 653db4844..6a72eb949 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-intersection-observer": "^8.25.1",
+ "react-loadable": "^5.5.0",
"react-scroll-to-component": "^1.0.2",
"react-sortable-hoc": "^1.10.1",
"react_ujs": "^2.6.0",
diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb
index 749cb9684..c9d80263a 100644
--- a/spec/controllers/admin/procedures_controller_spec.rb
+++ b/spec/controllers/admin/procedures_controller_spec.rb
@@ -96,9 +96,9 @@ describe Admin::ProceduresController, type: :controller do
end
describe 'DELETE #destroy' do
- let(:procedure_draft) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], published_at: nil, archived_at: nil }
- let(:procedure_published) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], aasm_state: :publiee, published_at: Time.zone.now, archived_at: nil }
- let(:procedure_archived) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], aasm_state: :archivee, published_at: nil, archived_at: Time.zone.now }
+ let(:procedure_draft) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], published_at: nil, closed_at: nil }
+ let(:procedure_published) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], aasm_state: :publiee, published_at: Time.zone.now, closed_at: nil }
+ let(:procedure_closed) { create :procedure_with_dossiers, administrateur: admin, instructeurs: [admin.instructeur], aasm_state: :close, published_at: nil, closed_at: Time.zone.now }
subject { delete :destroy, params: { id: procedure.id } }
@@ -129,8 +129,8 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.status).to eq 401 }
end
- context 'when procedure is archived' do
- let!(:procedure) { procedure_archived }
+ context 'when procedure is closed' do
+ let!(:procedure) { procedure_closed }
it { expect { subject }.not_to change { Procedure.count } }
it { expect { subject }.not_to change { Dossier.count } }
@@ -138,7 +138,7 @@ describe Admin::ProceduresController, type: :controller do
end
context "when administrateur does not own the procedure" do
- let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, archived_at: nil }
+ let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, closed_at: nil }
subject { delete :destroy, params: { id: procedure_not_owned.id } }
@@ -185,7 +185,7 @@ describe Admin::ProceduresController, type: :controller do
end
it 'archive previous procedure' do
- expect(procedure2.archivee?).to be_truthy
+ expect(procedure2.close?).to be_truthy
end
end
@@ -201,7 +201,7 @@ describe Admin::ProceduresController, type: :controller do
it 'previous procedure remains published' do
expect(procedure2.publiee?).to be_truthy
- expect(procedure2.archivee?).to be_falsey
+ expect(procedure2.close?).to be_falsey
expect(procedure2.path).to match(/fake_path/)
end
end
@@ -260,9 +260,9 @@ describe Admin::ProceduresController, type: :controller do
end
context 'when owner want archive procedure' do
- it { expect(procedure.archivee?).to be_truthy }
+ it { expect(procedure.close?).to be_truthy }
it { expect(response).to redirect_to :admin_procedures }
- it { expect(flash[:notice]).to have_content 'Démarche archivée' }
+ it { expect(flash[:notice]).to have_content 'Démarche close' }
end
context 'when owner want to re-enable procedure' do
@@ -351,16 +351,16 @@ describe Admin::ProceduresController, type: :controller do
describe 'selecting' do
let!(:large_draft_procedure) { create(:procedure_with_dossiers, dossiers_count: 2) }
let!(:large_published_procedure) { create(:procedure_with_dossiers, :published, dossiers_count: 2) }
- let!(:large_archived_procedure) { create(:procedure_with_dossiers, :archived, dossiers_count: 2) }
- let!(:small_archived_procedure) { create(:procedure_with_dossiers, :archived, dossiers_count: 1) }
+ let!(:large_closed_procedure) { create(:procedure_with_dossiers, :closed, dossiers_count: 2) }
+ let!(:small_closed_procedure) { create(:procedure_with_dossiers, :closed, dossiers_count: 1) }
- it 'displays published and archived procedures' do
+ it 'displays published and closed procedures' do
expect(response_procedures).to include(large_published_procedure)
- expect(response_procedures).to include(large_archived_procedure)
+ expect(response_procedures).to include(large_closed_procedure)
end
it 'doesn’t display procedures without a significant number of dossiers' do
- expect(response_procedures).not_to include(small_archived_procedure)
+ expect(response_procedures).not_to include(small_closed_procedure)
end
it 'doesn’t display draft procedures' do
diff --git a/spec/controllers/api/v1/procedures_controller_spec.rb b/spec/controllers/api/v1/procedures_controller_spec.rb
index 87b8d2410..bcc6b4a3b 100644
--- a/spec/controllers/api/v1/procedures_controller_spec.rb
+++ b/spec/controllers/api/v1/procedures_controller_spec.rb
@@ -35,7 +35,7 @@ describe API::V1::ProceduresController, type: :controller do
it { expect(subject[:description]).to eq(procedure.description) }
it { expect(subject[:organisation]).to eq(procedure.organisation) }
it { expect(subject[:direction]).to eq(procedure.direction) }
- it { expect(subject[:archived_at]).to eq(procedure.archived_at) }
+ it { expect(subject[:archived_at]).to eq(procedure.closed_at) }
it { expect(subject[:total_dossier]).to eq(procedure.total_dossier) }
it { is_expected.to have_key(:types_de_champ) }
it { expect(subject[:types_de_champ]).to be_an(Array) }
diff --git a/spec/controllers/api/v2/graphql_controller_spec.rb b/spec/controllers/api/v2/graphql_controller_spec.rb
index 6910643bb..d87601827 100644
--- a/spec/controllers/api/v2/graphql_controller_spec.rb
+++ b/spec/controllers/api/v2/graphql_controller_spec.rb
@@ -30,9 +30,9 @@ describe API::V2::GraphqlController do
title
description
state
- createdAt
- updatedAt
- archivedAt
+ dateCreation
+ dateDerniereModification
+ dateFermeture
groupeInstructeurs {
label
instructeurs {
@@ -80,9 +80,9 @@ describe API::V2::GraphqlController do
title: procedure.libelle,
description: procedure.description,
state: 'brouillon',
- archivedAt: nil,
- createdAt: procedure.created_at.iso8601,
- updatedAt: procedure.updated_at.iso8601,
+ dateFermeture: nil,
+ dateCreation: procedure.created_at.iso8601,
+ dateDerniereModification: procedure.updated_at.iso8601,
groupeInstructeurs: [
{
instructeurs: [{ email: instructeur.email }],
@@ -139,7 +139,7 @@ describe API::V2::GraphqlController do
id
number
state
- updatedAt
+ dateDerniereModification
datePassageEnConstruction
datePassageEnInstruction
dateTraitement
@@ -159,9 +159,13 @@ describe API::V2::GraphqlController do
attachmentUrl
}
avis {
- email
+ expert {
+ email
+ }
question
- answer
+ reponse
+ dateQuestion
+ dateReponse
attachmentUrl
}
champs {
@@ -179,7 +183,7 @@ describe API::V2::GraphqlController do
id: dossier.to_typed_id,
number: dossier.id,
state: 'en_construction',
- updatedAt: dossier.updated_at.iso8601,
+ dateDerniereModification: dossier.updated_at.iso8601,
datePassageEnConstruction: dossier.en_construction_at.iso8601,
datePassageEnInstruction: nil,
dateTraitement: nil,
diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb
index de0280657..417d58491 100644
--- a/spec/controllers/instructeurs/procedures_controller_spec.rb
+++ b/spec/controllers/instructeurs/procedures_controller_spec.rb
@@ -99,7 +99,7 @@ describe Instructeurs::ProceduresController, type: :controller do
context "with procedures assigned" do
let(:procedure1) { create(:procedure, :published) }
- let(:procedure2) { create(:procedure, :archived) }
+ let(:procedure2) { create(:procedure, :closed) }
let(:procedure3) { create(:procedure) }
before do
diff --git a/spec/controllers/new_administrateur/groupe_instructeurs_controller_spec.rb b/spec/controllers/new_administrateur/groupe_instructeurs_controller_spec.rb
index 2e128a487..d7464006d 100644
--- a/spec/controllers/new_administrateur/groupe_instructeurs_controller_spec.rb
+++ b/spec/controllers/new_administrateur/groupe_instructeurs_controller_spec.rb
@@ -117,6 +117,12 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
it { expect(flash.alert).to be_present }
it { expect(response).to redirect_to(procedure_groupe_instructeur_path(procedure, procedure.defaut_groupe_instructeur)) }
end
+
+ context 'of an empty string' do
+ let(:new_instructeur_emails) { '' }
+
+ it { expect(response).to redirect_to(procedure_groupe_instructeur_path(procedure, procedure.defaut_groupe_instructeur)) }
+ end
end
describe '#remove_instructeur' do
diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb
index e4bf93fed..72c7833b6 100644
--- a/spec/controllers/users/dossiers_controller_spec.rb
+++ b/spec/controllers/users/dossiers_controller_spec.rb
@@ -423,8 +423,8 @@ describe Users::DossiersController, type: :controller do
expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction))
end
- context "on an archived procedure" do
- before { dossier.procedure.archive }
+ context "on an closed procedure" do
+ before { dossier.procedure.close! }
it "it does not change state" do
subject
@@ -873,8 +873,8 @@ describe Users::DossiersController, type: :controller do
it { is_expected.to redirect_to identite_dossier_path(id: Dossier.last) }
end
- context 'when procedure is archived' do
- let(:procedure) { create(:procedure, :archived) }
+ context 'when procedure is closed' do
+ let(:procedure) { create(:procedure, :closed) }
it { is_expected.to redirect_to dossiers_path }
end
diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb
index b392caba3..1ca4d97fb 100644
--- a/spec/factories/procedure.rb
+++ b/spec/factories/procedure.rb
@@ -160,21 +160,11 @@ FactoryBot.define do
end
end
- trait :archived do
+ trait :closed do
after(:build) do |procedure, _evaluator|
procedure.path = generate(:published_path)
procedure.publish!
- procedure.archive!
- end
- end
-
- trait :archived_automatically do
- # For now the behavior is the same than :archived
- # (it may be different in the future though)
- after(:build) do |procedure, _evaluator|
- procedure.path = generate(:published_path)
- procedure.publish!
- procedure.archive!
+ procedure.close!
end
end
diff --git a/spec/features/instructeurs/procedure_filters_spec.rb b/spec/features/instructeurs/procedure_filters_spec.rb
index 5753111bd..144305ff7 100644
--- a/spec/features/instructeurs/procedure_filters_spec.rb
+++ b/spec/features/instructeurs/procedure_filters_spec.rb
@@ -25,10 +25,10 @@ feature "procedure filters" do
scenario "should list all dossiers" do
within ".dossiers-table" do
- expect(page).to have_link(new_unfollow_dossier.id)
+ expect(page).to have_link(new_unfollow_dossier.id.to_s)
expect(page).to have_link(new_unfollow_dossier.user.email)
- expect(page).to have_link(new_unfollow_dossier_2.id)
+ expect(page).to have_link(new_unfollow_dossier_2.id.to_s)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end
@@ -61,20 +61,20 @@ feature "procedure filters" do
expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
within ".dossiers-table" do
- expect(page).to have_link(new_unfollow_dossier.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
- expect(page).not_to have_link(new_unfollow_dossier_2.id, exact: true)
+ expect(page).not_to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).not_to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ.value)
within ".dossiers-table" do
- expect(page).to have_link(new_unfollow_dossier.id)
+ expect(page).to have_link(new_unfollow_dossier.id.to_s)
expect(page).to have_link(new_unfollow_dossier.user.email)
- expect(page).to have_link(new_unfollow_dossier_2.id)
+ expect(page).to have_link(new_unfollow_dossier_2.id.to_s)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end
@@ -86,30 +86,30 @@ feature "procedure filters" do
expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
within ".dossiers-table" do
- expect(page).to have_link(new_unfollow_dossier.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
- expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ.value)
within ".dossiers-table" do
- expect(page).not_to have_link(new_unfollow_dossier.id, exact: true)
+ expect(page).not_to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).not_to have_link(new_unfollow_dossier.user.email)
- expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ_2.value)
within ".dossiers-table" do
- expect(page).to have_link(new_unfollow_dossier.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
- expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
+ expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end
diff --git a/spec/features/users/invite_spec.rb b/spec/features/users/invite_spec.rb
index 5651743f0..2a7d4a26f 100644
--- a/spec/features/users/invite_spec.rb
+++ b/spec/features/users/invite_spec.rb
@@ -104,13 +104,13 @@ feature 'Invitations' do
def navigate_to_brouillon(dossier)
expect(page).to have_current_path(dossiers_path)
- click_on(dossier.id)
+ click_on(dossier.id.to_s)
expect(page).to have_current_path(brouillon_dossier_path(dossier))
end
def navigate_to_dossier(dossier)
expect(page).to have_current_path(dossiers_path)
- click_on(dossier.id)
+ click_on(dossier.id.to_s)
expect(page).to have_current_path(dossier_path(dossier))
end
diff --git a/spec/helpers/dossier_helper_spec.rb b/spec/helpers/dossier_helper_spec.rb
index b165b3285..e327ca095 100644
--- a/spec/helpers/dossier_helper_spec.rb
+++ b/spec/helpers/dossier_helper_spec.rb
@@ -49,8 +49,8 @@ RSpec.describe DossierHelper, type: :helper do
context "when dossier state is brouillon" do
it { is_expected.to be false }
- context "when dossier state is brouillon and procedure is archivee" do
- before { dossier.procedure.archive }
+ context "when dossier state is brouillon and procedure is close" do
+ before { dossier.procedure.close }
it { is_expected.to be true }
end
@@ -59,8 +59,8 @@ RSpec.describe DossierHelper, type: :helper do
shared_examples_for "returns false" do
it { is_expected.to be false }
- context "and procedure is archivee" do
- before { dossier.procedure.archive }
+ context "and procedure is close" do
+ before { dossier.procedure.close }
it { is_expected.to be false }
end
diff --git a/spec/jobs/auto_archive_procedure_job_spec.rb b/spec/jobs/auto_archive_procedure_job_spec.rb
index 60f577a55..a9cf6c161 100644
--- a/spec/jobs/auto_archive_procedure_job_spec.rb
+++ b/spec/jobs/auto_archive_procedure_job_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
procedure.reload
end
- it { expect(procedure.archivee?).to eq false }
+ it { expect(procedure.close?).to eq false }
end
context "when procedures have auto_archive_on set on yesterday or today" do
@@ -53,8 +53,8 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
}
it {
- expect(procedure_hier.archivee?).to eq true
- expect(procedure_aujourdhui.archivee?).to eq true
+ expect(procedure_hier.close?).to eq true
+ expect(procedure_aujourdhui.close?).to eq true
}
end
@@ -63,6 +63,6 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
subject
end
- it { expect(procedure_demain.archivee?).to eq false }
+ it { expect(procedure_demain.close?).to eq false }
end
end
diff --git a/spec/jobs/find_dubious_procedures_job_spec.rb b/spec/jobs/find_dubious_procedures_job_spec.rb
index eddba63a3..158aca46e 100644
--- a/spec/jobs/find_dubious_procedures_job_spec.rb
+++ b/spec/jobs/find_dubious_procedures_job_spec.rb
@@ -40,8 +40,8 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end
- context 'and a archived procedure' do
- let(:procedure) { create(:procedure, :archived) }
+ context 'and a closed procedure' do
+ let(:procedure) { create(:procedure, :closed) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end
diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb
index d790e7814..70e141121 100644
--- a/spec/models/dossier_spec.rb
+++ b/spec/models/dossier_spec.rb
@@ -702,8 +702,8 @@ describe Dossier do
let(:state) { Dossier.states.fetch(:brouillon) }
it { is_expected.to be true }
- context "procedure is archived" do
- before { procedure.archive }
+ context "procedure is closed" do
+ before { procedure.close! }
it { is_expected.to be false }
end
end
diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb
index 0117b43df..87649142a 100644
--- a/spec/models/procedure_spec.rb
+++ b/spec/models/procedure_spec.rb
@@ -356,17 +356,17 @@ describe Procedure do
let(:procedure) { create(:procedure) }
subject { Procedure.active(procedure.id) }
- context 'when procedure is in draft status and not archived' do
+ context 'when procedure is in draft status and not closed' do
it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) }
end
- context 'when procedure is published and not archived' do
+ context 'when procedure is published and not closed' do
let(:procedure) { create(:procedure, :published) }
it { is_expected.to be_truthy }
end
- context 'when procedure is published and archived' do
- let(:procedure) { create(:procedure, :archived) }
+ context 'when procedure is published and closed' do
+ let(:procedure) { create(:procedure, :closed) }
it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) }
end
end
@@ -509,12 +509,11 @@ describe Procedure do
end
describe 'procedure status is reset' do
- let(:procedure) { create(:procedure, :archived, received_mail: received_mail, service: service) }
+ let(:procedure) { create(:procedure, :closed, received_mail: received_mail, service: service) }
- it 'Not published nor archived' do
- expect(subject.archived_at).to be_nil
+ it 'Not published nor closed' do
+ expect(subject.closed_at).to be_nil
expect(subject.published_at).to be_nil
- expect(subject.test_started_at).to be_nil
expect(subject.aasm_state).to eq "brouillon"
expect(subject.path).not_to be_nil
end
@@ -556,7 +555,7 @@ describe Procedure do
end
after { Timecop.return }
- it { expect(procedure.archived_at).to eq(nil) }
+ it { expect(procedure.closed_at).to eq(nil) }
it { expect(procedure.published_at).to eq(now) }
it { expect(Procedure.find_by(path: "example-path")).to eq(procedure) }
it { expect(Procedure.find_by(path: "example-path").administrateurs).to eq(procedure.administrateurs) }
@@ -565,41 +564,41 @@ describe Procedure do
describe "#brouillon?" do
let(:procedure_brouillon) { Procedure.new() }
let(:procedure_publiee) { Procedure.new(aasm_state: :publiee, published_at: Time.zone.now) }
- let(:procedure_archivee) { Procedure.new(aasm_state: :archivee, published_at: Time.zone.now, archived_at: Time.zone.now) }
+ let(:procedure_close) { Procedure.new(aasm_state: :close, published_at: Time.zone.now, closed_at: Time.zone.now) }
it { expect(procedure_brouillon.brouillon?).to be_truthy }
it { expect(procedure_publiee.brouillon?).to be_falsey }
- it { expect(procedure_archivee.brouillon?).to be_falsey }
+ it { expect(procedure_close.brouillon?).to be_falsey }
end
describe "#publiee?" do
let(:procedure_brouillon) { Procedure.new() }
let(:procedure_publiee) { Procedure.new(aasm_state: :publiee, published_at: Time.zone.now) }
- let(:procedure_archivee) { Procedure.new(aasm_state: :archivee, published_at: Time.zone.now, archived_at: Time.zone.now) }
+ let(:procedure_close) { Procedure.new(aasm_state: :close, published_at: Time.zone.now, closed_at: Time.zone.now) }
it { expect(procedure_brouillon.publiee?).to be_falsey }
it { expect(procedure_publiee.publiee?).to be_truthy }
- it { expect(procedure_archivee.publiee?).to be_falsey }
+ it { expect(procedure_close.publiee?).to be_falsey }
end
- describe "#archivee?" do
+ describe "#close?" do
let(:procedure_brouillon) { Procedure.new() }
let(:procedure_publiee) { Procedure.new(aasm_state: :publiee, published_at: Time.zone.now) }
- let(:procedure_archivee) { Procedure.new(aasm_state: :archivee, published_at: Time.zone.now, archived_at: Time.zone.now) }
+ let(:procedure_close) { Procedure.new(aasm_state: :close, published_at: Time.zone.now, closed_at: Time.zone.now) }
- it { expect(procedure_brouillon.archivee?).to be_falsey }
- it { expect(procedure_publiee.archivee?).to be_falsey }
- it { expect(procedure_archivee.archivee?).to be_truthy }
+ it { expect(procedure_brouillon.close?).to be_falsey }
+ it { expect(procedure_publiee.close?).to be_falsey }
+ it { expect(procedure_close.close?).to be_truthy }
end
- describe "#publiee_ou_archivee?" do
+ describe "#publiee_ou_close?" do
let(:procedure_brouillon) { Procedure.new() }
let(:procedure_publiee) { Procedure.new(aasm_state: :publiee, published_at: Time.zone.now) }
- let(:procedure_archivee) { Procedure.new(aasm_state: :archivee, published_at: Time.zone.now, archived_at: Time.zone.now) }
+ let(:procedure_close) { Procedure.new(aasm_state: :close, published_at: Time.zone.now, closed_at: Time.zone.now) }
- it { expect(procedure_brouillon.publiee_ou_archivee?).to be_falsey }
- it { expect(procedure_publiee.publiee_ou_archivee?).to be_truthy }
- it { expect(procedure_archivee.publiee_ou_archivee?).to be_truthy }
+ it { expect(procedure_brouillon.publiee_ou_close?).to be_falsey }
+ it { expect(procedure_publiee.publiee_ou_close?).to be_truthy }
+ it { expect(procedure_close.publiee_ou_close?).to be_truthy }
end
describe 'archive' do
@@ -607,13 +606,13 @@ describe Procedure do
let(:now) { Time.zone.now.beginning_of_minute }
before do
Timecop.freeze(now)
- procedure.archive!
+ procedure.close!
procedure.reload
end
after { Timecop.return }
- it { expect(procedure.archivee?).to be_truthy }
- it { expect(procedure.archived_at).to eq(now) }
+ it { expect(procedure.close?).to be_truthy }
+ it { expect(procedure.closed_at).to eq(now) }
end
describe 'path_customized?' do
diff --git a/spec/services/administrateur_usage_statistics_service_spec.rb b/spec/services/administrateur_usage_statistics_service_spec.rb
index 65520376f..60de16d5e 100644
--- a/spec/services/administrateur_usage_statistics_service_spec.rb
+++ b/spec/services/administrateur_usage_statistics_service_spec.rb
@@ -83,8 +83,8 @@ describe AdministrateurUsageStatisticsService do
end
end
- context 'with a procedure archivee' do
- let(:procedure) { create(:procedure, aasm_state: 'archivee') }
+ context 'with a procedure close' do
+ let(:procedure) { create(:procedure, aasm_state: 'close') }
let!(:dossiers) do
(1..7).flat_map do
[
diff --git a/spec/views/admin/procedures/show.html.haml_spec.rb b/spec/views/admin/procedures/show.html.haml_spec.rb
index c1ec1bffe..fe2b44b0d 100644
--- a/spec/views/admin/procedures/show.html.haml_spec.rb
+++ b/spec/views/admin/procedures/show.html.haml_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe 'admin/procedures/show.html.haml', type: :view do
- let(:archived_at) { nil }
- let(:procedure) { create(:procedure, :with_service, archived_at: archived_at) }
+ let(:closed_at) { nil }
+ let(:procedure) { create(:procedure, :with_service, closed_at: closed_at) }
before do
assign(:procedure, procedure)
@@ -58,10 +58,10 @@ describe 'admin/procedures/show.html.haml', type: :view do
end
end
- describe 'procedure is archived' do
+ describe 'procedure is closed' do
before do
procedure.publish!
- procedure.archive!
+ procedure.close!
procedure.reload
render
end
@@ -73,7 +73,7 @@ describe 'admin/procedures/show.html.haml', type: :view do
end
describe 'procedure link is present' do
- it { expect(rendered).to have_content('Cette démarche est archivée et n’est donc plus accessible par le public.') }
+ it { expect(rendered).to have_content('Cette démarche est close et n’est donc plus accessible par le public.') }
end
end
end
diff --git a/spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb b/spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb
index 1e3f19431..73a0f57a4 100644
--- a/spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb
+++ b/spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb
@@ -13,12 +13,12 @@ describe 'users/dossiers/dossier_actions.html.haml', type: :view do
end
context 'when the procedure is closed' do
- let(:procedure) { create(:procedure, :archived) }
+ let(:procedure) { create(:procedure, :closed) }
it { is_expected.not_to have_link('Commencer un autre dossier') }
end
context 'when there are no actions to display' do
- let(:procedure) { create(:procedure, :archived) }
+ let(:procedure) { create(:procedure, :closed) }
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
it 'doesn’t render the menu at all' do
diff --git a/spec/views/users/dossiers/index.html.haml_spec.rb b/spec/views/users/dossiers/index.html.haml_spec.rb
index f220b8f86..e908b5678 100644
--- a/spec/views/users/dossiers/index.html.haml_spec.rb
+++ b/spec/views/users/dossiers/index.html.haml_spec.rb
@@ -24,13 +24,13 @@ describe 'users/dossiers/index.html.haml', type: :view do
it 'affiche les informations des dossiers' do
dossier = user_dossiers.first
- expect(rendered).to have_text(dossier_brouillon.id)
+ expect(rendered).to have_text(dossier_brouillon.id.to_s)
expect(rendered).to have_text(dossier_brouillon.procedure.libelle)
- expect(rendered).to have_link(dossier_brouillon.id, href: brouillon_dossier_path(dossier_brouillon))
+ expect(rendered).to have_link(dossier_brouillon.id.to_s, href: brouillon_dossier_path(dossier_brouillon))
- expect(rendered).to have_text(dossier_en_construction.id)
+ expect(rendered).to have_text(dossier_en_construction.id.to_s)
expect(rendered).to have_text(dossier_en_construction.procedure.libelle)
- expect(rendered).to have_link(dossier_en_construction.id, href: dossier_path(dossier_en_construction))
+ expect(rendered).to have_link(dossier_en_construction.id.to_s, href: dossier_path(dossier_en_construction))
end
context 'quand il n’y a aucun dossier' do
diff --git a/yarn.lock b/yarn.lock
index 13623df33..489582165 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6953,7 +6953,7 @@ promise-inflight@^1.0.1:
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=
-prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.6.2, prop-types@^15.7.2:
+prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -7142,6 +7142,13 @@ react-is@^16.8.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
+react-loadable@^5.5.0:
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/react-loadable/-/react-loadable-5.5.0.tgz#582251679d3da86c32aae2c8e689c59f1196d8c4"
+ integrity sha512-C8Aui0ZpMd4KokxRdVAm2bQtI03k2RMRNzOB+IipV3yxFTSVICv7WoUr5L9ALB5BmKO1iHgZtWM8EvYG83otdg==
+ dependencies:
+ prop-types "^15.5.0"
+
react-scroll-to-component@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-scroll-to-component/-/react-scroll-to-component-1.0.2.tgz#f260dc936c62a53e772786d7832fe0884e195354"