2019-01-30 16:14:15 +01:00
|
|
|
|
%div{ class: "repetition-#{form.index}" }
|
|
|
|
|
- champ.rows.each do |champs|
|
2020-08-20 15:56:41 +02:00
|
|
|
|
- row_dom_id = "row-#{SecureRandom.hex(4)}"
|
|
|
|
|
%div{ class: "row row-#{champs.first.row}", id: row_dom_id }
|
|
|
|
|
-# Tell the controller which DOM element should be removed once the row deletion is successful
|
|
|
|
|
= hidden_field_tag 'deleted_row_dom_ids[]', row_dom_id, disabled: true
|
|
|
|
|
|
2019-01-30 16:14:15 +01:00
|
|
|
|
- champs.each do |champ|
|
|
|
|
|
= form.fields_for :champs, champ do |form|
|
|
|
|
|
= render partial: 'shared/dossiers/editable_champs/editable_champ', locals: { champ: form.object, form: form }
|
|
|
|
|
= form.hidden_field :_destroy, disabled: true
|
2019-02-07 13:10:29 +01:00
|
|
|
|
.flex.row-reverse
|
|
|
|
|
- if champ.persisted?
|
2019-06-04 17:59:02 +02:00
|
|
|
|
%button.button.danger.remove-row{ type: :button }
|
2020-02-10 15:43:21 +01:00
|
|
|
|
Supprimer l’élément
|
2019-02-07 13:10:29 +01:00
|
|
|
|
- else
|
|
|
|
|
%button.button.danger{ type: :button }
|
2020-02-10 15:43:21 +01:00
|
|
|
|
Supprimer l’élément
|
2019-01-30 16:14:15 +01:00
|
|
|
|
|
|
|
|
|
- if champ.persisted?
|
2021-10-27 16:26:07 +02:00
|
|
|
|
= link_to champs_repetition_path(form.index), class: 'button add-row', data: { remote: true, disable: true, method: 'POST', params: { champ_id: champ&.id }.to_query } do
|
2019-10-23 13:17:11 +02:00
|
|
|
|
%span.icon.add
|
2020-02-10 15:43:21 +01:00
|
|
|
|
Ajouter un élément pour « #{champ.libelle} »
|
2019-02-07 13:10:29 +01:00
|
|
|
|
- else
|
2019-10-23 13:17:11 +02:00
|
|
|
|
%a.button.add-row
|
|
|
|
|
%span.icon.add
|
2020-02-10 15:43:21 +01:00
|
|
|
|
Ajouter un élément pour « #{champ.libelle} »
|