Fix description view for champs and private champs

This commit is contained in:
Xavier J 2016-12-07 15:44:28 +01:00
parent 16bdd1666b
commit 6f731f700f
6 changed files with 119 additions and 55 deletions

View file

@ -5,7 +5,7 @@
Pas de champ privé pour ce dossier Pas de champ privé pour ce dossier
- else - else
= form_for @facade.dossier, url: {controller: 'backoffice/private_formulaires', action: :update, dossier_id: @facade.dossier.id}, remote: true do = form_for @facade.dossier, url: {controller: 'backoffice/private_formulaires', action: :update, dossier_id: @facade.dossier.id}, remote: true do
= render partial: '/users/description/champs' = render partial: '/users/description/champs', locals:{private: true}
.row .row
.col-md-4.col-lg-4 .col-md-4.col-lg-4
.col-md-4.col-lg-4= submit_tag :Enregistrer, {class: 'btn-action'} .col-md-4.col-lg-4= submit_tag :Enregistrer, {class: 'btn-action'}

View file

@ -1,8 +1,9 @@
- unless @headers.nil? - render_partial_url = private ? 'users/description/champs/header_private_section' : 'users/description/champs/header_section'
- unless @headers.empty?
- @headers.each do |header| - @headers.each do |header|
.row .row
%div{class: "type_champ-#{header.type_champ}"} %div{class: "type_champ-#{header.type_champ}"}
=render partial: 'users/description/champs/header_section', locals: {libelle: header.libelle, order_place: header.order_place, champs: @champs} =render partial: render_partial_url, locals: {libelle: header.libelle, order_place: header.order_place, champs: @champs}
- else - else
.row .row
=render partial: 'users/description/champs/header_section', locals: {libelle: 'Dossier', order_place: -1, champs: @champs} =render partial: render_partial_url, locals: {libelle: 'Dossier', order_place: -1, champs: @champs}

View file

@ -19,7 +19,7 @@
#liste_champs #liste_champs
-unless @champs.nil? -unless @champs.nil?
=render partial: 'users/description/champs' =render partial: 'users/description/champs', locals:{private: false}
-if !@procedure.lien_demarche.blank? || @procedure.cerfa_flag || @dossier.types_de_piece_justificative.size > 0 -if !@procedure.lien_demarche.blank? || @procedure.cerfa_flag || @dossier.types_de_piece_justificative.size > 0
%br %br

View file

@ -0,0 +1,10 @@
.row
.col-lg-12.col-md-12
.row.title-row
.col-md-4.col-lg-4.split-hr
.col-md-4.col-lg-4.dossier-title= libelle
.col-md-4.col-lg-4.split-hr
.row
.col-lg-4.col-md-4
.col-lg-8.col-md-8
=render partial: 'users/description/champs/render_list_champs', locals: {champs: champs, order_place: order_place}

View file

