Mask cerfa link procedure if is blank

This commit is contained in:
Xavier J 2016-02-08 19:52:07 +01:00
parent a82899a43e
commit 1aa5e7c397
2 changed files with 36 additions and 3 deletions

View file

@ -37,10 +37,11 @@
'data-provide' => ('datepicker' if champ.type_champ == 'datetime'),
'data-date-format' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')}
%br
%h3 Documents administratifs
-if !@procedure.lien_demarche.blank? || @procedure.cerfa_flag || @dossier.pieces_justificatives.size > 1
%br
%h3 Documents administratifs
-if @procedure.lien_demarche != nil
-unless @procedure.lien_demarche.blank?
%p
Formulaire / documentation de la démarche :
%a{style:'font-size:0.9em; padding-left:3px', id: 'lien_cerfa' ,href: "#{@procedure.lien_demarche}", :target => '_blank'} Accéder
@ -76,6 +77,7 @@
%span.btn.btn-sm.btn-file.btn-success
Modifier
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: '.pdf'
%div{style: 'text-align:right'}
%h6 Tous les champs portant un * sont obligatoires.

View file

@ -138,4 +138,35 @@ describe 'users/description/show.html.haml', type: :view do
it { expect(rendered).to_not have_css("#cerfa_flag") }
it { expect(rendered).to_not have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]') }
end
describe 'display title Documents administratifs' do
before do
render
end
let(:procedure) { create :procedure, lien_demarche: '' }
let(:dossier) { create(:dossier, procedure: procedure) }
context 'when dossier not have cerfa, piece justificative and demarche link' do
it { expect(rendered).not_to have_content 'Documents administratifs' }
end
context 'when dossier have pj' do
let(:dossier) { create(:dossier) }
it { expect(rendered).to have_content 'Documents administratifs' }
end
context 'when procedure have demarche link' do
let(:procedure) { create :procedure }
it { expect(rendered).to have_content 'Documents administratifs' }
end
context 'when procedure have cerfa flag true' do
let(:procedure) {create(:procedure, cerfa_flag: true)}
it { expect(rendered).to have_content 'Documents administratifs' }
end
end
end