Add carte type de champ options

This commit is contained in:
Paul Chavard 2018-10-17 13:07:51 +03:00
parent b40abaa133
commit 4249f8ae25
5 changed files with 19 additions and 1 deletions

View file

@ -27,6 +27,7 @@ $(document).on('change', 'select.form-control.type-champ', function() {
parent.removeClass('header-section');
parent.children('.drop-down-list').removeClass('show-inline');
parent.children('.pj-template').removeClass('show-inline');
parent.children('.carte-options').removeClass('show-inline');
$('.mandatory', parent).show();
@ -42,6 +43,9 @@ $(document).on('change', 'select.form-control.type-champ', function() {
case 'piece_justificative':
parent.children('.pj-template').addClass('show-inline');
break;
case 'carte':
parent.children('.carte-options').addClass('show-inline');
break;
case 'explication':
$('.mandatory', parent).hide();
break;

View file

@ -32,7 +32,8 @@
}
.form-group.drop-down-list,
.form-group.pj-template {
.form-group.pj-template,
.form-group.carte-options {
display: none;
}

View file

@ -14,6 +14,8 @@ class TypesDeChampService
:id,
:mandatory,
:piece_justificative_template,
:quartiers_prioritaires,
:cadastres,
drop_down_list_attributes: [:value, :id]
])

View file

@ -38,6 +38,16 @@
= ff.file_field :piece_justificative_template,
direct_upload: true
.form-group.carte-options{ class: (type_champ == TypeDeChamp.type_champs.fetch(:carte)) ? 'show-inline' : nil }
%h4 Utilisation de la cartographie
%label
= ff.check_box :quartiers_prioritaires
Quartiers prioritaires
%br
%label
= ff.check_box :cadastres
Cadastre
- hide_mandatory = (ff.object.object.private? || type_champ == TypeDeChamp.type_champs.fetch(:explication))
.form-group.mandatory{ style: hide_mandatory ? 'visibility: hidden;' : nil }
%h4 Obligatoire ?

View file

@ -28,3 +28,4 @@ fr:
dossier_link: 'Lien vers un autre dossier'
piece_justificative: 'Pièce justificative'
siret: 'SIRET'
carte: 'Carte'