dossier: remove RecapitulatifController

And add a redirection to the new URLs.
This commit is contained in:
Pierre de La Morinerie 2018-10-02 12:50:53 +00:00
parent d476953108
commit 36c1aa118d
27 changed files with 6 additions and 8840 deletions

View file

@ -22,7 +22,6 @@
// = require custom_mails
// = require default_data_block
// = require direct_uploads
// = require dossier_show
// = require dossiers
// = require etapes
// = require france_connect_particulier
@ -34,7 +33,6 @@
// = require pj_modal
// = require print
// = require procedure
// = require recapitulatif
// = require search
// = require siret
// = require outdated_browser_banner
@ -42,7 +40,6 @@
// = require autocomplete
// = require users
// = require attestation_template_edit
// = require attestation_recapitulatif
// = require_self
// = require leaflet

View file

@ -1,31 +0,0 @@
#attestation-recapitulatif {
margin-top: 40px;
.details {
padding: 15px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #FFFFFF;
.left {
position: relative;
padding-left: 30px;
img {
position: absolute;
left: 0px;
top: 15px;
}
.title {
font-weight: bold;
margin: 0;
}
.delivery {
color: #999999;
}
}
}
}

View file

@ -1,207 +0,0 @@
#users-recapitulatif-dossier-show {
#messages {
.last-commentaire {
display: block;
background-color: #FFFFFF;
.content,
.new-action {
margin-bottom: 20px;
}
}
.body {
.commentaires {
max-height: 350px;
overflow-y: scroll;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.075) 0%, rgba(219, 219, 219, 0) 50%, rgba(250, 251, 253, 0.18) 51%, #FFFFFF 100%);
}
.no-commentaires {
text-align: center;
font-size: 18px;
padding-top: 20px;
}
}
.last-commentaire,
.commentaire {
padding: 20px 0 0 20px;
.comment-header {
font-family: Arial;
font-size: 14px;
font-weight: bold;
line-height: 16px;
color: #000000;
margin-bottom: 10px;
}
.file {
padding-right: 70px;
text-align: center;
margin-bottom: 20px;
.link {
span {
width: 100%;
font-size: 40px;
}
}
}
}
.split-hr {
margin: 20px 20px 0 20px;
border-bottom: 1px solid #979797;
}
#new-commentaire {
padding: 15px;
}
}
.infos {
.split-row {
margin: 0 0 20px 0;
}
.entreprise-info {
font-size: 14px;
}
.entreprise-label {
font-weight: bold;
text-align: end;
}
}
#private-fields {
.text-primary {
color: #337AB7;
}
}
#pieces-jointes {
.piece-row {
margin: 20px;
.piece-label {
text-align: right;
font-weight: bold;
}
}
.modal-title {
color: #000000;
}
}
#carto {
#map {
margin-bottom: 20px;
height: 350px;
}
}
#dossier,
#pieces-jointes,
.infos,
#carto,
#private-fields {
.body {
padding: 20px 20px 0 20px;
color: #000000;
.libelle-procedure {
font-style: italic;
padding: 10px;
}
.depositaire-label {
font-weight: bold;
text-align: end;
}
.btn-action {
border: none;
margin: 20px 0 40px 0;
}
.btn-action:hover {
color: #EEEEEE;
}
.action {
margin: 50px 0 0 15px;
}
.action,
.btn-action {
background-color: #E45B51;
text-align: center;
cursor: pointer;
color: #FFFFFF;
width: 253px;
height: 40px;
line-height: 40px;
font-family: Arial;
font-size: 16px;
font-weight: bold;
text-decoration: none;
a:hover {
color: #EEEEEE;
}
}
.historique {
color: #000000;
margin-left: 20px;
}
.comments {
margin-right: -10px;
}
.comments-off {
margin-right: -35px;
}
.dossier-title {
font-size: 16px;
min-height: 40px;
text-align: center;
}
.split-hr {
border-bottom: 1px solid #979797;
height: 12px;
min-height: 10px;
}
.title-row {
margin: 20px 10px 10px 10px;
}
.margin-top-40 {
margin-top: 40px;
}
.margin-top-20 {
margin-top: 20px;
}
.margin-bot-40 {
margin-bottom: 40px;
}
}
#pieces-justificatives {
.piece-row {
margin: 0 0 0 0;
}
}
}
}

