Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-10-12 14:45:04 +02:00
commit 88601243b6
8 changed files with 105 additions and 27 deletions

View file

@ -23,6 +23,7 @@ function action_type_de_champs() {
});
address_type_init();
toggle_header_section_composents();
}
function toggleErrorClass(node, boolean) {
@ -45,3 +46,21 @@ function validateEmail(email) {
function validateInput(input, regex) {
return regex.test(input);
}
function toggle_header_section_composents() {
$("a.mask_section_button").on('click', function (e) {
target = e.currentTarget;
header_section_id = target.id.split('mask_button_')[1];
header_section_composents = $(".header_section_" + header_section_id);
header_section_composents.slideToggle(200, function(){
if (header_section_composents.css('display') == 'none') {
$(target).html('Afficher la section <i class="fa fa-chevron-down" />')
}
else {
$(target).html('Masquer la section <i class="fa fa-chevron-up" />')
}
});
});
}

View file

@ -2,13 +2,18 @@
=render partial: 'head', locals: {active: 'Informations'}
-unless @facade.procedure.published?
%a#publish.btn.btn-success{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
%i.fa.fa-eraser
Publier
- if @facade.procedure.gestionnaires.size == 0
%a.action_button.btn.btn-success{style:'float: right; margin-top: 10px', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.'}
%i.fa.fa-eraser
Publier
-else
%a#publish.btn.btn-success{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
%i.fa.fa-eraser
Publier
=render partial: '/admin/procedures/modal_publish'
%a#transfer.btn.btn-small.btn-default{"data-target" => "#transferModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
%a#transfer.btn.btn-small.btn-default{"data-target" => "#transferModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px; margin-right: 10px'}
%i.fa.fa-exchange
Transférer

View file

@ -4,6 +4,33 @@
%h3
= @facade.dossier.procedure.libelle
- if @facade.procedure.for_individual?
%br
.individual.text-info
%h4 Dépositaire
%table.table{style:'width: 60%'}
%tr
%th.col-md-3.col-lg-3
Civilité
%td.col-md-5.col-lg-5
= @facade.individual.gender
%tr
%th.col-md-3.col-lg-3
Nom
%td.col-md-5.col-lg-5
= @facade.individual.nom
%tr
%th.col-md-3.col-lg-3
Prénom
%td.col-md-5.col-lg-5
= @facade.individual.prenom
%tr
%th.col-md-3.col-lg-3
Date de naissance
%td.col-md-5.col-lg-5
= @facade.individual.birthdate
- if @facade.dossier.mandataire_social && gestionnaire_signed_in?
.mandataire_social.text-success.center
%br

View file

@ -1,26 +1,25 @@
-actual_header_section = nil
-@champs.each do |champ|
.row
.row{class: (actual_header_section.nil? || champ.type_champ == 'header_section' ? '' : "header_section_"+actual_header_section.to_s)}
%div{class: "type_champ-#{champ.type_champ}"}
-if champ.type_champ == 'checkbox'
%h4{style:'margin-left:15px;'}
= champ.libelle
- if champ.mandatory?
= '*'
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
- elsif champ.type_champ == 'header_section'
- if champ.type_champ == 'header_section'
=render partial: 'users/description/champs/header_section', locals: {champ: champ}
-actual_header_section = champ.id
-else
%h4
= champ.libelle
- if champ.mandatory?
= '*'
- unless champ.type_champ == 'checkbox'
%h4
= champ.libelle
- if champ.mandatory?
= '*'
-if champ.type_champ == 'textarea'
=render partial: 'users/description/champs/textarea', locals: {champ: champ}
-elsif champ.type_champ == 'checkbox'
= render partial: 'users/description/champs/checkbox', locals: {champ: champ}
-elsif champ.type_champ == 'civilite'
=render partial: 'users/description/champs/civilite', locals: {champ: champ}

View file

@ -0,0 +1,6 @@
%h4{style:'margin-left:15px;'}
= champ.libelle
- if champ.mandatory?
= '*'
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}

View file

@ -1,2 +1,6 @@
%h3.text-primary.page-header
=champ.libelle
=champ.libelle
%span.mask_section{style:'float: right'}
%a.mask_section_button.btn.btn-xs.btn-default{id: "mask_button_"+champ.id.to_s}
Masquer la section
%i.fa.fa-chevron-up

View file

@ -21,6 +21,8 @@
= @facade.dossier.display_state
%br
- unless @facade.entreprise.nil?
= render partial: '/dossiers/infos_entreprise'
= render partial: '/dossiers/infos_dossier'

View file

@ -10,18 +10,34 @@ describe 'admin/procedures/show.html.haml', type: :view do
end
describe 'procedure is draft' do
before do
render
context 'when procedure does not have a gestionnare affected' do
before do
render
end
describe 'publish button is not visible' do
it { expect(rendered).not_to have_css('a#publish') }
it { expect(rendered).not_to have_css('button#archive') }
it { expect(rendered).not_to have_css('a#reenable') }
end
end
describe 'publish button is visible' do
it { expect(rendered).to have_css('a#publish') }
it { expect(rendered).not_to have_css('button#archive') }
it { expect(rendered).not_to have_css('a#reenable') }
end
context 'when procedure have a gestionnare affected' do
describe 'procedure link is not present' do
it { expect(rendered).to have_content('Cette procédure n\'a pas encore été publiée et n\'est donc pas accessible par le public.') }
before do
create :assign_to, gestionnaire: create(:gestionnaire), procedure: procedure
render
end
describe 'publish button is visible' do
it { expect(rendered).to have_css('a#publish') }
it { expect(rendered).not_to have_css('button#archive') }
it { expect(rendered).not_to have_css('a#reenable') }
end
describe 'procedure link is not present' do
it { expect(rendered).to have_content('Cette procédure n\'a pas encore été publiée et n\'est donc pas accessible par le public.') }
end
end
end