Merge pull request #2515 from betagouv/user-dossier-improvements

User dossier improvements
This commit is contained in:
Pierre de La Morinerie 2018-09-05 11:54:04 +02:00 committed by GitHub
commit b5486196e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 35 additions and 23 deletions

View file

@ -1,7 +1,7 @@
@import "colors";
@import "constants";
.status-progress {
.status-overview {
text-align: center;
}

View file

@ -4,8 +4,8 @@ module NewUser
helper_method :new_demarche_url
before_action :ensure_ownership!, except: [:index, :show, :formulaire, :modifier, :update, :recherche]
before_action :ensure_ownership_or_invitation!, only: [:show, :formulaire, :modifier, :update]
before_action :ensure_ownership!, except: [:index, :show, :demande, :modifier, :update, :recherche]
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :modifier, :update]
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update]
before_action :forbid_invite_submission!, only: [:update]
@ -34,7 +34,7 @@ module NewUser
@dossier = dossier
end
def formulaire
def demande
@dossier = dossier
end
@ -109,7 +109,7 @@ module NewUser
redirect_to merci_dossier_path(@dossier)
elsif current_user.owns?(dossier)
if Flipflop.new_dossier_details?
redirect_to formulaire_dossier_path(@dossier)
redirect_to demande_dossier_path(@dossier)
else
redirect_to users_dossier_recapitulatif_path(@dossier)
end

View file

@ -2,4 +2,4 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
= render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil }

View file

@ -2,4 +2,4 @@
= render partial: "header", locals: { dossier: @dossier }
= render partial: "shared/dossiers/show", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at }
= render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at }

View file

@ -1,7 +1,9 @@
- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil }
.container
- if !@dossier.read_only?

View file

@ -1,3 +1,5 @@
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }

View file

@ -1,3 +1,5 @@
- content_for(:title, "Dossiers")
.dossiers-headers.sub-header
.container
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche"

View file

@ -1,3 +1,5 @@
- content_for(:title, "Dossier bien envoyé (#{@dossier.procedure.libelle})")
.merci
.container
= image_tag('user/envoi-dossier.svg')

View file

@ -1,3 +1,5 @@
- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }

View file

@ -1,5 +1,7 @@
- content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
.container
= render partial: 'new_user/dossiers/show/status_progress', locals: { dossier: @dossier }
= render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier }

View file

@ -9,4 +9,4 @@
%ul.tabs
= active_tab_item('Résumé', dossier_path(dossier))
= active_tab_item('Formulaire', formulaire_dossier_path(dossier))
= active_tab_item('Demande', demande_dossier_path(dossier))

View file

@ -1,4 +1,4 @@
.status-progress
.status-overview
- if !dossier.termine?
%ul.status-timeline
%li.brouillon{ class: dossier.brouillon? ? 'active' : nil }

View file

@ -2,7 +2,7 @@
%span.label.brouillon brouillon
- elsif dossier.en_construction?
%span.label.construction en construction
- if dossier.en_instruction?
- elsif dossier.en_instruction?
%span.label.instruction en instruction
- elsif dossier.accepte?
%span.label.accepted accepté

View file

@ -278,7 +278,7 @@ Rails.application.routes.draw do
get 'modifier'
patch 'modifier', to: 'dossiers#update'
get 'merci'
get 'formulaire'
get 'demande'
post 'ask_deletion'
get 'attestation'
end

View file

@ -517,10 +517,10 @@ describe NewUser::DossiersController, type: :controller do
sign_in(user)
end
subject! { get(:formulaire, params: { id: dossier.id }) }
subject! { get(:demande, params: { id: dossier.id }) }
it { expect(assigns(:dossier)).to eq(dossier) }
it { is_expected.to render_template(:formulaire) }
it { is_expected.to render_template(:demande) }
end
describe '#ask_deletion' do

View file

@ -20,16 +20,16 @@ describe 'Dossier details:' do
scenario 'the user can see and edit dossier before instruction' do
visit_dossier dossier
click_on 'Formulaire'
click_on 'Demande'
expect(page).to have_current_path(formulaire_dossier_path(dossier))
expect(page).to have_current_path(demande_dossier_path(dossier))
click_on 'Modifier le dossier'
expect(page).to have_current_path(modifier_dossier_path(dossier))
fill_in('texte obligatoire', with: 'Nouveau texte')
click_on 'Enregistrer les modifications du dossier'
expect(page).to have_current_path(formulaire_dossier_path(dossier))
expect(page).to have_current_path(demande_dossier_path(dossier))
expect(page).to have_content('Nouveau texte')
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/formulaire.html.haml', type: :view do
describe 'new_user/dossiers/demande.html.haml', type: :view do
let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) }
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
@ -16,7 +16,7 @@ describe 'new_user/dossiers/formulaire.html.haml', type: :view do
it 'renders the dossier infos' do
expect(rendered).to have_text('Identité')
expect(rendered).to have_text('Formulaire')
expect(rendered).to have_text('Demande')
expect(rendered).to have_text('Pièces jointes')
end

View file

@ -10,6 +10,6 @@ describe 'new_user/dossiers/show/header.html.haml', type: :view do
expect(rendered).to have_selector("ul.tabs")
expect(rendered).to have_link("Résumé", href: dossier_path(dossier))
expect(rendered).to have_link("Formulaire", href: formulaire_dossier_path(dossier))
expect(rendered).to have_link("Demande", href: demande_dossier_path(dossier))
end
end

View file

@ -1,5 +1,5 @@
describe 'new_user/dossiers/show/_status_progress.html.haml', type: :view do
subject! { render 'new_user/dossiers/show/status_progress.html.haml', dossier: dossier }
describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
subject! { render 'new_user/dossiers/show/status_overview.html.haml', dossier: dossier }
matcher :have_timeline_item do |selector|
match do |rendered|