View file

@ -1,9 +0,0 @@
#upload-pj-modal {
text-align: left;
table {
width: 100% !important;
margin-left: 0 !important;
margin-bottom: 0;
}
}

View file

@ -1,40 +0,0 @@
class Users::RecapitulatifController < UsersController
before_action only: [:show] do
authorized_routes? self.class
end
def show
redirect_to dossier_url(current_user_dossier)
end
def initiate
create_dossier_facade
@facade.dossier.en_construction!
flash.notice = 'Dossier soumis avec succès.'
redirect_to users_dossier_recapitulatif_path
end
def self.route_authorization
{
states: [
Dossier.states.fetch(:en_construction),
Dossier.states.fetch(:en_instruction),
Dossier.states.fetch(:sans_suite),
Dossier.states.fetch(:accepte),
Dossier.states.fetch(:refuse)
]
}
end
private
def create_dossier_facade
@facade = DossierFacades.new current_user_dossier.id, current_user.email
rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found')
redirect_to url_for(root_path)
end
end

View file

@ -1,17 +0,0 @@
- if dossier.attestation.present?
#attestation-recapitulatif.default-data-block
.row.show-block.clearfix
.header
.title
.carret-right
.carret-down
ATTESTATION
.details
.left
= image_tag('pdf.svg', width: '20px')
%p.title= dossier.attestation.title
%p.delivery Délivrée le #{l(dossier.attestation.created_at, format: '%d %B %Y')}
- if user_signed_in? && current_user == dossier.user
= link_to 'Télécharger', attestation_dossier_path(dossier), target: '_blank', class: 'btn btn-primary'
- else
= link_to 'Télécharger', attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary'

View file

@ -1,56 +0,0 @@
= render partial: 'dossiers/attestation', locals: { dossier: @facade.dossier }
= render partial: 'dossiers/messagerie', locals: { dossier_facade: @facade }
= render partial: 'dossiers/motivation', locals: { dossier_facade: @facade }
- if @facade.procedure.individual_with_siret
.default-data-block
.row.show-block.infos
.header
.col-xs-8.title-no-expanse
.carret-right
INFORMATIONS DU DEMANDEUR
- if [Dossier.states.fetch(:brouillon), Dossier.states.fetch(:en_construction)].include?(@facade.dossier.state)
%a#add_siret.action{ href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id) }
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
Renseigner un SIRET
- if @facade.etablissement.present?
.default-data-block
.row.show-block.infos#infos_entreprise
.header
.col-xs-12.title
.carret-right
.carret-down
INFORMATIONS DU DEMANDEUR
.body.display-block-on-print
= render partial: '/dossiers/infos_entreprise'
.default-data-block.default_visible
.row.show-block.infos#infos-dossiers
.header
.col-xs-10.title
.carret-right
.carret-down
CONSTRUCTION DU DOSSIER
= render partial: '/dossiers/edit_dossier'
.body.display-block-on-print
= render partial: '/dossiers/infos_dossier'
- if @facade.dossier.procedure.module_api_carto.use_api_carto
.default-data-block.default_visible.no-page-break-inside
.row.show-block#carto
.header
.col-xs-10.title
.carret-right
.carret-down
CARTOGRAPHIE
= render partial: '/dossiers/edit_carto'
.body.display-block-on-print
%input#json_latlngs{ type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs' }
%input#quartier_prioritaires{ type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" }
%input#cadastres{ type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" }
= render partial: '/users/carte/map', locals: { dossier: @facade.dossier }
= render partial: 'users/carte/init_carto', locals: { dossier: @facade.dossier }

View file

@ -1,5 +0,0 @@
- if !@facade.dossier.read_only?
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
= 'MODIFIER'

View file

@ -1,5 +0,0 @@
- if !@facade.dossier.read_only?
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
= link_to brouillon_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
= "MODIFIER"

View file

@ -1,11 +0,0 @@
- if !@facade.dossier.read_only?
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
- if @facade.dossier.types_de_piece_justificative.size > 0
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
%a#maj_pj.action{ "data-target" => "#upload-pj-modal",
"data-toggle" => "modal",
:type => "button",
style: 'margin-bottom: 15px; margin-top: -30px;' }
Modifier les documents
%br
= render partial: 'users/recapitulatif/modal_upload_pj'

