dossiers: add a button to start a new demarche

This commit is contained in:
Pierre de La Morinerie 2018-06-26 16:04:04 +00:00
parent 20aeae5029
commit 9f70e72d83
5 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,5 @@
.dossiers-headers {
.new-demarche {
float: right;
}
}

View file

@ -77,3 +77,7 @@
padding-right: $default-spacer;
}
}
.dossiers-table-empty {
text-align: center;
}

View file

@ -1,5 +1,7 @@
module NewUser
class DossiersController < UserController
helper_method :new_demarche_url
before_action :ensure_ownership!, except: [:index, :modifier, :update]
before_action :ensure_ownership_or_invitation!, only: [:modifier, :update]
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update]
@ -112,6 +114,10 @@ module NewUser
end
end
def new_demarche_url
"https://doc.demarches-simplifiees.fr/listes-des-demarches"
end
private
def ensure_dossier_can_be_updated

View file

@ -1,5 +1,7 @@
.dossiers-headers.sub-header
.container
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche"
- if @dossiers_invites.count == 0
%h1.page-title Mes dossiers
@ -52,4 +54,6 @@
= paginate(@dossiers)
- else
%h2.empty-text Aucun dossier.
.dossiers-table-empty
%h2.empty-text Aucun dossier.
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button primary"

View file

@ -7,6 +7,7 @@ describe 'new_user/dossiers/index.html.haml', type: :view do
let(:current_tab) { 'mes-dossiers' }
before do
allow(view).to receive(:new_demarche_url).and_return('#')
assign(:user_dossiers, Kaminari.paginate_array(user_dossiers).page(1))
assign(:dossiers_invites, Kaminari.paginate_array(dossiers_invites).page(1))
assign(:dossiers, Kaminari.paginate_array(user_dossiers).page(1))