Merge pull request #7677 from mfo/US/new-service-ux
Nouvelle page pour les services (prenant en compte le design d'olivier)
This commit is contained in:
commit
4d9adb149f
42 changed files with 285 additions and 95 deletions
|
@ -27,7 +27,7 @@ module.exports = {
|
|||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['.eslintrc.js', 'vite.config.ts'],
|
||||
files: ['.eslintrc.js', 'vite.config.ts', 'postcss.config.js'],
|
||||
env: { node: true }
|
||||
},
|
||||
{
|
||||
|
|
BIN
app/assets/fonts/Marianne-Regular.woff
Normal file
BIN
app/assets/fonts/Marianne-Regular.woff
Normal file
Binary file not shown.
BIN
app/assets/fonts/Marianne-Regular.woff2
Normal file
BIN
app/assets/fonts/Marianne-Regular.woff2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app/assets/fonts/Spectral-Regular.ttf
Normal file
BIN
app/assets/fonts/Spectral-Regular.ttf
Normal file
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
@import "colors";
|
||||
|
||||
%new-type {
|
||||
font-family: "Muli", system-ui, -apple-system, sans-serif;
|
||||
font-family: "Marianne", system-ui, -apple-system, sans-serif;
|
||||
color: $black;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
padding: 8px 16px;
|
||||
border-radius: 30px;
|
||||
border: 1px solid $border-grey;
|
||||
font-family: "Muli";
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
background-color: #FFFFFF;
|
||||
|
|
3
app/assets/stylesheets/dsfr.scss
Normal file
3
app/assets/stylesheets/dsfr.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
body [href] {
|
||||
background-image: none;
|
||||
}
|
|
@ -1,23 +1,14 @@
|
|||
@font-face {
|
||||
font-family: "Muli";
|
||||
src: asset-url("Muli-Regular.woff2") format("woff2"),
|
||||
asset-url("Muli-Regular.woff") format("woff");
|
||||
font-family: "Marianne";
|
||||
src: asset-url("Marianne-Regular.woff2") format("woff2"),
|
||||
asset-url("Marianne-Regular.woff") format("woff");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Muli";
|
||||
src: asset-url("Muli-Bold.woff2") format("woff2"),
|
||||
asset-url("Muli-Bold.woff") format("woff");
|
||||
font-family: "Spectrale";
|
||||
src: asset-url("Spectral-Regular.ttf") format("ttf");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Muli";
|
||||
src: asset-url("Muli-Italic.woff2") format("woff2"),
|
||||
asset-url("Muli-Italic.woff") format("woff");
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
|
|
@ -494,6 +494,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.justify-content--space-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.send-notice {
|
||||
@include notice-text-style;
|
||||
margin-bottom: $default-padding;
|
||||
|
@ -603,3 +607,7 @@ textarea::placeholder {
|
|||
opacity: 0.6; // normalize opacity across browsers
|
||||
color: $dark-grey;
|
||||
}
|
||||
|
||||
.send-wrapper--with-border-top {
|
||||
border-top: 2px solid rgba(0, 0, 145, 1);
|
||||
}
|
||||
|
|
|
@ -295,6 +295,7 @@ $users-breakpoint: 950px;
|
|||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin-top: 13px;
|
||||
color: #FFFFFF;
|
||||
|
||||
&.grey {
|
||||
color: $g700;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
|
||||
body {
|
||||
font-family: "Muli";
|
||||
font-family: "Marianne";
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
padding-bottom: 5px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid $border-grey;
|
||||
font-family: "Muli";
|
||||
background-color: #FFFFFF;
|
||||
color: $black;
|
||||
text-align: center;
|
||||
|
|
|
@ -44,6 +44,5 @@ q:before, q:after {
|
|||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
@import "constants";
|
||||
|
||||
.table-service {
|
||||
.change {
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
padding-left: $default-padding;
|
||||
}
|
||||
.change {
|
||||
width: 300px;
|
||||
}
|
||||
|
|
|
@ -130,3 +130,24 @@ $steps: (0, 1, 2, 3, 4, 5, 6, 7, 8);
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$directions: (
|
||||
"t": ("padding-top"),
|
||||
"r": ("padding-right"),
|
||||
"b": ("padding-bottom"),
|
||||
"l": ("padding-left"),
|
||||
"x": ("padding-left", "padding-right"),
|
||||
"y": ("padding-top", "padding-bottom"),
|
||||
"": ("padding")
|
||||
);
|
||||
$steps: (0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
@each $modifier, $properties in $directions {
|
||||
@each $step in $steps {
|
||||
@each $property in $properties {
|
||||
.p#{$modifier}-#{$step} {
|
||||
#{$property}: $step * $default-spacer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
24
app/components/dsfr/alert_component.rb
Normal file
24
app/components/dsfr/alert_component.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/alerte
|
||||
class Dsfr::AlertComponent < ApplicationComponent
|
||||
renders_one :body
|
||||
|
||||
def prefix_for_state
|
||||
case state
|
||||
when :error then "Erreur : "
|
||||
when :info then "Information : "
|
||||
when :warning then "Attention : "
|
||||
when :success then ""
|
||||
else ""
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def initialize(state:, title:)
|
||||
@state = state
|
||||
@title = title
|
||||
@block = block
|
||||
end
|
||||
|
||||
attr_reader :state, :title, :block
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
%div{ class: "fr-alert fr-alert--#{state}" }
|
||||
%h3.fr-alert__title= "#{prefix_for_state}#{title}"
|
||||
= body
|
12
app/components/dsfr/button_component.rb
Normal file
12
app/components/dsfr/button_component.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class Dsfr::ButtonComponent < ApplicationComponent
|
||||
private
|
||||
|
||||
def initialize(label:, form: nil, url: nil, class_names: [])
|
||||
@form = form
|
||||
@label = label
|
||||
@url = url
|
||||
@class_names = Array(class_names)
|
||||
end
|
||||
|
||||
attr_reader :form, :url, :label, :class_names
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
- if form
|
||||
= form.submit label, class: "fr-btn #{class_names.join(" ")}"
|
||||
- elsif url
|
||||
= link_to label, url, class: "fr-btn #{class_names.join(" ")}"
|
||||
|
12
app/components/dsfr/callout_component.rb
Normal file
12
app/components/dsfr/callout_component.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/mise-en-avant
|
||||
class Dsfr::CalloutComponent < ApplicationComponent
|
||||
renders_one :body
|
||||
|
||||
private
|
||||
|
||||
def initialize(title:)
|
||||
@title = title
|
||||
end
|
||||
|
||||
attr_reader :title
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
%div.fr-callout
|
||||
%h3.fr-callout__title= title
|
||||
%p.fr-callout__text= body
|
|
@ -1,4 +1,4 @@
|
|||
= link_to service_link, class: 'card-admin' do
|
||||
= link_to service_link, class: 'card-admin', id: 'service' do
|
||||
- if @procedure.service_id.present?
|
||||
%div
|
||||
%span.icon.accept
|
||||
|
|
|
@ -141,8 +141,8 @@ module Administrateurs
|
|||
new_procedure = procedure.clone(current_administrateur, cloned_from_library?)
|
||||
|
||||
if new_procedure.valid?
|
||||
flash.notice = 'Démarche clonée'
|
||||
redirect_to edit_admin_procedure_path(id: new_procedure.id)
|
||||
flash.notice = 'Démarche clonée, pensez a vérifier la Présentation et choisir le service a laquelle cette procédure est associé.'
|
||||
redirect_to admin_procedure_path(id: new_procedure.id)
|
||||
else
|
||||
if cloned_from_library?
|
||||
flash.alert = new_procedure.errors.full_messages
|
||||
|
|
5
app/javascript/entrypoints/application.css
Normal file
5
app/javascript/entrypoints/application.css
Normal file
|
@ -0,0 +1,5 @@
|
|||
@import '@gouvfr/dsfr/dist/core/core.css';
|
||||
@import '@gouvfr/dsfr/dist/component/button/button.css';
|
||||
@import '@gouvfr/dsfr/dist/component/alert/alert.css';
|
||||
@import '@gouvfr/dsfr/dist/component/callout/callout.css';
|
||||
@import '@gouvfr/dsfr/dist/component/table/table.css';
|
|
@ -2,6 +2,7 @@ import Rails from '@rails/ujs';
|
|||
import * as ActiveStorage from '@rails/activestorage';
|
||||
import * as Turbo from '@hotwired/turbo';
|
||||
import { Application } from '@hotwired/stimulus';
|
||||
import '@gouvfr/dsfr/dist/dsfr.module.js';
|
||||
|
||||
import '../shared/activestorage/ujs';
|
||||
import '../shared/remote-poller';
|
||||
|
|
|
@ -486,6 +486,10 @@ class Procedure < ApplicationRecord
|
|||
procedure.published_at = nil
|
||||
procedure.auto_archive_on = nil
|
||||
procedure.lien_notice = nil
|
||||
procedure.duree_conservation_etendue_par_ds = false
|
||||
if procedure.duree_conservation_dossiers_dans_ds > NEW_MAX_DUREE_CONSERVATION
|
||||
procedure.duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION
|
||||
end
|
||||
procedure.published_revision = nil
|
||||
procedure.draft_revision.procedure = procedure
|
||||
|
||||
|
@ -510,12 +514,7 @@ class Procedure < ApplicationRecord
|
|||
procedure.parent_procedure = self
|
||||
procedure.canonical_procedure = nil
|
||||
procedure.replaced_by_procedure = nil
|
||||
|
||||
if from_library
|
||||
procedure.service = nil
|
||||
elsif self.service.present? && is_different_admin
|
||||
procedure.service = self.service.clone_and_assign_to_administrateur(admin)
|
||||
end
|
||||
procedure.service = nil
|
||||
|
||||
transaction do
|
||||
procedure.save
|
||||
|
|
|
@ -1,60 +1,67 @@
|
|||
= form_with model: [ :admin, service], local: true, html: { class: 'form' } do |f|
|
||||
|
||||
= f.label :nom do
|
||||
Nom
|
||||
Nom du service
|
||||
%span.mandatory *
|
||||
|
||||
%p.notice Indiquez le nom et la direction rattachée séparé par une virgule
|
||||
|
||||
= f.text_field :nom, placeholder: 'service jeunesse et prévention, direction des affaires maritimes', required: true
|
||||
|
||||
= f.label :organisme do
|
||||
Organisme
|
||||
Organisme/s
|
||||
%span.mandatory *
|
||||
%p.notice Indiquez les organismes depuis l’échelon territoriale jusqu’au ministère séparés par une virgule
|
||||
= f.text_field :organisme, placeholder: "mairie de Mours, préfecture de l'Oise, ministère de la Culture", required: true
|
||||
|
||||
= f.label :type_organisme do
|
||||
Type d’organisme
|
||||
%span.mandatory *
|
||||
|
||||
= f.select :type_organisme, Service.type_organismes.keys.map { |key| [ I18n.t("type_organisme.#{key}"), key] }
|
||||
= f.select :type_organisme, Service.type_organismes.keys.map { |key| [ I18n.t("type_organisme.#{key}"), key] }, class: 'width-33-desktop width-100-mobile'
|
||||
|
||||
%h2.header-section Informations de contact
|
||||
|
||||
%p.explication
|
||||
Votre démarche sera hébergée par #{APPLICATION_NAME} – mais nous ne pouvons pas assurer le support des démarches. Et malgré la dématérialisation, les usagers se poseront parfois des questions légitimes sur le processus administratif.
|
||||
%br
|
||||
%br
|
||||
%strong Il est donc indispensable que les usagers puissent vous contacter
|
||||
par le moyen de leur choix s’ils ont des questions sur votre démarche.
|
||||
%br
|
||||
%br
|
||||
Ces informations de contact seront visibles par les utilisateurs de la démarche, affichées dans le menu « Aide », ainsi qu’en pied de page lors du dépôt d’un dossier. En cas d’informations invalides, #{APPLICATION_NAME} se réserve le droit de suspendre la publication de la démarche.
|
||||
= render Dsfr::CalloutComponent.new(title: "Informations de contact") do |c|
|
||||
- c.body do
|
||||
Votre démarche sera hébergée par #{APPLICATION_NAME} – mais nous ne pouvons pas assurer le support des démarches. Et malgré la dématérialisation, les usagers se poseront parfois des questions légitimes sur le processus administratif.
|
||||
%br
|
||||
%br
|
||||
%strong Il est donc indispensable que les usagers puissent vous contacter
|
||||
par le moyen de leur choix s’ils ont des questions sur votre démarche.
|
||||
%br
|
||||
%br
|
||||
Ces informations de contact seront visibles par les utilisateurs de la démarche, affichées dans le menu « Aide », ainsi qu’en pied de page lors du dépôt d’un dossier. En cas d’informations invalides, #{APPLICATION_NAME} se réserve le droit de suspendre la publication de la démarche.
|
||||
|
||||
= f.label :email do
|
||||
Adresse email
|
||||
%span.mandatory *
|
||||
%p.explication
|
||||
Indiquez une adresse email <strong>valide</strong> qui permettra de recevoir et de réponse aux questions des usagers.
|
||||
|
||||
= f.email_field :email, placeholder: 'contact@mon-service.fr', required: true
|
||||
%p.notice
|
||||
Indiquez une adresse Email valide qui permettra de recevoir et de répondre aux questions des usagers.
|
||||
|
||||
= f.email_field :email, placeholder: 'contact@mon-service.fr', required: true, class: 'width-33-desktop width-100-mobile'
|
||||
|
||||
= f.label :telephone do
|
||||
Numéro de téléphone
|
||||
%span.mandatory *
|
||||
%p.explication Indiquez le numéro de téléphone du service <strong>valide</strong> le plus à même de fournir des réponses pertinentes à vos usagers aux horaires où vous êtes joignables.
|
||||
= f.telephone_field :telephone, placeholder: '04 12 24 42 37', required: true
|
||||
%p.notice Indiquez le numéro de téléphone du service valide le plus à même de fournir des réponses pertinentes à vos usagers
|
||||
= f.telephone_field :telephone, placeholder: '04 12 24 42 37', required: true, class: 'width-33-desktop width-100-mobile'
|
||||
|
||||
= f.label :horaires do
|
||||
Horaires
|
||||
%span.mandatory *
|
||||
%p.explication Indiquez les horaires où les usagers peuvent vous joindre.
|
||||
= f.text_area :horaires, placeholder: "Du lundi au vendredi de 9 h 30 à 17 h 30. Le samedi de 9 h 30 à 12 h.", required: true
|
||||
%p.notice Indiquez les jours ouvrables et les horaires où les usagers peuvent vous joindre
|
||||
= f.text_area :horaires, placeholder: "Du lundi au vendredi de 9 h 30 à 17 h 30. Le samedi de 9 h 30 à 12 h.", required: true, class: 'width-66-desktop width-100-mobile'
|
||||
|
||||
= f.label :adresse do
|
||||
Adresse postale
|
||||
%span.mandatory *
|
||||
= f.text_area :adresse, placeholder: "20 avenue de Ségur, 75007 Paris", required: true
|
||||
= f.text_area :adresse, placeholder: "20 avenue de Ségur, 75007 Paris", required: true, class: 'width-66-desktop width-100-mobile'
|
||||
|
||||
- if procedure_id.present?
|
||||
= hidden_field_tag :procedure_id, procedure_id
|
||||
|
||||
.send-wrapper
|
||||
= f.submit "Enregistrer", class: 'button primary send'
|
||||
.send-wrapper.justify-content--space-between.send-wrapper--with-border-top.my-0.py-3
|
||||
= render Dsfr::ButtonComponent.new(label: "Annuler et revenir à la page de suivi", url: admin_procedure_path(id: @procedure.id), class_names: ['fr-btn--secondary'])
|
||||
= render Dsfr::ButtonComponent.new(form: f, label: "Enregistrer", class_names: [''])
|
||||
|
||||
|
|
|
@ -4,8 +4,22 @@
|
|||
link_to('Choix du service', admin_services_path(procedure_id: @procedure.id)),
|
||||
'Modifier le service'] }
|
||||
|
||||
|
||||
.container
|
||||
%h1 Modifier le service
|
||||
- other_services = @service.procedures.reject {|procedure| procedure.id == @procedure.id }
|
||||
- if other_services.count > 1
|
||||
= render Dsfr::AlertComponent.new(state: :warning, title: "Modifier ce service impactera la ou les démarches qui sont rattachée/s") do |c|
|
||||
- c.body do
|
||||
%ul
|
||||
- other_services.each do |proc|
|
||||
%li= "#{proc.libelle} (N° #{proc.id})"
|
||||
%p.mt-3 Si vous souhaitez modifier uniquement les informations pour ce service, créez un nouveau service puis associez-le à la démarche
|
||||
|
||||
%p.mt-3
|
||||
= link_to "+ Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn"
|
||||
|
||||
|
||||
%h1.mt-2 Modifier le service
|
||||
|
||||
= render partial: 'form',
|
||||
locals: { service: @service, procedure_id: @procedure.id }
|
||||
|
|
|
@ -4,27 +4,16 @@
|
|||
'Choix du service'] }
|
||||
|
||||
#services-index.container
|
||||
%h1 Choix du service pour la démarche
|
||||
|
||||
= form_for @procedure, url: { controller: "administrateurs/services", action: :add_to_procedure } , html: { class: 'form' } do |f|
|
||||
= f.label :service_id, "La démarche #{@procedure.libelle} est affectée au service"
|
||||
= f.select :service_id,
|
||||
@services.map { |s| [ s.nom, s.id ] },
|
||||
{ prompt: 'choisir un service', selected: @procedure.service&.id },
|
||||
required: true
|
||||
|
||||
= f.hidden_field :id
|
||||
= f.submit 'valider', class: 'button primary'
|
||||
|
||||
%h1 Liste des Services
|
||||
|
||||
%table.table.table-service.hoverable
|
||||
%table.fr-table.width-100.mt-3
|
||||
%caption La démarche “#{@procedure.libelle}” peut être affectée aux services dans la liste ci-dessous
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
nom
|
||||
%th.change
|
||||
= link_to('Nouveau service', new_admin_service_path(procedure_id: @procedure.id), class: 'button')
|
||||
%th{ scope: "col" }
|
||||
Nom
|
||||
%th.change{ scope: "col" }
|
||||
= render Dsfr::ButtonComponent.new(label: "Nouveau service", url: new_admin_service_path(procedure_id: @procedure.id), class_names: ['fr-btn--secondary'])
|
||||
|
||||
%tbody
|
||||
- @services.each do |service|
|
||||
|
@ -32,8 +21,14 @@
|
|||
%td
|
||||
= service.nom
|
||||
%td.change
|
||||
= link_to('modifier', edit_admin_service_path(service, procedure_id: @procedure.id))
|
||||
= link_to 'supprimer',
|
||||
admin_service_path(service, procedure_id: @procedure.id),
|
||||
method: :delete,
|
||||
data: { confirm: "Confirmez vous la suppression de #{service.nom}" }
|
||||
- if @procedure.service == service
|
||||
%strong.mr-2 (Assigné)
|
||||
- else
|
||||
= button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'link mr-2', form_class: 'inline'
|
||||
= link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2')
|
||||
- if @procedure.service != service
|
||||
= link_to 'Supprimer',
|
||||
admin_service_path(service, procedure_id: @procedure.id),
|
||||
method: :delete,
|
||||
data: { confirm: "Confirmez vous la suppression de #{service.nom}" },
|
||||
class: 'btn btn-link ml-2'
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
= vite_legacy_javascript_tag 'track-admin'
|
||||
= vite_legacy_fallback_tag
|
||||
|
||||
= preload_link_tag(asset_url("Muli-Regular.woff2"))
|
||||
= preload_link_tag(asset_url("Muli-Bold.woff2"))
|
||||
= preload_link_tag(asset_url("Marianne-Regular.woff2"))
|
||||
= preload_link_tag(asset_url("Spectral-Regular.ttf"))
|
||||
|
||||
= vite_stylesheet_tag 'application', media: 'all'
|
||||
= stylesheet_link_tag 'application', media: 'all'
|
||||
|
||||
%body{ id: content_for(:page_id), class: browser.platform.ios? ? 'ios' : nil }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@gouvfr/dsfr": "^1.7.2",
|
||||
"@headlessui/react": "^1.6.6",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@hotwired/stimulus": "^3.1.0",
|
||||
|
@ -57,6 +58,7 @@
|
|||
"@vitejs/plugin-legacy": "^1.2.3",
|
||||
"@vitejs/plugin-react": "^1.1.4",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.0",
|
||||
"autoprefixer": "^10.4.8",
|
||||
"axe-core": "^4.4.2",
|
||||
"del-cli": "^4.0.1",
|
||||
"eslint": "^8.19.0",
|
||||
|
@ -65,6 +67,7 @@
|
|||
"eslint-plugin-react": "^7.30.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jsdom": "^20.0.0",
|
||||
"postcss": "^8.4.14",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "^4.7.4",
|
||||
"vite": "^2.9.13",
|
||||
|
|
5
postcss.config.js
Normal file
5
postcss.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {}
|
||||
}
|
||||
};
|
|
@ -332,11 +332,11 @@ describe Administrateurs::ProceduresController, type: :controller do
|
|||
before { subject }
|
||||
|
||||
it 'creates a new procedure and redirect to it' do
|
||||
expect(response).to redirect_to edit_admin_procedure_path(id: Procedure.last.id)
|
||||
expect(response).to redirect_to admin_procedure_path(id: Procedure.last.id)
|
||||
expect(Procedure.last.cloned_from_library).to be_falsey
|
||||
expect(Procedure.last.notice.attached?).to be_truthy
|
||||
expect(Procedure.last.deliberation.attached?).to be_truthy
|
||||
expect(flash[:notice]).to have_content 'Démarche clonée'
|
||||
expect(flash[:notice]).to have_content 'Démarche clonée, pensez a vérifier la Présentation et choisir le service a laquelle cette procédure est associé.'
|
||||
end
|
||||
|
||||
context 'when the procedure is cloned from the library' do
|
||||
|
@ -356,8 +356,8 @@ describe Administrateurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
it 'creates a new procedure and redirect to it' do
|
||||
expect(response).to redirect_to edit_admin_procedure_path(id: Procedure.last.id)
|
||||
expect(flash[:notice]).to have_content 'Démarche clonée'
|
||||
expect(response).to redirect_to admin_procedure_path(id: Procedure.last.id)
|
||||
expect(flash[:notice]).to have_content 'Démarche clonée, pensez a vérifier la Présentation et choisir le service a laquelle cette procédure est associé.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -447,6 +447,8 @@ describe Procedure do
|
|||
received_mail: received_mail,
|
||||
service: service,
|
||||
opendata: opendata,
|
||||
duree_conservation_etendue_par_ds: true,
|
||||
duree_conservation_dossiers_dans_ds: Procedure::OLD_MAX_DUREE_CONSERVATION,
|
||||
attestation_template: build(:attestation_template, logo: logo, signature: signature),
|
||||
types_de_champ_public: [{}, {}, { type: :drop_down_list }, { type: :piece_justificative }, { type: :repetition, children: [{}] }],
|
||||
types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }],
|
||||
|
@ -489,6 +491,11 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
it 'should reset duree_conservation_etendue_par_ds' do
|
||||
expect(subject.duree_conservation_etendue_par_ds).to eq(false)
|
||||
expect(subject.duree_conservation_dossiers_dans_ds).to eq(Procedure::NEW_MAX_DUREE_CONSERVATION)
|
||||
end
|
||||
|
||||
it 'should duplicate specific objects with different id' do
|
||||
expect(subject.id).not_to eq(procedure.id)
|
||||
|
||||
|
@ -525,7 +532,7 @@ describe Procedure do
|
|||
|
||||
cloned_procedure = subject
|
||||
cloned_procedure.parent_procedure_id = nil
|
||||
expect(cloned_procedure).to have_same_attributes_as(procedure, except: ["path", "draft_revision_id"])
|
||||
expect(cloned_procedure).to have_same_attributes_as(procedure, except: ["path", "draft_revision_id", "service_id", "duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds"])
|
||||
end
|
||||
|
||||
context 'which is opendata' do
|
||||
|
@ -569,18 +576,16 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
it 'should keep service_id' do
|
||||
expect(subject.service).to eq(service)
|
||||
it 'should skips service_id' do
|
||||
expect(subject.service).to eq(nil)
|
||||
end
|
||||
|
||||
context 'when the procedure is cloned to another administrateur' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let(:opendata) { false }
|
||||
|
||||
it 'should clone service' do
|
||||
expect(subject.service.id).not_to eq(service.id)
|
||||
expect(subject.service.administrateur_id).not_to eq(service.administrateur_id)
|
||||
expect(subject.service.attributes.except("id", "administrateur_id", "created_at", "updated_at")).to eq(service.attributes.except("id", "administrateur_id", "created_at", "updated_at"))
|
||||
it 'should not clone service' do
|
||||
expect(subject.service).to eq(nil)
|
||||
end
|
||||
|
||||
it 'should discard old pj information' do
|
||||
|
|
|
@ -23,8 +23,13 @@ describe 'As an administrateur I wanna clone a procedure', js: true do
|
|||
visit admin_procedures_path(statut: "brouillons")
|
||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
||||
click_on Procedure.last.libelle
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
expect(page).to have_current_path(admin_procedure_path(id: Procedure.last))
|
||||
|
||||
# select service
|
||||
find("#service .button").click
|
||||
click_on "Assigner"
|
||||
|
||||
# then publish
|
||||
find('#publish-procedure-link').click
|
||||
expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'
|
||||
fill_in 'lien_site_web', with: 'http://some.website'
|
||||
|
|
74
yarn.lock
74
yarn.lock
|
@ -329,6 +329,11 @@
|
|||
minimatch "^3.1.2"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
"@gouvfr/dsfr@^1.7.2":
|
||||
version "1.7.2"
|
||||
resolved "https://registry.yarnpkg.com/@gouvfr/dsfr/-/dsfr-1.7.2.tgz#c522fce21a14989a10e30583160118c39c9c05d1"
|
||||
integrity sha512-hPNtz+gHcc8m7ZPANxSOFMz4Ap+M9FHOudqoMR/+Kjl5FCOqwA6u/aoYnMJ8KqedS1k5XThFMp7jiktr53qXYw==
|
||||
|
||||
"@headlessui/react@^1.6.6":
|
||||
version "1.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.6.6.tgz#3073c066b85535c9d28783da0a4d9288b5354d0c"
|
||||
|
@ -1097,6 +1102,18 @@ asynckit@^0.4.0:
|
|||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
|
||||
|
||||
autoprefixer@^10.4.8:
|
||||
version "10.4.8"
|
||||
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.8.tgz#92c7a0199e1cfb2ad5d9427bd585a3d75895b9e5"
|
||||
integrity sha512-75Jr6Q/XpTqEf6D2ltS5uMewJIx5irCU1oBYJrWjFenq/m12WRRrz6g15L1EIoYvPLXTbEry7rDOwrcYNj77xw==
|
||||
dependencies:
|
||||
browserslist "^4.21.3"
|
||||
caniuse-lite "^1.0.30001373"
|
||||
fraction.js "^4.2.0"
|
||||
normalize-range "^0.1.2"
|
||||
picocolors "^1.0.0"
|
||||
postcss-value-parser "^4.2.0"
|
||||
|
||||
aws-sign2@~0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
|
||||
|
@ -1179,6 +1196,16 @@ browserslist@^4.20.2:
|
|||
node-releases "^2.0.5"
|
||||
picocolors "^1.0.0"
|
||||
|
||||
browserslist@^4.21.3:
|
||||
version "4.21.3"
|
||||
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.3.tgz#5df277694eb3c48bc5c4b05af3e8b7e09c5a6d1a"
|
||||
integrity sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==
|
||||
dependencies:
|
||||
caniuse-lite "^1.0.30001370"
|
||||
electron-to-chromium "^1.4.202"
|
||||
node-releases "^2.0.6"
|
||||
update-browserslist-db "^1.0.5"
|
||||
|
||||
call-bind@^1.0.0, call-bind@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
|
||||
|
@ -1212,6 +1239,11 @@ caniuse-lite@^1.0.30001349:
|
|||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001355.tgz#e240b7177443ed0198c737a7f609536976701c77"
|
||||
integrity sha512-Sd6pjJHF27LzCB7pT7qs+kuX2ndurzCzkpJl6Qct7LPSZ9jn0bkOA8mdgMgmqnQAWLVOOGjLpc+66V57eLtb1g==
|
||||
|
||||
caniuse-lite@^1.0.30001370, caniuse-lite@^1.0.30001373:
|
||||
version "1.0.30001385"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001385.tgz#51d5feeb60b831a5b4c7177f419732060418535c"
|
||||
integrity sha512-MpiCqJGhBkHgpyimE9GWmZTnyHyEEM35u115bD3QBrXpjvL/JgcP8cUhKJshfmg4OtEHFenifcK5sZayEw5tvQ==
|
||||
|
||||
caseless@~0.12.0:
|
||||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
|
||||
|
@ -1564,6 +1596,11 @@ electron-to-chromium@^1.4.147:
|
|||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.160.tgz#da54e24fddeaca52f37965c7bec1bd964c97d487"
|
||||
integrity sha512-O1Z12YfyeX2LXYO7MdHIPazGXzLzQnr1ADW55U2ARQsJBPgfpJz3u+g3Mo2l1wSyfOCdiGqaX9qtV4XKZ0HNRA==
|
||||
|
||||
electron-to-chromium@^1.4.202:
|
||||
version "1.4.235"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.235.tgz#48ac33c4e869a1795013788099470061463d1890"
|
||||
integrity sha512-eNU2SmVZYTzYVA5aAWmhAJbdVil5/8H5nMq6kGD0Yxd4k2uKIuT8YmS46I0QXY7iOoPPcb6jjem9/2xyuH5+XQ==
|
||||
|
||||
element-closest@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/element-closest/-/element-closest-2.0.2.tgz#72a740a107453382e28df9ce5dbb5a8df0f966ec"
|
||||
|
@ -2103,6 +2140,11 @@ form-data@~2.3.2:
|
|||
combined-stream "^1.0.6"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
fraction.js@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950"
|
||||
integrity sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==
|
||||
|
||||
fs-extra@^0.30.0:
|
||||
version "0.30.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0"
|
||||
|
@ -3089,6 +3131,11 @@ node-releases@^2.0.5:
|
|||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666"
|
||||
integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q==
|
||||
|
||||
node-releases@^2.0.6:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503"
|
||||
integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==
|
||||
|
||||
normalize-package-data@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e"
|
||||
|
@ -3099,6 +3146,11 @@ normalize-package-data@^3.0.2:
|
|||
semver "^7.3.4"
|
||||
validate-npm-package-license "^3.0.1"
|
||||
|
||||
normalize-range@^0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942"
|
||||
integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==
|
||||
|
||||
nwsapi@^2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.1.tgz#10a9f268fbf4c461249ebcfe38e359aa36e2577c"
|
||||
|
@ -3350,6 +3402,11 @@ picomatch@^2.3.1:
|
|||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
postcss-value-parser@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
|
||||
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==
|
||||
|
||||
postcss@^8.4.13:
|
||||
version "8.4.14"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf"
|
||||
|
@ -3359,6 +3416,15 @@ postcss@^8.4.13:
|
|||
picocolors "^1.0.0"
|
||||
source-map-js "^1.0.2"
|
||||
|
||||
postcss@^8.4.14:
|
||||
version "8.4.16"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c"
|
||||
integrity sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==
|
||||
dependencies:
|
||||
nanoid "^3.3.4"
|
||||
picocolors "^1.0.0"
|
||||
source-map-js "^1.0.2"
|
||||
|
||||
potpack@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/potpack/-/potpack-1.0.2.tgz#23b99e64eb74f5741ffe7656b5b5c4ddce8dfc14"
|
||||
|
@ -4137,6 +4203,14 @@ unload@2.2.0:
|
|||
"@babel/runtime" "^7.6.2"
|
||||
detect-node "^2.0.4"
|
||||
|
||||
update-browserslist-db@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz#be06a5eedd62f107b7c19eb5bcefb194411abf38"
|
||||
integrity sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==
|
||||
dependencies:
|
||||
escalade "^3.1.1"
|
||||
picocolors "^1.0.0"
|
||||
|
||||
uri-js@^4.2.2:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
|
||||
|
|
Loading…
Reference in a new issue