View file

@ -1,146 +0,0 @@
.row
.col-xs-12
- if @facade.procedure.for_individual?
.row.title-row
.col-xs-4.split-hr
.col-xs-4.dossier-title= t('utils.depositaire')
.col-xs-4.split-hr
.row
.col-xs-6.depositaire-label Civilité
.col-xs-1.comments-off= "-"
.col-xs-5.depositaire-info= @facade.individual.gender
.row
.col-xs-6.depositaire-label Nom
.col-xs-1.comments-off= "-"
.col-xs-5.depositaire-info= @facade.individual.nom
.row
.col-xs-6.depositaire-label Prénom
.col-xs-1.comments-off= "-"
.col-xs-5.despositaire-info= @facade.individual.prenom
.row
.col-xs-6.depositaire-label Date de naissance
.col-xs-1.comments-off= "-"
.col-xs-4.depositaire-info= @facade.individual.birthdate&.strftime("%d/%m/%Y")
.row.margin-top-20
- if @facade.champs.present?
- @facade.champs.each do |champ|
- next if champ.type_champ == TypeDeChamp.type_champs.fetch(:explication)
- if champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section)
.row.title-row.margin-top-40
.col-xs-3.split-hr
.col-xs-6.dossier-title= champ.libelle
.col-xs-3.split-hr
- else
.row
.col-xs-6.depositaire-label= champ.libelle
.col-xs-1.comments-off
= "-"
.col-xs-5.depositaire-info{ id: "champ-#{champ.id}-value" }
- if champ.decorate.value.present? || champ.piece_justificative_file.attached?
- if champ.type_champ == TypeDeChamp.type_champs.fetch(:dossier_link)
- dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value)
- if dossier
= link_to("Dossier #{dossier.id}", brouillon_dossier_path(dossier), target: '_blank')
%br
= sanitize(dossier.text_summary)
- else
Pas de dossier associé
- elsif champ.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative)
= render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: true }
- elsif champ.type_champ == TypeDeChamp.type_champs.fetch(:textarea)
= simple_format(champ.decorate.value)
- elsif champ.type_champ == TypeDeChamp.type_champs.fetch(:linked_drop_down_list)
= champ.for_display
- else
= sanitize(champ.decorate.value)
.row
- if @facade.dossier.types_de_piece_justificative.count > 0
.col-xs-12
.row.title-row
.col-xs-4.split-hr
.col-xs-4.dossier-title= t('utils.pieces')
.col-xs-4.split-hr
.col-xs-12#pieces-justificatives.margin-bot-40
.row
.col-xs-12
- @facade.types_de_pieces_justificatives.each do |type_de_piece_justificative|
.row.piece-row
.col-xs-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
.row
.col-xs-6.depositaire-label= type_de_piece_justificative.libelle
.col-xs-1.comments-off= "-"
.col-xs-5.despositaire-info
- if type_de_piece_justificative.api_entreprise
%span.text-success Nous l'avons récupéré pour vous.
- elsif (@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).present?
%a{ href: "#{@pj.content_url}", target: '_blank' } Consulter
%span{ style: 'margin-left: 12px;' }
\-
- if @facade.dossier.pieces_justificatives.where(type_de_piece_justificative_id: type_de_piece_justificative.id).count > 1
= link_to "", class: "historique", "data-toggle" => "modal", "data-target" => "#pj-modal", :type => "button", "data-modal_title" => 'formulaires', "data-modal_index" => "type_de_pj_#{type_de_piece_justificative.id}" do
%span.fa.fa-clock-o
- else
Pièce non fournie
- if !@facade.dossier.read_only?
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
- if @facade.dossier.types_de_piece_justificative.size > 0
.row
.col-xs-4
%a#maj_pj.action{ "data-target" => "#upload-pj-modal", "data-toggle" => "modal", :type => "button" }
.col-xs-4.action
Modifier les documents
%br
= render partial: 'users/recapitulatif/modal_upload_pj'
.col-xs-4
- if gestionnaire_signed_in?
#pj-modal.modal.fade{ "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1" }
.modal-dialog.modal-lg{ :role => "document" }
.modal-content
.modal-header
%button.close{ "aria-label" => "Close", "data-dismiss" => "modal", :type => "button" }
%span{ "aria-hidden" => "true" } ×
%h4#myModalLabel.modal-title
Historique des
%span#pj-modal-title
.modal-body
%table.table
%thead
%th
Usager
%th
Date d'envoi
%th
Lien
%thead.tr-content#cerfa
- @facade.dossier.types_de_piece_justificative.each do |type_de_piece_justificative|
%tbody.tr-content{ id: "type_de_pj_#{type_de_piece_justificative.id}" }
- @facade.dossier.retrieve_all_piece_justificative_by_type(type_de_piece_justificative.id).each do |piece_justificative|
%tr
%td.col-md-6.col-sm-6.col-xs-6.col-lg-4
= piece_justificative.user.email
%td.col-md-6.col-sm-6.col-xs-6.col-lg-4
= piece_justificative.created_at
%td.col-md-6.col-sm-6.col-xs-6.col-lg-4
= link_to 'Récupérer', piece_justificative.content_url, { target: :blank }
.modal-footer
#modalCommentairesDossierParChamp.modal.fade{ "tabindex" => -1, "role" => "dialog" }
.modal-dialog{ "role" => "document" }
.modal-content
.modal-header
%button.close{ "data-dismiss" => "modal", "aria-label" => "Fermer" }
%span{ "aria-hidden" => true }
&times;
.modal-title
Messages
.modal-body
%p
Chargement des messages en cours...
.modal-footer
%button.btn.btn-primary{ "data-dismiss" => "modal" }
Fermer