@ -1,63 +1,62 @@
.row .default_data_block.default_visible
.col-lg-12.col-md-12 %div.row.show-block#infos
.row.title-row %div.header
.col-md-4.col-lg-4.split-hr %div.col-lg-12.col-md-12.title
.col-md-4.col-lg-4.dossier-title= libelle %div.carret-right
.col-md-4.col-lg-4.split-hr %div.carret-down
.row =libelle
.col-lg-4.col-md-4 %div.body
.col-lg-8.col-md-8 -champs.each do |champ|
-champs.each do |champ| - if champ.order_place > order_place
- if champ.order_place > order_place - if champ.type_champ == 'header_section'
- if champ.type_champ == 'header_section' - break
- break
- unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement' - unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement'
%h4 %h4
= champ.libelle = champ.libelle
- if champ.mandatory? - if champ.mandatory?
= '*' = '*'
-if champ.type_champ == 'textarea' -if champ.type_champ == 'textarea'
=render partial: 'users/description/champs/textarea', locals: {champ: champ} =render partial: 'users/description/champs/textarea', locals: {champ: champ}
-elsif champ.type_champ == 'checkbox' -elsif champ.type_champ == 'checkbox'
= render partial: 'users/description/champs/checkbox', locals: {champ: champ} = render partial: 'users/description/champs/checkbox', locals: {champ: champ}
-elsif champ.type_champ == 'civilite' -elsif champ.type_champ == 'civilite'
=render partial: 'users/description/champs/civilite', locals: {champ: champ} =render partial: 'users/description/champs/civilite', locals: {champ: champ}
- elsif champ.type_champ == 'datetime' - elsif champ.type_champ == 'datetime'
=render partial: 'users/description/champs/datetime', locals: {champ: champ} =render partial: 'users/description/champs/datetime', locals: {champ: champ}
- elsif champ.type_champ == 'yes_no' - elsif champ.type_champ == 'yes_no'
=render partial: 'users/description/champs/yes_no', locals: {champ: champ} =render partial: 'users/description/champs/yes_no', locals: {champ: champ}
- elsif champ.type_champ == 'drop_down_list' - elsif champ.type_champ == 'drop_down_list'
=render partial: 'users/description/champs/drop_down_list', locals: {champ: champ} =render partial: 'users/description/champs/drop_down_list', locals: {champ: champ}
- elsif champ.type_champ == 'pays' - elsif champ.type_champ == 'pays'
=render partial: 'users/description/champs/pays', locals: {champ: champ} =render partial: 'users/description/champs/pays', locals: {champ: champ}
- elsif champ.type_champ == 'regions' - elsif champ.type_champ == 'regions'
=render partial: 'users/description/champs/regions', locals: {champ: champ} =render partial: 'users/description/champs/regions', locals: {champ: champ}
- elsif champ.type_champ == 'engagement' - elsif champ.type_champ == 'engagement'
=render partial: 'users/description/champs/engagement', locals: {champ: champ} =render partial: 'users/description/champs/engagement', locals: {champ: champ}
- elsif champ.type_champ == 'departements' - elsif champ.type_champ == 'departements'
=render partial: 'users/description/champs/departements', locals: {champ: champ} =render partial: 'users/description/champs/departements', locals: {champ: champ}
-else -else
%input.form-control{name:"champs['#{champ.id}']", %input.form-control{name:"champs['#{champ.id}']",
placeholder: champ.libelle, placeholder: champ.libelle,
id: "champs_#{champ.id}", id: "champs_#{champ.id}",
value: champ.value, value: champ.value,
type: champ.type_champ, type: champ.type_champ,
'data-provide' => champ.data_provide, 'data-provide' => champ.data_provide,
'data-date-format' => champ.data_date_format} 'data-date-format' => champ.data_date_format}
- unless champ.description.empty? || champ.type_champ == 'engagement' - unless champ.description.empty? || champ.type_champ == 'engagement'
.row .row
.col-lg-8.col-md-8{class: 'description_div', id:"description_champs_#{champ.id}"} .col-lg-8.col-md-8{class: 'description_div', id:"description_champs_#{champ.id}"}
= champ.description = champ.description

View file

@ -0,0 +1,54 @@
-champs.each do |champ|
- if champ.order_place > order_place
- if champ.type_champ == 'header_section'
- break
- unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement'
%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}
- elsif champ.type_champ == 'datetime'
=render partial: 'users/description/champs/datetime', locals: {champ: champ}
- elsif champ.type_champ == 'yes_no'
=render partial: 'users/description/champs/yes_no', locals: {champ: champ}
- elsif champ.type_champ == 'drop_down_list'
=render partial: 'users/description/champs/drop_down_list', locals: {champ: champ}
- elsif champ.type_champ == 'pays'
=render partial: 'users/description/champs/pays', locals: {champ: champ}
- elsif champ.type_champ == 'regions'
=render partial: 'users/description/champs/regions', locals: {champ: champ}
- elsif champ.type_champ == 'engagement'
=render partial: 'users/description/champs/engagement', locals: {champ: champ}
- elsif champ.type_champ == 'departements'
=render partial: 'users/description/champs/departements', locals: {champ: champ}
-else
%input.form-control{name:"champs['#{champ.id}']",
placeholder: champ.libelle,
id: "champs_#{champ.id}",
value: champ.value,
type: champ.type_champ,
'data-provide' => champ.data_provide,
'data-date-format' => champ.data_date_format}
- unless champ.description.empty? || champ.type_champ == 'engagement'
.row
.col-lg-8.col-md-8{class: 'description_div', id:"description_champs_#{champ.id}"}
= champ.description