- Fix display private form
- Refacto code private form
This commit is contained in:
parent
d4522ae82e
commit
cd7b7e4055
9 changed files with 26 additions and 79 deletions
|
@ -1,6 +1,5 @@
|
|||
.default_data_block {
|
||||
font-family: Arial;
|
||||
margin-top: 40px;
|
||||
|
||||
.show-block {
|
||||
width: 840px;
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
.type_champ-header_section {
|
||||
@extend .col-md-12;
|
||||
@extend .col-lg-12;
|
||||
|
||||
margin-bottom: -25px;
|
||||
}
|
||||
|
||||
.type_champ-address {
|
||||
|
|
|
@ -19,7 +19,12 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
|
||||
def show
|
||||
create_dossier_facade params[:id]
|
||||
@champs = @facade.champs_private unless @facade.nil?
|
||||
@champs_private = @facade.champs_private unless @facade.nil?
|
||||
|
||||
@headers_private = @champs_private.inject([]) do |acc, champ|
|
||||
acc.push(champ) if champ.type_champ == 'header_section'
|
||||
acc
|
||||
end
|
||||
end
|
||||
|
||||
def filter
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.default_data_block
|
||||
.default_data_block{style:'margin-top: 40px'}
|
||||
.row.show-block#messages
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.title
|
||||
|
@ -100,16 +100,16 @@
|
|||
= render partial: 'users/carte/init_carto', locals: {dossier: @facade.dossier}
|
||||
|
||||
|
||||
- if @current_gestionnaire && gestionnaire_signed_in? && @champs.count > 0
|
||||
.default_data_block
|
||||
- if @current_gestionnaire && gestionnaire_signed_in? && @champs_private.count > 0
|
||||
.default_data_block.default_visible
|
||||
%div.row.show-block#private-fields
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
= "champs".upcase
|
||||
= "formulaire privé".upcase
|
||||
%div.col-lg-2.col-md-2.count
|
||||
- private_fields_count = @champs.count
|
||||
- private_fields_count = @champs_private.count
|
||||
= (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs"
|
||||
%div.body
|
||||
= render partial: '/dossiers/infos_private_fields'
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
.row
|
||||
.row{style: 'margin-top: -20px'}
|
||||
.col-md-12.col-lg-12
|
||||
- if @champs.nil? || @champs.empty?
|
||||
%h4.text-primary.center
|
||||
Pas de champ privé pour ce dossier
|
||||
- else
|
||||
= form_for @facade.dossier, url: {controller: 'backoffice/private_formulaires', action: :update, dossier_id: @facade.dossier.id}, remote: true do
|
||||
= render partial: '/users/description/champs', locals:{private: true}
|
||||
.row
|
||||
.col-md-4.col-lg-4
|
||||
.col-md-4.col-lg-4= submit_tag :Enregistrer, {class: 'btn-action'}
|
||||
.col-md-4.col-lg-4
|
||||
= form_for @facade.dossier, url: {controller: 'backoffice/private_formulaires', action: :update, dossier_id: @facade.dossier.id}, remote: true do
|
||||
= render partial: '/users/description/champs', locals:{private: true}
|
||||
.row.center
|
||||
= submit_tag :Enregistrer, {class: 'btn-action'}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
- render_partial_url = private ? 'users/description/champs/header_private_section' : 'users/description/champs/header_section'
|
||||
- @champs = @champs_private if private
|
||||
- @headers = @headers_private if private
|
||||
|
||||
- unless @headers.blank?
|
||||
- if @champs.first.type_champ != 'header_section'
|
||||
=render partial: render_partial_url, locals: {libelle: 'Dossier', order_place: -1, champs: @champs}
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
|
||||
-#TODO use form_for
|
||||
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
|
||||
|
||||
#liste_champs
|
||||
-unless @champs.nil?
|
||||
-unless @champs.nil?
|
||||
#liste_champs
|
||||
=render partial: 'users/description/champs', locals:{private: false}
|
||||
|
||||
-if !@procedure.lien_demarche.blank? || @procedure.cerfa_flag || @dossier.types_de_piece_justificative.size > 0
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
.row
|
||||
.col-lg-2.col-md-2
|
||||
.col-lg-8.col-md-8
|
||||
.col-lg-12.col-md-12
|
||||
%br
|
||||
%h3.text-info
|
||||
=libelle
|
||||
= render partial: 'users/description/champs/render_list_champs', locals: {champs: champs, order_place: order_place}
|
||||
|
|
|
@ -6,57 +6,4 @@
|
|||
%div.carret-down
|
||||
=libelle
|
||||
%div.body
|
||||
-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
|
||||
= render partial: 'users/description/champs/render_list_champs', locals: {champs: champs, order_place: order_place}
|
Loading…
Reference in a new issue