View file

@ -1,29 +0,0 @@
#pieces-justificatives
.row
.col-xs-12
- @facade.dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
.row.piece-row
.col-xs-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
.row
.col-xs-6= type_de_piece_justificative.libelle
.col-xs-6
- if type_de_piece_justificative.api_entreprise
%span.text-success Nous l'avons récupéré pour vous.
- elsif (@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).present?
-# - if user_signed_in?
-# = 'Pièce fournie'
-# - elsif gestionnaire_signed_in?
%a{ href: "#{@pj.content_url}", target: '_blank' } Consulter
%span{ style: 'margin-left: 12px;' }
\-
%a.btn.fa.fa-timer{ style: 'color: black; padding-top: 0;',
"data-target" => "#pj-modal",
"data-toggle" => "modal",
:type => "button",
"data-modal_title" => type_de_piece_justificative.libelle,
"data-modal_index" => "type_de_pj_#{type_de_piece_justificative.id}" }
- else
= 'Pièce non fournie'
-# - if gestionnaire_signed_in?
= render partial: '/dossiers/modal_historique'

View file

@ -1,29 +0,0 @@
.default-data-block{ style: 'margin-top: 40px;' }
.row.show-block.clearfix#messages
.header
.col-xs-10.title
.carret-right
.carret-down
MESSAGERIE
.col-xs-2.count
= pluralize(@facade.commentaires.count, "message")
.alert.alert-info
Cette messagerie permet d'échanger entre le demandeur et le service instructeur.
.body.display-block-on-print
- if dossier_facade.commentaires.any?
.commentaires
= render partial: 'dossiers/commentaires/commentaire', collection: dossier_facade.commentaires.object.sort
.split-hr
#new-commentaire.hidden-print
= render partial: 'dossiers/commentaires/form', locals: { dossier_facade: @facade }
.last-commentaire.clearfix.hidden-print
- if last_comment = dossier_facade.commentaires.last
%div
DERNIER MESSAGE
= render partial: 'dossiers/commentaires/commentaire', object: last_comment
%button#open-message.new-action.btn.btn-danger
ENVOYER UN MESSAGE

View file

@ -1,11 +0,0 @@
- if Dossier::TERMINE.include?(@facade.dossier.state) && @facade.dossier.motivation.present?
.default-data-block.default_visible
.row.show-block.infos
.header
.col-xs-12.title
.carret-right
.carret-down
MOTIVATION
.body
.display-block-on-print
= @facade.dossier.motivation

