diff --git a/.scss-lint.yml b/.scss-lint.yml index 45ead4f7b..308771f17 100644 --- a/.scss-lint.yml +++ b/.scss-lint.yml @@ -132,7 +132,8 @@ linters: PropertySpelling: enabled: true - extra_properties: [] + extra_properties: + - scroll-padding disabled_properties: [] # To enable later diff --git a/app/assets/stylesheets/new_design/card.scss b/app/assets/stylesheets/new_design/card.scss index 5506635af..c73875b2e 100644 --- a/app/assets/stylesheets/new_design/card.scss +++ b/app/assets/stylesheets/new_design/card.scss @@ -7,6 +7,13 @@ margin-bottom: $default-spacer * 2; background: #FFFFFF; + .notice { + font-size: 16px; + color: #666666; + margin-top: -8px; + margin-bottom: 16px; + } + .card-title { font-weight: bold; font-size: 20px; diff --git a/app/assets/stylesheets/new_design/helpers.scss b/app/assets/stylesheets/new_design/helpers.scss index f8f0f71bf..e82b9d548 100644 --- a/app/assets/stylesheets/new_design/helpers.scss +++ b/app/assets/stylesheets/new_design/helpers.scss @@ -12,6 +12,14 @@ margin-bottom: 4 * $default-spacer; } +.ml-1 { + margin-left: $default-spacer; +} + +.pl-0 { + padding-left: 0px !important; +} + .numbers-delimiter { display: inline-block; width: 5px; diff --git a/app/assets/stylesheets/new_design/layouts.scss b/app/assets/stylesheets/new_design/layouts.scss index de4c71231..ec76a8106 100644 --- a/app/assets/stylesheets/new_design/layouts.scss +++ b/app/assets/stylesheets/new_design/layouts.scss @@ -69,3 +69,6 @@ bottom: 0; } +html.scroll-margins-for-sticky-footer { + scroll-padding: 0 0 100px 0; +} diff --git a/app/assets/stylesheets/new_design/procedure_admin.scss b/app/assets/stylesheets/new_design/procedure_admin.scss index 28a3764cb..0227b3772 100644 --- a/app/assets/stylesheets/new_design/procedure_admin.scss +++ b/app/assets/stylesheets/new_design/procedure_admin.scss @@ -14,6 +14,23 @@ } } +.procedure-admin-listing-container { + display: flex; + justify-content: flex-end; + padding-left: 16px; + padding-right: 16px; + max-width: 1072px; + margin-left: auto; + margin-right: auto; + margin-top: 10px; +} + +.container { + a { + cursor: pointer; + } +} + .procedure-admin-explanation { font-weight: bold; font-size: 20px; diff --git a/app/assets/stylesheets/new_design/toggle-switch.scss b/app/assets/stylesheets/new_design/toggle-switch.scss new file mode 100644 index 000000000..8b410511b --- /dev/null +++ b/app/assets/stylesheets/new_design/toggle-switch.scss @@ -0,0 +1,89 @@ +@import "colors"; +@import "constants"; + +// Toggle-switch +// The switch - the box around +.form label.toggle-switch { + position: relative; + display: inline-block; + height: 24px; + margin: 0; + margin-right: 15px; +} + +// Hide default HTML checkbox +.form label.toggle-switch input[type="checkbox"] { + opacity: 0; + width: 0; + height: 0; + margin: 0; +} + +// The control +.toggle-switch-control { + position: absolute; + width: 47px; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: $border-grey; + transition: 0.4s; + border: 1px solid transparent; +} + +.toggle-switch-control::before { + position: absolute; + content: ""; + height: 20px; + width: 20px; + left: 1px; + bottom: 1px; + background-color: $white; + transition: 0.4s; +} + +input:checked + .toggle-switch-control { + background-color: $green; +} + +input:focus + .toggle-switch-control { + border-color: $blue; + box-shadow: 0px 0px 2px 1px $blue; +} + +input:checked + .toggle-switch-control::before { + transform: translateX(23px); +} + +.toggle-switch-label { + margin-left: 47px; + font-size: 16px; + font-weight: normal; +} + +.toggle-switch-label.on { + color: $green; +} + +.toggle-switch-label.off { + color: $grey; +} + +.toggle-switch-checkbox:checked ~ .toggle-switch-label.off { + display: none; +} + +.toggle-switch-checkbox:not(:checked) ~ .toggle-switch-label.on { + display: none; +} + +// Rounded control +.toggle-switch-control.round { + border-radius: 24px; +} + +.toggle-switch-control.round::before { + border-radius: 50%; +} diff --git a/app/controllers/new_administrateur/procedures_controller.rb b/app/controllers/new_administrateur/procedures_controller.rb index d8f5fbbc5..70e0bbf9f 100644 --- a/app/controllers/new_administrateur/procedures_controller.rb +++ b/app/controllers/new_administrateur/procedures_controller.rb @@ -3,6 +3,46 @@ module NewAdministrateur before_action :retrieve_procedure, only: [:champs, :annotations, :edit, :monavis, :update_monavis, :jeton, :update_jeton] before_action :procedure_locked?, only: [:champs, :annotations] + ITEMS_PER_PAGE = 25 + + def index + @procedures_publiees = paginated_published_procedures + @procedures_draft = paginated_draft_procedures + @procedures_closed = paginated_closed_procedures + @procedures_publiees_count = current_administrateur.procedures.publiees.count + @procedures_draft_count = current_administrateur.procedures.brouillons.count + @procedures_closed_count = current_administrateur.procedures.closes.count + @statut = params[:statut] + @statut.blank? ? @statut = 'publiees' : @statut = params[:statut] + end + + def paginated_published_procedures + current_administrateur + .procedures + .publiees + .page(params[:page]) + .per(ITEMS_PER_PAGE) + .order(published_at: :desc) + end + + def paginated_draft_procedures + current_administrateur + .procedures + .brouillons + .page(params[:page]) + .per(ITEMS_PER_PAGE) + .order(created_at: :desc) + end + + def paginated_closed_procedures + current_administrateur + .procedures + .closes + .page(params[:page]) + .per(ITEMS_PER_PAGE) + .order(created_at: :desc) + end + def apercu @dossier = procedure_without_control.new_dossier @tab = apercu_tab @@ -56,6 +96,19 @@ module NewAdministrateur end end + def destroy + procedure = current_administrateur.procedures.find(params[:id]) + + if procedure.can_be_deleted_by_administrateur? + procedure.discard_and_keep_track!(current_administrateur) + + flash.notice = 'Démarche supprimée' + redirect_to admin_procedures_draft_path + else + render json: {}, status: 403 + end + end + def monavis end diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 760c739df..4d70660eb 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -264,6 +264,11 @@ type Demarche { """ after: String + """ + Si présent, permet de filtrer les dossiers archivés ou non + """ + archived: Boolean + """ Returns the elements in the list that come before the specified cursor. """ diff --git a/app/graphql/types/demarche_type.rb b/app/graphql/types/demarche_type.rb index 3206b06d7..ddfad6eb2 100644 --- a/app/graphql/types/demarche_type.rb +++ b/app/graphql/types/demarche_type.rb @@ -37,6 +37,7 @@ module Types argument :created_since, GraphQL::Types::ISO8601DateTime, required: false, description: "Dossiers déposés depuis la date." argument :updated_since, GraphQL::Types::ISO8601DateTime, required: false, description: "Dossiers mis à jour depuis la date." argument :state, Types::DossierType::DossierState, required: false, description: "Dossiers avec statut." + argument :archived, Boolean, required: false, description: "Si présent, permet de filtrer les dossiers archivés ou non" end field :champ_descriptors, [Types::ChampDescriptorType], null: false, method: :types_de_champ @@ -54,13 +55,17 @@ module Types Loaders::Record.for(Service).load(object.service_id) end - def dossiers(updated_since: nil, created_since: nil, state: nil, order:) + def dossiers(updated_since: nil, created_since: nil, state: nil, archived: nil, order:) dossiers = object.dossiers.state_not_brouillon.for_api_v2 if state.present? dossiers = dossiers.where(state: state) end + if !archived.nil? + dossiers = dossiers.where(archived: archived) + end + if updated_since.present? dossiers = dossiers.updated_since(updated_since).order_by_updated_at(order) else diff --git a/app/helpers/dossier_helper.rb b/app/helpers/dossier_helper.rb index a06c69524..af6fb5f20 100644 --- a/app/helpers/dossier_helper.rb +++ b/app/helpers/dossier_helper.rb @@ -72,19 +72,6 @@ module DossierHelper end end - # On the 22/01/2020, a technical error on the demarches-simplifees.fr - # instance caused some files attached to some dossiers to be deleted. - # - # This method returns true if the dossier contained attachments - # whose files were deleted during this incident. - def has_lost_attachments(dossier) - if dinum_instance? - dossiers_with_lost_attachments_ids.include?(dossier.id) - else - false - end - end - def status_badge(state) status_text = dossier_display_state(state, lower: true) status_class = state.tr('_', '-') @@ -114,16 +101,4 @@ module DossierHelper end end end - - private - - def dinum_instance? - # rubocop:disable DS/ApplicationName - ENV['APP_HOST']&.ends_with?('demarches-simplifiees.fr') - # rubocop:enable DS/ApplicationName - end - - def dossiers_with_lost_attachments_ids - @@ids ||= YAML.load_file(Rails.root.join('config', 'dossiers-with-lost-attachments.yml')) - end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 8819462f4..44c35085d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,5 +1,5 @@ !!! 5 -%html{ lang: "fr" } +%html{ lang: "fr", class: yield(:root_class) } %head %meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" } %meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" } diff --git a/app/views/layouts/mailers/notifications_layout.html.erb b/app/views/layouts/mailers/notifications_layout.html.erb index 802ad599f..cd765cd67 100644 --- a/app/views/layouts/mailers/notifications_layout.html.erb +++ b/app/views/layouts/mailers/notifications_layout.html.erb @@ -145,7 +145,7 @@
- #{APPLICATION_NAME} est un service fourni par la DINUM et incubé par beta.gouv.fr + <%= "#{APPLICATION_NAME}" %> est un service fourni par la DINUM et incubé par beta.gouv.fr
diff --git a/app/views/new_administrateur/attestation_templates/edit.html.haml b/app/views/new_administrateur/attestation_templates/edit.html.haml new file mode 100644 index 000000000..9c4651fa9 --- /dev/null +++ b/app/views/new_administrateur/attestation_templates/edit.html.haml @@ -0,0 +1,56 @@ +- content_for(:root_class, 'scroll-margins-for-sticky-footer') + += render partial: 'new_administrateur/breadcrumbs', + locals: { steps: [link_to('Démarches', admin_procedures_path), + link_to(@procedure.libelle, admin_procedure_path(@procedure)), + 'Attestation'] } + +.procedure-form#attestation-template-edit + .procedure-form__columns.container + = form_for @attestation_template, + url: url_for({ controller: 'new_administrateur/attestation_templates', action: :update, id: @procedure.id }), + multipart: true, + html: { class: 'form procedure-form__column--form' } do |f| + + %h1.page-title + Délivrance d‘attestation + - if @attestation_template.activated? + %span.text-active activée + - else + %span.text-inactive désactivée + + - if @attestation_template.activated && @procedure.locked? + .card.warning + %p L’attestation ne peut plus être désactivée car la démarche est publiée. + + %p.notice + L’attestation, si elle est activée, est émise au moment où un dossier est accepté. + %br + L’email d’accusé d’acceptation envoyé à l’usager comporte alors un lien vers l’attestation ; + celle-ci est également disponible au téléchargement depuis l’espace personnel de l’usager. + + = render partial: 'new_administrateur/attestation_templates/informations', locals: { f: f } + + .procedure-form__actions.sticky--bottom + .actions-left + -# Admins cannot disactivate the Attestation if it is activated and the procedure is published + - if !(@attestation_template.activated && @procedure.locked?) + %label.toggle-switch + = f.check_box :activated, class: 'toggle-switch-checkbox' + %span.toggle-switch-control.round + %span.toggle-switch-label.on Attestation activée + %span.toggle-switch-label.off Attestation désactivée + + .actions-right + = link_to 'Annuler', edit_admin_procedure_attestation_template_path(id: @procedure), class: 'button', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'} + = f.button 'Enregistrer', class: 'button primary send' + + .procedure-form__column--preview + .procedure-form__preview.sticky--top + %h3 + .procedure-form__preview-title + Aperçu + .notice + Cet aperçu est mis à jour après chaque sauvegarde. + .procedure-preview + = render partial: 'new_administrateur/attestation_templates/apercu', locals: { procedure: @procedure } diff --git a/app/views/new_administrateur/procedures/_procedures_list.html.haml b/app/views/new_administrateur/procedures/_procedures_list.html.haml new file mode 100644 index 000000000..cfbfaad03 --- /dev/null +++ b/app/views/new_administrateur/procedures/_procedures_list.html.haml @@ -0,0 +1,73 @@ +- procedures.each do |procedure| + .card + .flex.justify-between + .flex + - if procedure.logo.present? + = image_tag procedure.logo, alt: procedure.libelle, width: '100' + .flex.column.ml-1 + .card-title + = link_to procedure.libelle, admin_procedure_path(procedure), style: 'color: black;' + = link_to(procedure_lien(procedure), procedure_lien(procedure), class: 'procedure-lien mb-1') + + %div + %p.notice N° #{procedure.id} + %p.notice créée le #{procedure.created_at.strftime('%d/%m/%Y')} + - if procedure.published_at.present? + %p.notice publiée le #{procedure.published_at.strftime('%d/%m/%Y')} + - if procedure.closed_at.present? + %p.notice archivée le #{procedure.closed_at.strftime('%d/%m/%Y')} + + .flex.justify-between + %div + - if feature_enabled?(:administrateur_routage) + %span.icon.person + %span.badge.baseline= procedure.groupe_instructeurs.count + - else + %span.icon.person + %span.badge.baseline= procedure.instructeurs.count + + %span.icon.folder + %span.badge.baseline= procedure.dossiers.count + + %div + = link_to admin_procedure_path(procedure), class: 'button mr-1 edit-procedure' do + %span.icon.edit + Modifier + .dropdown + .button.dropdown-button.procedures-actions-btn + Actions + .dropdown-content.fade-in-down + %ul.dropdown-items.pl-0 + - if !procedure.close? + %li + = link_to sanitize_url(procedure.brouillon? ? commencer_test_url(path: procedure.path) : commencer_url(path: procedure.path)), target: :blank, rel: :noopener do + %span.icon.in-progress + .dropdown-description + %h4 Tester + %li + = link_to admin_procedure_clone_path(procedure.id), class: 'clone-btn', data: { method: :put } do + %span.icon.new-folder + .dropdown-description + %h4 Cloner + + - if procedure.publiee? + %li + = link_to admin_procedure_archive_path(procedure_id: procedure.id), method: :put, data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} do + %span.icon.archive + .dropdown-description + %h4 Clore + + - if procedure.brouillon? + %li + = link_to admin_procedure_path(procedure), method: :delete, data: { confirm: "Voulez-vous vraiment supprimer la démarche ? \nToute suppression est définitive et s'appliquera aux éventuels autres administrateurs de cette démarche !" } do + %span.icon.refuse + .dropdown-description + %h4 Supprimer + + - else + %li + = link_to admin_procedure_publication_path(procedure) do + %span.icon.unarchive + .dropdown-description + %h4 Réactiver + diff --git a/app/views/new_administrateur/procedures/edit.html.haml b/app/views/new_administrateur/procedures/edit.html.haml index 0de6f300f..8fd8f2249 100644 --- a/app/views/new_administrateur/procedures/edit.html.haml +++ b/app/views/new_administrateur/procedures/edit.html.haml @@ -1,3 +1,5 @@ +- content_for(:root_class, 'scroll-margins-for-sticky-footer') + = render partial: 'new_administrateur/breadcrumbs', locals: { steps: [link_to('Démarches', admin_procedures_path), link_to(@procedure.libelle, admin_procedure_path(@procedure)), diff --git a/app/views/new_administrateur/procedures/index.html.haml b/app/views/new_administrateur/procedures/index.html.haml new file mode 100644 index 000000000..0f68be127 --- /dev/null +++ b/app/views/new_administrateur/procedures/index.html.haml @@ -0,0 +1,22 @@ +.sub-header + .procedure-admin-listing-container + = link_to "Nouvelle Démarche", new_admin_procedure_path, id: 'new-procedure', class: 'button primary' + .container + + %ul.tabs + = tab_item(t('pluralize.published', count: @procedures_publiees.count), admin_procedures_path(statut: 'publiees'), active: @statut == 'publiees', badge: number_with_html_delimiter(@procedures_publiees_count)) + = tab_item('En test', admin_procedures_path(statut: 'brouillons'), active: @statut == 'brouillons', badge: number_with_html_delimiter(@procedures_draft_count)) + = tab_item(t('pluralize.closed', count: @procedures_closed.count), admin_procedures_path(statut: 'archivees'), active: @statut == 'archivees', badge: number_with_html_delimiter(@procedures_closed_count)) + +.container#procedures{ data: { item_count: @statut === "publiees" ? @procedures_publiees_count : @statut === "brouillons" ? @procedures_draft_count : @procedures_closed_count } } + - if @statut === "publiees" + = render partial: "procedures_list", locals: { procedures: @procedures_publiees } + = paginate @procedures_publiees + + - if @statut === "brouillons" + = render partial: "procedures_list", locals: { procedures: @procedures_draft } + = paginate @procedures_draft + + - if @statut === "archivees" + = render partial: "procedures_list", locals: { procedures: @procedures_closed } + = paginate @procedures_closed diff --git a/app/views/new_administrateur/procedures/new.html.haml b/app/views/new_administrateur/procedures/new.html.haml index 8cfdc47f9..b1507b1db 100644 --- a/app/views/new_administrateur/procedures/new.html.haml +++ b/app/views/new_administrateur/procedures/new.html.haml @@ -1,3 +1,5 @@ +- content_for(:root_class, 'scroll-margins-for-sticky-footer') + = render partial: 'new_administrateur/breadcrumbs', locals: { steps: [link_to('Démarches', admin_procedures_path), 'Nouvelle'] } diff --git a/app/views/new_administrateur/procedures/show.html.haml b/app/views/new_administrateur/procedures/show.html.haml index d8d905333..68320f480 100644 --- a/app/views/new_administrateur/procedures/show.html.haml +++ b/app/views/new_administrateur/procedures/show.html.haml @@ -12,13 +12,18 @@ %span.icon.in-progress Tester + - if @procedure.publiee? || @procedure.brouillon? + = link_to admin_procedure_publication_path(@procedure), class: 'button' do + %span.icon.reply + Envoyer une copie + - if !@procedure.publiee? = link_to 'Publier', admin_procedure_publication_path(@procedure), class: 'button primary', id: 'publish-procedure-link', data: { disable_with: "Publication..." } - - if @procedure.locked? - = link_to admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, class: 'button', data: { confirm: "Voulez-vous vraiment archiver la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} do + - if @procedure.locked? && !@procedure.close? + = link_to admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, class: 'button', data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} do %span.icon.archive - Archiver + Clore .container %h2.procedure-admin-explanation Indispensable avant publication diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 0a66b983d..5b9e8a5ab 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -64,6 +64,13 @@ Option B %p.notice Une autre option, pas mal non plus. + %h3.header-subsection Interrupteur + %label.toggle-switch + = f.check_box :archived, class: 'toggle-switch-checkbox' + %span.toggle-switch-control.round + %span.toggle-switch-label.on Activé + %span.toggle-switch-label.off Désactivé + .send-wrapper = f.submit 'Enregistrer un brouillon (formnovalidate)', formnovalidate: true, class: 'button send' = f.submit 'Envoyer', class: 'button send primary' diff --git a/app/views/shared/dossiers/_demande.html.haml b/app/views/shared/dossiers/_demande.html.haml index a6c5ccee8..55870541c 100644 --- a/app/views/shared/dossiers/_demande.html.haml +++ b/app/views/shared/dossiers/_demande.html.haml @@ -24,7 +24,5 @@ .tab-title Formulaire - champs = dossier.champs.includes(:type_de_champ) - if champs.any? || dossier.procedure.routee? - - if has_lost_attachments(dossier) - = render partial: "shared/dossiers/lost_attachments", locals: { dossier: dossier, profile: profile } .card = render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: profile } diff --git a/app/views/shared/dossiers/_lost_attachments.html.haml b/app/views/shared/dossiers/_lost_attachments.html.haml deleted file mode 100644 index 9c4275b94..000000000 --- a/app/views/shared/dossiers/_lost_attachments.html.haml +++ /dev/null @@ -1,56 +0,0 @@ --# haml-lint:disable ApplicationNameLinter -- post_mortem_url = 'https://demarches-simplifiees.gitbook.io/articles-demarches-simplifiees-fr/2020/incident-de-production-du-21-janvier-2020' --# haml-lint:enable ApplicationNameLinter -- if profile == 'usager' - /# Message for Usager - .card.warning - .card-title Des pièces jointes de votre dossier peuvent être manquantes. - %p - Suite à un - = link_to 'incident', post_mortem_url, target: '_blank' - survenu le 21 janvier, #{APPLICATION_NAME} a perdu par erreur une partie des pièces jointes de votre dossier. L’administration en charge de votre dossier a été prévenue. - - - if dossier.read_only? - %p - Si nécessaire, - = succeed '.' do - %strong - l’administration vous contactera pour renvoyer les pièces jointes en question - - else - %p - Si une ou plusieurs pièces jointes manquent, nous vous invitons à - = link_to modifier_dossier_path(dossier) do - = succeed '.' do - %strong renvoyer les pièces jointes manquantes - - %p Nous nous excusons pour la gêne occasionnée. - -- else - /# Message for Instructeurs - .card.warning - .card-title Des pièces jointes de ce dossier peuvent être manquantes. - %p - Suite à un - = link_to 'incident', post_mortem_url, target: '_blank' - survenu le 21 janvier, #{APPLICATION_NAME} a perdu par erreur une partie des pièces jointes de ce dossier. - - - if dossier.read_only? - %p - Si une ou plusieurs pièces jointes essentielles manquent, nous vous invitons à : - %ol - %li repasser ce dossier en construction ; - %li< - = link_to 'contacter le demandeur ', messagerie_instructeur_dossier_path(dossier.procedure, dossier) - pour lui demander de - = succeed '.' do - %strong renvoyer les pièces jointes nécessaires - - else - %p - Si une ou plusieurs pièces jointes manquent, nous vous invitons à - = succeed ',' do - = link_to 'contacter le demandeur', messagerie_instructeur_dossier_path(dossier.procedure, dossier) - pour lui demander de - = succeed '.' do - %strong renvoyer les pièces jointes nécessaires - - %p Le demandeur de ce dossier a également été prévenu. Nous nous excusons pour la gêne occasionnée. diff --git a/app/views/users/dossiers/brouillon.html.haml b/app/views/users/dossiers/brouillon.html.haml index 580ecd2d7..f8828703d 100644 --- a/app/views/users/dossiers/brouillon.html.haml +++ b/app/views/users/dossiers/brouillon.html.haml @@ -1,3 +1,4 @@ +- content_for(:root_class, 'scroll-margins-for-sticky-footer') - content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})") - content_for :footer do diff --git a/config/dossiers-with-lost-attachments.yml b/config/dossiers-with-lost-attachments.yml deleted file mode 100644 index 7b0243429..000000000 --- a/config/dossiers-with-lost-attachments.yml +++ /dev/null @@ -1,946 +0,0 @@ -# On the 22/01/2020, a technical error on the demarches-simplifees.fr -# instance made us delete some files attached to some dossiers. -# -# This list contains the ids of all dossiers where some attached -# file was mistakenly deleted during this incident. -- 22 -- 9224 -- 9244 -- 9489 -- 9495 -- 11045 -- 14311 -- 14530 -- 14553 -- 14569 -- 14616 -- 14619 -- 15325 -- 15331 -- 16448 -- 17848 -- 18190 -- 18308 -- 18855 -- 18929 -- 18946 -- 18965 -- 19284 -- 19697 -- 19698 -- 19872 -- 20334 -- 20663 -- 20931 -- 21015 -- 21024 -- 21620 -- 21753 -- 21782 -- 21865 -- 21871 -- 21876 -- 21938 -- 21963 -- 21971 -- 22011 -- 22042 -- 22045 -- 22063 -- 22068 -- 22108 -- 22279 -- 22434 -- 22488 -- 22523 -- 24277 -- 25275 -- 26223 -- 26228 -- 27069 -- 27213 -- 29366 -- 29386 -- 29486 -- 31179 -- 31983 -- 32004 -- 32323 -- 32325 -- 32492 -- 32497 -- 35072 -- 35074 -- 35193 -- 35232 -- 35308 -- 35323 -- 35357 -- 35442 -- 35486 -- 35496 -- 35554 -- 35644 -- 36659 -- 38984 -- 39026 -- 39099 -- 39158 -- 39287 -- 39314 -- 39352 -- 39359 -- 39371 -- 39380 -- 39390 -- 39403 -- 39493 -- 39526 -- 41106 -- 41111 -- 43566 -- 43570 -- 43571 -- 43572 -- 43578 -- 43741 -- 43785 -- 43791 -- 43884 -- 43928 -- 43935 -- 43937 -- 44013 -- 44035 -- 45123 -- 48500 -- 48690 -- 52921 -- 53029 -- 53067 -- 53097 -- 53118 -- 53147 -- 53152 -- 53153 -- 53154 -- 53155 -- 53159 -- 53171 -- 53176 -- 53178 -- 53207 -- 53208 -- 53218 -- 53472 -- 53981 -- 54002 -- 56253 -- 57216 -- 57689 -- 58003 -- 58411 -- 58721 -- 59445 -- 59925 -- 61917 -- 62547 -- 62551 -- 62552 -- 62956 -- 63035 -- 63607 -- 63615 -- 65154 -- 66268 -- 66379 -- 66963 -- 67066 -- 68688 -- 68705 -- 68710 -- 68737 -- 68929 -- 68943 -- 69023 -- 69026 -- 69510 -- 69521 -- 69546 -- 70148 -- 70224 -- 72653 -- 76114 -- 79303 -- 79863 -- 79929 -- 79951 -- 79976 -- 80032 -- 84640 -- 93404 -- 98647 -- 99294 -- 101868 -- 103748 -- 104097 -- 107096 -- 109146 -- 113137, -- 113690 -- 113707 -- 113711 -- 113722 -- 113743 -- 117270 -- 118003 -- 119395 -- 120824 -- 121498 -- 124009 -- 125430 -- 127024 -- 130735 -- 132389 -- 132942 -- 133317 -- 133697 -- 137347 -- 137374 -- 137427 -- 137525 -- 137900 -- 138272 -- 138436 -- 138466 -- 138515 -- 138550 -- 138631 -- 138703 -- 138990 -- 139296 -- 139371 -- 140604 -- 140811 -- 141142 -- 141227 -- 148609 -- 153917 -- 156644 -- 157401 -- 184400 -- 190035 -- 191350 -- 193213 -- 193783 -- 194088 -- 198497 -- 200002 -- 200005 -- 200017 -- 200041 -- 200048 -- 200060 -- 200061 -- 200062 -- 200081 -- 200086 -- 200089 -- 200094 -- 200098 -- 200100 -- 200108 -- 200109 -- 200113 -- 200128 -- 200138 -- 200140 -- 200143 -- 200154 -- 200158 -- 200161 -- 200163 -- 200169 -- 200182 -- 200186 -- 200195 -- 200202 -- 200208 -- 200211 -- 200263 -- 200267 -- 200448 -- 200685 -- 200757 -- 200784 -- 200787 -- 201021 -- 201315 -- 201576 -- 201921 -- 201986 -- 202015 -- 203553 -- 203630 -- 204737 -- 204866 -- 204924 -- 204982 -- 205021 -- 205265 -- 205424 -- 205655 -- 205659 -- 205847 -- 205940 -- 205954 -- 205987 -- 206013 -- 206089 -- 206108 -- 206170 -- 206179 -- 206217 -- 206237 -- 206285 -- 206288 -- 206290 -- 206300 -- 206374 -- 206472 -- 206490 -- 206494 -- 206515 -- 206532 -- 206589 -- 206612 -- 206734 -- 206741 -- 206782 -- 206807 -- 206828 -- 206835 -- 206856 -- 206887 -- 206904 -- 206909 -- 206913 -- 206931 -- 206964 -- 206972 -- 206977 -- 206979 -- 206992 -- 207004 -- 207006 -- 207032 -- 207061 -- 207078 -- 207103 -- 207104 -- 207118 -- 207181 -- 207183 -- 207197 -- 207207 -- 207236 -- 207537 -- 207734 -- 207773 -- 208009 -- 208153 -- 208186 -- 208199 -- 208379 -- 208422 -- 208545 -- 208549 -- 208873 -- 208903 -- 209151 -- 209392 -- 209397 -- 209873 -- 210103 -- 210175 -- 210959 -- 211018 -- 211144 -- 211197 -- 211852 -- 212322 -- 212359 -- 212493 -- 212503 -- 212955 -- 212986 -- 213596 -- 213598 -- 213612 -- 213625 -- 213694 -- 213712 -- 213749 -- 214123 -- 214592 -- 215503 -- 215510 -- 215742 -- 215756 -- 216263 -- 216360 -- 216620 -- 217131 -- 217159 -- 217215 -- 217320 -- 217361 -- 217373 -- 217487 -- 217507 -- 217518 -- 217587 -- 217677 -- 217714 -- 217790 -- 217796 -- 217850 -- 217859 -- 217871 -- 217875 -- 218370 -- 218419 -- 219341 -- 220675 -- 221967 -- 222266 -- 222801 -- 222868 -- 222875 -- 222946 -- 222949 -- 222965 -- 223154 -- 223303 -- 223329 -- 223368 -- 224064 -- 224290 -- 225117 -- 227153 -- 227161 -- 227816 -- 227931 -- 228074 -- 228666 -- 228703 -- 228776 -- 228918 -- 228926 -- 229050 -- 229086 -- 229109 -- 229114 -- 229553 -- 230338 -- 230353 -- 230479 -- 230539 -- 230574 -- 230582 -- 231261 -- 232521 -- 232740 -- 232916 -- 232934 -- 232958 -- 233008 -- 233047 -- 233160 -- 233197 -- 233211 -- 233556 -- 233605 -- 233712 -- 235322 -- 236625 -- 237371 -- 237439 -- 237605 -- 238276 -- 239412 -- 239500 -- 239603 -- 239777 -- 239805 -- 239829 -- 239850 -- 239858 -- 241496 -- 241557 -- 241598 -- 241788 -- 241824 -- 241858 -- 241879 -- 241910 -- 241927 -- 241934 -- 241936 -- 241939 -- 241950 -- 241952 -- 241955 -- 241956 -- 241959 -- 241969 -- 241970 -- 241985 -- 241987 -- 241991 -- 241996 -- 242414 -- 242725 -- 242800 -- 242808 -- 242814 -- 242820 -- 242840 -- 242845 -- 242937 -- 242942 -- 242972 -- 242973 -- 242975 -- 242997 -- 243133 -- 243234 -- 243237 -- 243240 -- 243273 -- 243290 -- 243335 -- 243339 -- 243429 -- 245309 -- 245460 -- 247557 -- 248202 -- 248537 -- 248567 -- 248592 -- 248726 -- 248776 -- 249018 -- 249342 -- 249352 -- 249563 -- 250149 -- 250471 -- 250489 -- 250502 -- 250504 -- 250509 -- 250511 -- 250530 -- 251386 -- 252994 -- 254055 -- 254211 -- 254972 -- 255013 -- 255078 -- 255082 -- 255329 -- 255925 -- 255990 -- 256083 -- 256084 -- 256296 -- 256472 -- 257228 -- 258640 -- 258982 -- 259131 -- 259147 -- 259204 -- 261038 -- 261117 -- 261118 -- 261170 -- 261452 -- 263654 -- 264489 -- 265036 -- 265333 -- 265983 -- 266034 -- 266057 -- 266062 -- 266069 -- 266071 -- 266205 -- 267145 -- 267322 -- 267404 -- 267708 -- 268223 -- 268652 -- 268654 -- 268678 -- 268728 -- 268731 -- 268764 -- 268885 -- 269421 -- 269444 -- 269518 -- 269560 -- 269574 -- 269575 -- 270213 -- 272346 -- 272891 -- 273169 -- 274183 -- 274478 -- 274634 -- 274730 -- 275900 -- 279329 -- 279348 -- 280975 -- 281779 -- 281804 -- 282877 -- 283362 -- 283378 -- 283392 -- 283395 -- 283495 -- 283845 -- 284616 -- 284622 -- 284675 -- 284687 -- 284774 -- 284838 -- 284880 -- 285060 -- 285230 -- 285575 -- 285603 -- 287488 -- 288210 -- 289529 -- 289530 -- 289811 -- 289844 -- 289859 -- 290754 -- 291018 -- 291621 -- 293625 -- 293634 -- 296214 -- 298172 -- 298355 -- 298942 -- 299000 -- 306186 -- 310318 -- 310544 -- 310730 -- 311019 -- 311728 -- 312509 -- 312531 -- 313699 -- 330729 -- 337282 -- 344150 -- 351128 -- 360286 -- 374944 -- 386682 -- 386850 -- 409245 -- 410749 -- 429085 -- 453060 -- 473146 -- 473183 -- 477625 -- 482733 -- 485936 -- 486996 -- 501423 -- 524299 -- 525738 -- 525916 -- 525932 -- 525936 -- 529745 -- 529870 -- 542902 -- 546362 -- 546394 -- 546406 -- 546416 -- 546519 -- 551264 -- 551276 -- 552058 -- 555081 -- 571316 -- 574190 -- 574209 -- 591896 -- 600483 -- 600501 -- 600863 -- 601157 -- 619683 -- 620774 -- 627219 -- 628388 -- 628633 -- 628675 -- 628701 -- 628743 -- 628746 -- 628763 -- 631292 -- 635784 -- 639656 -- 640229 -- 642227 -- 654699 -- 656113 -- 665439 -- 666028 -- 666790 -- 670294 -- 671241 -- 671245 -- 671259 -- 671268 -- 671458 -- 677528 -- 679414 -- 690281 -- 690749 -- 692168 -- 695653 -- 695727 -- 695768 -- 695791 -- 696013 -- 696428 -- 715997 -- 719236 -- 726969 -- 726981 -- 727014 -- 727551 -- 756386 -- 756402 -- 762500 -- 766726 -- 767963 -- 771492 -- 773982 -- 775235 -- 777837 -- 780557 -- 781158 -- 781502 -- 781503 -- 784077 -- 784298 -- 784403 -- 792304 -- 794024 -- 794606 -- 795345 -- 796814 -- 798434 -- 798893 -- 799196 -- 799200 -- 800093 -- 802666 -- 802679 -- 802707 -- 802709 -- 802716 -- 808711 -- 808740 -- 808742 -- 808766 -- 808767 -- 808784 -- 808797 -- 808876 -- 808926 -- 808935 -- 808937 -- 808939 -- 808940 -- 808943 -- 808947 -- 808958 -- 808963 -- 808967 -- 808982 -- 808983 -- 808994 -- 809002 -- 809004 -- 809007 -- 811190 -- 818427 -- 818724 -- 819171 -- 819725 -- 828064 -- 828292 -- 828535 -- 828577 -- 828607 -- 828641 -- 828705 -- 828741 -- 828778 -- 828782 -- 828788 -- 828819 -- 829128 -- 829239 -- 832186 -- 839927 -- 841809 -- 842330 -- 845358 -- 846642 -- 853954 -- 855891 -- 859844 -- 860016 -- 860043 -- 860050 -- 860059 -- 860062 -- 860067 -- 860520 -- 860555 -- 861195 -- 861222 -- 863696 -- 888447 -- 898772 -- 910362 -- 916218 -- 920528 -- 924844 -- 931770 -- 933988 -- 934004 -- 934005 -- 934008 -- 934009 -- 934010 -- 934013 -- 934014 -- 934019 -- 934029 -- 934033 -- 934046 -- 934058 -- 934060 -- 938750 -- 946941 -- 949162 -- 951110 -- 951227 -- 955534 -- 959860 -- 960038 -- 962441 -- 962443 -- 962515 -- 962547 -- 962560 -- 962664 -- 963634 -- 966627 -- 969062 -- 985102 -- 990079 -- 990281 -- 991542 -- 999193 -- 1009535 -- 1016896 -- 1018675 -- 1019395 -- 1020295 -- 1020509 -- 1020960 -- 1020969 -- 1020982 -- 1021109 -- 1023811 -- 1027181 -- 1028190 -- 1035967 -- 1036338 -- 1038182 -- 1047230 -- 1048403 -- 1048429 -- 1048938 -- 1049968 -- 1050075 -- 1063901 -- 1063941 -- 1063942 -- 1079027 -- 1079344 -- 1083246 -- 1086139 -- 1088337 -- 1092801 -- 1102942 -- 1110614 -- 1110620 -- 1112775 -- 1116822 -- 1121711 -- 1140138 -- 1143324 -- 1145406 -- 1153823 -- 1157409 -- 1164993 -- 1165566 -- 1168238 -- 1169529 -- 1174555 -- 1182043 -- 1184647 -- 1187042 -- 1188538 -- 1206673 -- 1206824 -- 1206939 -- 1206954 -- 1206967 -- 1206969 -- 1249330 -- 1249377 -- 1249815 -- 1263647 -- 1279054 -- 1280300 -- 1280341 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 41bea6663..925f958fd 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -317,3 +317,15 @@ fr: zero: 0 dossier trouvé one: 1 dossier trouvé other: "%{count} dossiers trouvés" + published: + zero: Publiée + one: Publiée + other: Publiées + closed: + zero: Close + one: Close + other: Closes + draft: + zero: Brouillon + one: Brouillon + other: Brouillons diff --git a/config/routes.rb b/config/routes.rb index 7bfbea98d..05f860b51 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -178,7 +178,7 @@ Rails.application.routes.draw do get 'procedures/draft' => 'procedures#draft' get 'procedures/:id/publication' => 'procedures#show', as: :procedure_publication - resources :procedures, only: [:index, :destroy] do + resources :procedures, only: [:destroy] do collection do get 'new_from_existing' => 'procedures#new_from_existing', as: :new_from_existing end @@ -373,7 +373,7 @@ Rails.application.routes.draw do # namespace :admin, module: 'new_administrateur' do - resources :procedures, except: [:index, :destroy] do + resources :procedures, except: [:destroy] do member do get 'apercu' get 'champs' diff --git a/db/schema.rb b/db/schema.rb index 3c242925f..040346832 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: 2020_07_16_143010) do +ActiveRecord::Schema.define(version: 2020_07_15_143010) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -257,9 +257,9 @@ ActiveRecord::Schema.define(version: 2020_07_16_143010) do t.datetime "en_construction_close_to_expiration_notice_sent_at" t.interval "en_construction_conservation_extension", default: "PT0S" t.datetime "termine_close_to_expiration_notice_sent_at" + t.bigint "revision_id" t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin - t.bigint "revision_id" t.index ["archived"], name: "index_dossiers_on_archived" t.index ["groupe_instructeur_id"], name: "index_dossiers_on_groupe_instructeur_id" t.index ["hidden_at"], name: "index_dossiers_on_hidden_at" diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index c8cf264e8..2390b965e 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -41,23 +41,6 @@ describe Admin::ProceduresController, type: :controller do it { expect(response.status).to eq(200) } end - describe 'GET #index with sorting and pagination' do - before do - create(:procedure, administrateur: admin) - admin.reload - end - - subject { - get :index, params: { - 'procedures_smart_listing[page]': 1, - 'procedures_smart_listing[per_page]': 10, - 'procedures_smart_listing[sort][id]': 'asc' - } - } - - it { expect(subject.status).to eq(200) } - end - describe 'GET #archived' do subject { get :archived } diff --git a/spec/controllers/api/v2/graphql_controller_spec.rb b/spec/controllers/api/v2/graphql_controller_spec.rb index c1213a44e..62000633a 100644 --- a/spec/controllers/api/v2/graphql_controller_spec.rb +++ b/spec/controllers/api/v2/graphql_controller_spec.rb @@ -12,7 +12,7 @@ describe API::V2::GraphqlController do dossier end let(:dossier1) { create(:dossier, :en_construction, :with_individual, procedure: procedure, en_construction_at: 1.day.ago) } - let(:dossier2) { create(:dossier, :en_construction, :with_individual, procedure: procedure, en_construction_at: 3.days.ago) } + let(:dossier2) { create(:dossier, :en_construction, :with_individual, :archived, procedure: procedure, en_construction_at: 3.days.ago) } let(:dossier_brouillon) { create(:dossier, :with_individual, procedure: procedure) } let(:dossiers) { [dossier2, dossier1, dossier] } let(:instructeur) { create(:instructeur, followed_dossiers: dossiers) } @@ -171,6 +171,50 @@ describe API::V2::GraphqlController do }) end end + + context "filter archived dossiers" do + let(:query) do + "{ + demarche(number: #{procedure.id}) { + id + number + dossiers(archived: #{archived_filter}) { + nodes { + id + } + } + } + }" + end + + context 'with archived=true' do + let(:archived_filter) { 'true' } + it "only archived dossiers should be returned" do + expect(gql_errors).to eq(nil) + expect(gql_data).to eq(demarche: { + id: procedure.to_typed_id, + number: procedure.id, + dossiers: { + nodes: [{ id: dossier2.to_typed_id }] + } + }) + end + end + + context 'with archived=false' do + let(:archived_filter) { 'false' } + it "only not archived dossiers should be returned" do + expect(gql_errors).to eq(nil) + expect(gql_data).to eq(demarche: { + id: procedure.to_typed_id, + number: procedure.id, + dossiers: { + nodes: [{ id: dossier1.to_typed_id }, { id: dossier.to_typed_id }] + } + }) + end + end + end end context "dossier" do diff --git a/spec/controllers/new_administrateur/procedures_controller_spec.rb b/spec/controllers/new_administrateur/procedures_controller_spec.rb index dd79cd59b..36cc682c4 100644 --- a/spec/controllers/new_administrateur/procedures_controller_spec.rb +++ b/spec/controllers/new_administrateur/procedures_controller_spec.rb @@ -43,6 +43,27 @@ describe NewAdministrateur::ProceduresController, type: :controller do sign_in(admin.user) end + describe 'GET #index' do + subject { get :index } + + it { expect(response.status).to eq(200) } + end + + describe 'GET #index with sorting and pagination' do + before do + create(:procedure, administrateur: admin) + admin.reload + end + + subject { + get :index, params: { + 'statut': 'publiees' + } + } + + it { expect(subject.status).to eq(200) } + end + describe 'GET #edit' do let(:published_at) { nil } let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) } diff --git a/spec/features/admin/procedure_cloning_spec.rb b/spec/features/admin/procedure_cloning_spec.rb index 8264321a9..8f67aea46 100644 --- a/spec/features/admin/procedure_cloning_spec.rb +++ b/spec/features/admin/procedure_cloning_spec.rb @@ -18,6 +18,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do scenario do visit admin_procedures_path expect(page.find_by_id('procedures')['data-item-count']).to eq('1') + page.all('.procedures-actions-btn').first.click page.all('.clone-btn').first.click visit admin_procedures_draft_path expect(page.find_by_id('procedures')['data-item-count']).to eq('1') diff --git a/spec/features/admin/procedure_creation_spec.rb b/spec/features/admin/procedure_creation_spec.rb index 815e89a1c..a2b2f0faa 100644 --- a/spec/features/admin/procedure_creation_spec.rb +++ b/spec/features/admin/procedure_creation_spec.rb @@ -12,18 +12,18 @@ feature 'As an administrateur I wanna create a new procedure', js: true do context 'Right after sign_in I shall see all procedure states links' do scenario 'Finding draft procedures' do - click_on 'draft-procedures' - expect(page).to have_current_path(admin_procedures_draft_path) + page.all('.tabs li a')[1].click + expect(page).to have_current_path(admin_procedures_path(statut: 'brouillons')) end scenario 'Finding active procedures' do - click_on 'active-procedures' - expect(page).to have_current_path(admin_procedures_path) + page.all('.tabs li a').first.click + expect(page).to have_current_path(admin_procedures_path(statut: 'publiees')) end scenario 'Finding archived procedures' do - click_on 'archived-procedures' - expect(page).to have_current_path(admin_procedures_archived_path) + page.all('.tabs li a').last.click + expect(page).to have_current_path(admin_procedures_path(statut: 'archivees')) end end @@ -32,7 +32,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do scenario 'Finding save button for new procedure, libelle, description and cadre_juridique required' do expect(page).to have_selector('#new-procedure') find('#new-procedure').click - click_on 'from-scratch' expect(page).to have_current_path(new_admin_procedure_path) expect(find('#procedure_for_individual_true')).to be_checked @@ -54,7 +53,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do before 'Create procedure' do expect(page).to have_selector('#new-procedure') find('#new-procedure').click - click_on 'from-scratch' expect(page).to have_current_path(new_admin_procedure_path) fill_in_dummy_procedure_details diff --git a/spec/features/routing/full_scenario_spec.rb b/spec/features/routing/full_scenario_spec.rb index fb0bbcc9d..b23f74762 100644 --- a/spec/features/routing/full_scenario_spec.rb +++ b/spec/features/routing/full_scenario_spec.rb @@ -229,6 +229,7 @@ feature 'The routing', js: true do def log_out(old_layout: false) if old_layout + page.all('.dropdown-button').first.click click_on 'Se déconnecter' else click_button(title: 'Mon compte') diff --git a/spec/helpers/dossier_helper_spec.rb b/spec/helpers/dossier_helper_spec.rb index 77ed77905..7b00ca8b0 100644 --- a/spec/helpers/dossier_helper_spec.rb +++ b/spec/helpers/dossier_helper_spec.rb @@ -215,33 +215,4 @@ RSpec.describe DossierHelper, type: :helper do it { is_expected.to eq('without_continuation') } end end - - describe '.has_lost_attachments' do - let(:procedure) { create(:procedure, :published) } - let(:dossier_with_lost_attachments) { create(:dossier, procedure: procedure) } - let(:dossier_without_lost_attachments) { create(:dossier, procedure: procedure) } - - before do - expect(ENV).to receive(:[]).with('APP_HOST').at_least(:once).and_return(app_host) - allow(helper).to receive(:dossiers_with_lost_attachments_ids).and_return([dossier_with_lost_attachments.id]) - end - - context 'on the DINUM instance' do - let(:app_host) { 'demarches-simplifiees.fr' } - - it 'returns true for dossiers that lost attachments' do - expect(helper.has_lost_attachments(dossier_with_lost_attachments)).to be(true) - expect(helper.has_lost_attachments(dossier_without_lost_attachments)).to be(false) - end - end - - context 'on another instance' do - let(:app_host) { 'polynesie-francaise.pref.gouv.fr' } - - it 'returns false for all dossiers' do - expect(helper.has_lost_attachments(dossier_with_lost_attachments)).to be(false) - expect(helper.has_lost_attachments(dossier_without_lost_attachments)).to be(false) - end - end - end end diff --git a/spec/views/shared/dossiers/_demande.html.haml_spec.rb b/spec/views/shared/dossiers/_demande.html.haml_spec.rb index fbf5d4e4a..f435e8e6a 100644 --- a/spec/views/shared/dossiers/_demande.html.haml_spec.rb +++ b/spec/views/shared/dossiers/_demande.html.haml_spec.rb @@ -50,15 +50,5 @@ describe 'shared/dossiers/demande.html.haml', type: :view do expect(subject).to include(champ.libelle) end end - - context 'when the dossier lost some attachments' do - before do - expect(view).to receive(:has_lost_attachments).and_return(true) - end - - it 'displays a warning message' do - expect(subject).to include('Des pièces jointes de votre dossier peuvent être manquantes.') - end - end end end diff --git a/spec/views/shared/dossiers/_lost_attachments.html.haml_spec.rb b/spec/views/shared/dossiers/_lost_attachments.html.haml_spec.rb deleted file mode 100644 index 4c970034e..000000000 --- a/spec/views/shared/dossiers/_lost_attachments.html.haml_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -describe 'shared/dossiers/lost_attachments.html.haml', type: :view do - let(:procedure) { create(:procedure, :published) } - let(:dossier) { create(:dossier, :en_construction, procedure: procedure) } - - subject { render 'shared/dossiers/lost_attachments.html.haml', dossier: dossier, profile: profile } - - context 'when viewed by an Usager' do - let(:profile) { 'usager' } - - it 'displays a warning message' do - expect(subject).to include('Des pièces jointes de votre dossier peuvent être manquantes') - expect(subject).to have_link('renvoyer les pièces jointes manquantes', href: modifier_dossier_path(dossier)) - end - - context 'when the user can’t edit the dossier' do - let(:dossier) { create(:dossier, :en_instruction, procedure: procedure) } - - it 'suggest to wait' do - expect(subject).to include('l’administration vous contactera') - end - end - end - - context 'when viewed by an Instructeur' do - let(:profile) { 'instructeur' } - - it 'displays a warning message' do - expect(subject).to include('Des pièces jointes de ce dossier peuvent être manquantes') - expect(subject).to have_link('contacter le demandeur') - end - - context 'when the user can’t edit the dossier' do - let(:dossier) { create(:dossier, :en_instruction, procedure: procedure) } - - it 'suggest to make the dossier editable again' do - expect(subject).to include('repasser ce dossier en construction') - end - end - end -end