PiecesJustificative: add field to set it mandatory
small css to align the fields
This commit is contained in:
parent
a907b9c062
commit
e49ea2d0e0
3 changed files with 37 additions and 29 deletions
3
app/assets/stylesheets/pieces_justificatives_fields.scss
Normal file
3
app/assets/stylesheets/pieces_justificatives_fields.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.pieces_justificatives_fields {
|
||||||
|
.form-inline > .form-group { vertical-align: top; }
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ class Admin::PiecesJustificativesController < AdminController
|
||||||
def update_params
|
def update_params
|
||||||
params
|
params
|
||||||
.require(:procedure)
|
.require(:procedure)
|
||||||
.permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place, :lien_demarche])
|
.permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place, :mandatory, :lien_demarche])
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_up
|
def move_up
|
||||||
|
|
|
@ -1,31 +1,36 @@
|
||||||
= f.fields_for :types_de_piece_justificative, types_de_piece_justificative, remote: true do |ff|
|
.pieces_justificatives_fields
|
||||||
.form-inline
|
= f.fields_for :types_de_piece_justificative, types_de_piece_justificative, remote: true do |ff|
|
||||||
.form-group
|
.form-inline
|
||||||
%h4 Libellé
|
.form-group
|
||||||
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
%h4 Libellé
|
||||||
.form-group
|
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
||||||
%h4 Description
|
.form-group
|
||||||
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
%h4 Description
|
||||||
.form-group
|
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
||||||
%h4
|
.form-group
|
||||||
Lien du formulaire vierge
|
%h4
|
||||||
%small
|
Lien du formulaire vierge
|
||||||
(optionel)
|
%small
|
||||||
= ff.url_field :lien_demarche, class: 'form-control', placeholder: 'Lien du document vierge'
|
(optionel)
|
||||||
|
= ff.url_field :lien_demarche, class: 'form-control', placeholder: 'Lien du document vierge'
|
||||||
|
|
||||||
|
.form-group
|
||||||
|
= ff.hidden_field :order_place, value: ff.index
|
||||||
|
= ff.hidden_field :id
|
||||||
|
- unless ff.object.id.nil?
|
||||||
|
.form-group
|
||||||
|
%br
|
||||||
|
= ff.object.button_up(index: ff.index, url: move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
||||||
|
= ff.object.button_down(index: ff.index, url: move_down_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
||||||
|
|
||||||
|
.form-group
|
||||||
|
%h4 Obligatoire ?
|
||||||
|
.center
|
||||||
|
= ff.check_box :mandatory
|
||||||
|
|
||||||
.form-group
|
|
||||||
= ff.hidden_field :order_place, value: ff.index
|
|
||||||
= ff.hidden_field :id
|
|
||||||
- unless ff.object.id.nil?
|
|
||||||
.form-group
|
.form-group
|
||||||
%br
|
%br
|
||||||
= ff.object.button_up(index: ff.index, url: move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
- if ff.object.id.nil?
|
||||||
= ff.object.button_down(index: ff.index, url: move_down_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
= f.submit('Ajouter la pièce', class: 'btn btn-success', id: 'add_piece_justificative')
|
||||||
|
- else
|
||||||
|
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )
|
||||||
.form-group
|
|
||||||
%br
|
|
||||||
- if ff.object.id.nil?
|
|
||||||
= f.submit('Ajouter la pièce', class: 'btn btn-success', id: 'add_piece_justificative')
|
|
||||||
- else
|
|
||||||
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )
|
|
||||||
|
|
Loading…
Reference in a new issue