View file

@ -1,22 +0,0 @@
.link-to-dossiers
= link_to 'retour aux dossiers', dossiers_path
#first-block
.en-cours
%h2 Récapitulatif
.infos
%div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
#menu-block
#infos-block
.split-hr-left
.dossier-state= @facade.dossier.display_state
.split-hr-left
- if current_user.owns?(@facade.dossier) && !@facade.dossier.instruction_commencee?
.text-center.mt-1
= link_to ask_deletion_dossier_path(@facade.dossier), method: :post, class: "btn btn-danger", data: { confirm: "Vous vous apprêtez à supprimer votre dossier ainsi que les informations quil contient. Nous vous rappelons que toute suppression entraine lannulation de la démarche en cours.\n\n Confirmer la suppression ?" } do
Supprimer définitivement
%br
ce dossier

View file

@ -1,24 +0,0 @@
.col-xs-7.main-info
%span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle }
= @facade.dossier.procedure.libelle.truncate(60)
.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
.row.centered-option
.col-lg-12.col-md-12.col-sm-12.col-xs-12
#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
%i.fa.fa-user
= t('utils.involved')
.badge.progress-bar-info
= @facade.dossier.invites.count
.dropdown-menu.dropdown-menu-right.dropdown-pannel
%h4= t('dynamics.dossiers.invites.title')
%ul
- if @facade.invites.present?
- @facade.invites.each do |invite|
%li= invite.email
- else
= t('dynamics.dossiers.invites.empty')
%li
= form_tag invites_dossier_path(dossier_id: @facade.dossier.id), method: :post, class: 'form-inline', id: 'send-invitation' do
= text_field_tag :invite_email, '', class: 'form-control', placeholder: 'Envoyer une invitation', id: 'invite_email'
= submit_tag 'Ajouter', class: 'btn btn-success', data: { confirm: "Envoyer l'invitation ?" }

View file

@ -1,27 +0,0 @@
%table.table
- dossier.types_de_piece_justificative.order('order_place ASC').each do |tpj|
%tr
%th.piece-libelle
= tpj.mandatory ? tpj.libelle + ' *' : tpj.libelle
%br
.piece-description= tpj.description
%td
- if tpj.lien_demarche.present?
%em
Récupérer le formulaire vierge pour mon dossier :
= link_to "Télécharger", tpj.lien_demarche, target: :blank
%td
- if tpj.api_entreprise
%span.text-success{ id: "piece_justificative_#{tpj.id}" } Nous l'avons récupéré pour vous.
- else
- if !dossier.was_piece_justificative_uploaded_for_type_id?(tpj.id)
= file_field_tag "piece_justificative_#{tpj.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes
- else
- pj = dossier.retrieve_last_piece_justificative_by_type(tpj.id)
%a{ href: pj.content_url, target: '_blank' }
= pj.original_filename
%span.btn.btn-sm.btn-file.btn-success
Modifier
= file_field_tag "piece_justificative_#{tpj.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes

View file

@ -1,17 +0,0 @@
#upload-pj-modal.modal.fade{ "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1" }
.modal-dialog{ :role => "document" }
.modal-content
- @dossier = @facade.dossier
= form_tag(url_for({ controller: '/users/description', action: :pieces_justificatives, dossier_id: @dossier.id }), class: 'form-inline', method: 'PATCH', multipart: true) do
.modal-header
%button.close{ "aria-label" => "Close", "data-dismiss" => "modal", :type => "button" }
%span{ "aria-hidden" => "true" } ×
%h4.modal-title
Modification des documents
.modal-body
= render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier }
.modal-footer
= submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable: true, submit: true }

View file

@ -1,2 +0,0 @@
.col-lg-12.col-md-12.col-sm-12.col-xs-12#users-recapitulatif-dossier-show
= render partial: "dossiers/dossier_show"

View file

