Merge pull request #2199 from betagouv/new-dossiers-list-fixup
Petits correctifs sur la liste des dossiers
This commit is contained in:
commit
b76aa95eed
4 changed files with 16 additions and 23 deletions
|
@ -7,6 +7,20 @@ module NewUser
|
|||
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update]
|
||||
before_action :forbid_invite_submission!, only: [:update]
|
||||
|
||||
def index
|
||||
@user_dossiers = current_user.dossiers.includes(:procedure).order_by_updated_at.page(page)
|
||||
@dossiers_invites = current_user.dossiers_invites.includes(:procedure).order_by_updated_at.page(page)
|
||||
|
||||
@current_tab = current_tab(@user_dossiers.count, @dossiers_invites.count)
|
||||
|
||||
@dossiers = case @current_tab
|
||||
when 'mes-dossiers'
|
||||
@user_dossiers
|
||||
when 'dossiers-invites'
|
||||
@dossiers_invites
|
||||
end
|
||||
end
|
||||
|
||||
def attestation
|
||||
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
||||
end
|
||||
|
@ -87,20 +101,6 @@ module NewUser
|
|||
@dossier = current_user.dossiers.includes(:procedure).find(params[:id])
|
||||
end
|
||||
|
||||
def index
|
||||
@user_dossiers = current_user.dossiers.includes(:procedure).order_by_updated_at.page(page)
|
||||
@dossiers_invites = current_user.dossiers_invites.includes(:procedure).order_by_updated_at.page(page)
|
||||
|
||||
@current_tab = current_tab(@user_dossiers.count, @dossiers_invites.count)
|
||||
|
||||
@dossiers = case @current_tab
|
||||
when 'mes-dossiers'
|
||||
@user_dossiers
|
||||
when 'dossiers-invites'
|
||||
@dossiers_invites
|
||||
end
|
||||
end
|
||||
|
||||
def ask_deletion
|
||||
dossier = current_user.dossiers.includes(:user, procedure: :administrateur).find(params[:id])
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ module DossierHelper
|
|||
end
|
||||
|
||||
def url_for_dossier(dossier)
|
||||
if dossier.kind_of? Invite
|
||||
users_dossiers_invite_path(id: dossier.id)
|
||||
elsif dossier.brouillon?
|
||||
if dossier.brouillon?
|
||||
modifier_dossier_path(dossier)
|
||||
else
|
||||
users_dossier_recapitulatif_path(dossier)
|
||||
|
|
|
@ -56,5 +56,5 @@
|
|||
- else
|
||||
.dossiers-table-empty
|
||||
%h2.empty-text Aucun dossier.
|
||||
%p.empty-text-details Pour l’instant vous n’avez commencé aucune démarche.
|
||||
%p.empty-text-details Vous n’avez pas encore commencé de démarche.
|
||||
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button primary"
|
||||
|
|
|
@ -29,11 +29,6 @@ RSpec.describe DossierHelper, type: :helper do
|
|||
describe ".url_for_dossier" do
|
||||
subject { url_for_dossier(dossier) }
|
||||
|
||||
context "when the dossier is an invitation" do
|
||||
let(:dossier) { create(:invite) }
|
||||
it { is_expected.to eq "/users/dossiers/invites/#{dossier.id}" }
|
||||
end
|
||||
|
||||
context "when the dossier is in the brouillon state" do
|
||||
let(:dossier) { create(:dossier, state: 'brouillon') }
|
||||
it { is_expected.to eq "/dossiers/#{dossier.id}/modifier" }
|
||||
|
|
Loading…
Reference in a new issue