@ -139,10 +139,6 @@ Rails.application.routes.draw do
resources :dossiers do
get '/add_siret' => 'dossiers/add_siret#show'
# TODO: once these pages will be migrated to the new user design, replace these routes by a redirection
get '/recapitulatif' => 'recapitulatif#show'
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
get '/carte/position' => 'carte#get_position'
post '/carte/qp' => 'carte#get_qp'
post '/carte/cadastre' => 'carte#get_cadastre'
@ -160,6 +156,7 @@ Rails.application.routes.draw do
# Redirection of legacy "/users/dossiers" route to "/dossiers"
get 'dossiers', to: redirect('/dossiers')
get 'dossiers/:id/recapitulatif', to: redirect('/dossiers/%{id}')
end
namespace :gestionnaire do

View file

@ -1,54 +0,0 @@
require 'spec_helper'
describe Users::RecapitulatifController, type: :controller do
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction)) }
let(:bad_dossier_id) { Dossier.count + 100000 }
before do
sign_in dossier.user
end
describe 'GET #show' do
it 'returns http success' do
get :show, params: { dossier_id: dossier.id }
expect(response).to redirect_to(dossier_path(dossier))
end
it 'redirection vers siret si mauvais dossier ID' do
get :show, params: { dossier_id: bad_dossier_id }
expect(response).to redirect_to('/')
end
it_behaves_like "not owner of dossier", :show
describe 'before_action authorized_routes?' do
context 'when dossier have brouillon state' do
before do
dossier.state = Dossier.states.fetch(:brouillon)
dossier.save
get :show, params: { dossier_id: dossier.id }
end
it { is_expected.to redirect_to root_path }
end
end
end
describe 'POST #initiate' do
context 'when an user initiate his dossier' do
before do
post :initiate, params: { dossier_id: dossier.id }
end
it 'dossier change his state for accepte' do
dossier.reload
expect(dossier.state).to eq(Dossier.states.fetch(:en_construction))
end
it 'a message informe user what his dossier is en_construction' do
expect(flash[:notice]).to include('Dossier soumis avec succès.')
end
end
end
end

View file

@ -38,6 +38,11 @@ describe 'Dossier details:' do
end
end
scenario 'the user is redirected from old URLs' do
visit "/users/dossiers/#{dossier.id}/recapitulatif"
expect(page).to have_current_path(dossier_path(dossier))
end
it_behaves_like 'the user can edit the submitted demande'
it_behaves_like 'the user can send messages to the instructeur'

File diff suppressed because it is too large Load diff

View file

@ -68,24 +68,5 @@ describe UserRoutesAuthorizationService do
end
end
end
describe 'recapitulatif' do
let(:controller) { Users::RecapitulatifController }
describe 'brouillon' do
let(:state) { Dossier.states.fetch(:brouillon) }
it { is_expected.to be_falsey }
end
describe 'en_construction' do
let(:state) { Dossier.states.fetch(:en_construction) }
it { is_expected.to be_truthy }
end
describe 'accepte' do
let(:state) { Dossier.states.fetch(:accepte) }
it { is_expected.to be_truthy }
end
end
end
end

View file

@ -1,71 +0,0 @@
require 'spec_helper'
describe 'dossiers/_infos_dossier.html.haml', type: :view do
describe "champs rendering" do
let(:dossier) { create(:dossier, :with_entreprise, procedure: create(:procedure, :with_api_carto, :with_type_de_champ)) }
before do
champs.each do |champ|
champ.value = ((0...8).map { (65 + rand(26)).chr }.join)
champ.save
end
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
render
end
describe 'every champs are present on the page' do
let(:champs) { dossier.champs }
it { expect(rendered).to have_content(champs.first.libelle) }
it { expect(rendered).to have_content(champs.first.value) }
it { expect(rendered).to have_content(champs.last.libelle) }
it { expect(rendered).to have_content(champs.last.value) }
end
end
describe "oui_non champ rendering" do
let(:dossier_with_yes_no) { create(:dossier, procedure: create(:procedure, :with_yes_no)) }
context "with the true value" do
before do
oui_non_champ = dossier_with_yes_no.champs.first
oui_non_champ.value = 'true'
oui_non_champ.save
assign(:facade, DossierFacades.new(dossier_with_yes_no.id, dossier_with_yes_no.user.email))
render
end
it { expect(rendered).to have_content("Oui") }
end
context "with the false value" do
before do
oui_non_champ = dossier_with_yes_no.champs.first
oui_non_champ.value = 'false'
oui_non_champ.save
assign(:facade, DossierFacades.new(dossier_with_yes_no.id, dossier_with_yes_no.user.email))
render
end
it { expect(rendered).to have_content("Non") }
end
context "with no value" do
before do
oui_non_champ = dossier_with_yes_no.champs.first
oui_non_champ.value = nil
oui_non_champ.save
assign(:facade, DossierFacades.new(dossier_with_yes_no.id, dossier_with_yes_no.user.email))
render
end
it { expect(rendered).not_to have_content("Oui") }
it { expect(rendered).not_to have_content("Non") }
end
end
end

View file

@ -1,65 +0,0 @@
require 'spec_helper'
describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml', type: :view do
let(:dossier) { create(:dossier, :with_entreprise, state: state, procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true, individual_with_siret: true)) }
let(:dossier_id) { dossier.id }
let(:state) { Dossier.states.fetch(:brouillon) }
before do
sign_in dossier.user
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
end
context 'buttons to change dossier state' do
context 'when dossier state is en_construction' do
let(:state) { Dossier.states.fetch(:en_construction) }
before do
render
end
it { expect(rendered).to have_content('En construction') }
end
context 'when dossier state is accepte' do
let(:state) { Dossier.states.fetch(:accepte) }
before do
render
end
it { expect(rendered).to have_content('Accepté') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
context 'when dossier state is refuse' do
let(:state) { Dossier.states.fetch(:refuse) }
before do
render
end
it { expect(rendered).to have_content('Refusé') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
context 'when dossier state is sans_suite' do
let(:state) { Dossier.states.fetch(:sans_suite) }
before do
render
end
it { expect(rendered).to have_content('Sans suite') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
end
end

View file

@ -1,103 +0,0 @@
require 'spec_helper'
describe 'users/recapitulatif/show.html.haml', type: :view do
let(:dossier) { create(:dossier, :with_entreprise, state: state, procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true, individual_with_siret: true)) }
let(:dossier_id) { dossier.id }
let(:state) { Dossier.states.fetch(:brouillon) }
before do
sign_in dossier.user
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
end
context 'sur la rendered recapitulative' do
context 'test de composition de la page' do
before do
render
end
it 'la section infos dossier est présente' do
expect(rendered).to have_selector('#infos-dossiers')
end
it 'le flux de commentaire est présent' do
expect(rendered).to have_selector('#messages')
end
describe 'les liens de modifications' do
context 'lien description' do
it 'le lien vers description est présent' do
expect(rendered).to have_css('#maj_infos')
end
it 'le lien vers l édition est correct' do
expect(rendered).to have_selector("a[id=maj_infos][href='/dossiers/#{dossier_id}/brouillon']")
end
end
context 'lien carte' do
it 'le lien vers carte est présent' do
expect(rendered).to have_css('#maj_pj')
end
end
context 'lien carte' do
it 'le lien vers le renseignement un SIRET est présent' do
expect(rendered).to have_css('#add_siret')
end
end
context 'lien carte' do
it 'le lien vers carte est présent' do
expect(rendered).to have_css('#maj_carte')
end
it 'le lien vers description est correct' do
expect(rendered).to have_selector("a[id=maj_carte][href='/users/dossiers/#{dossier_id}/carte']")
end
end
end
end
context 'when dossier state is en_construction' do
let(:state) { Dossier.states.fetch(:en_construction) }
before do
render
end
it 'button Modifier les document est present' do
expect(rendered).to have_content('Modifier les documents')
expect(rendered).to have_css('#upload-pj-modal')
end
end
context 'when invite is logged' do
let!(:invite_user) { create(:user, email: 'invite@octo.com') }
before do
create(:invite) { create(:invite, email: invite_user.email, user: invite_user, dossier: dossier, type: 'InviteUser') }
sign_out dossier.user
sign_in invite_user
render
end
describe 'les liens de modifications' do
it 'describe link is not present' do
expect(rendered).to have_css('#maj_infos')
end
it 'map link is present' do
expect(rendered).to have_css('#maj_carte')
end
it 'PJ link is present' do
expect(rendered).to have_css('#maj_pj')
end
it 'archive link is present' do
expect(rendered).not_to have_content('Archiver')
end
end
end
end
end