2019-01-30 16:14:15 +01:00
|
|
|
|
- champs = champ.rows.last
|
2019-11-05 16:54:43 +01:00
|
|
|
|
- if champs.present?
|
|
|
|
|
- index = (champ.rows.size - 1) * champs.size
|
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-11-05 16:54:43 +01:00
|
|
|
|
- champs.each.with_index(index) do |champ, index|
|
|
|
|
|
= fields_for "#{attribute}[#{index}]", champ do |form|
|
|
|
|
|
= render partial: "shared/dossiers/editable_champs/editable_champ", locals: { champ: champ, form: form }
|
|
|
|
|
= form.hidden_field :id
|
|
|
|
|
= form.hidden_field :_destroy, disabled: true
|
2020-02-10 15:43:21 +01:00
|
|
|
|
.flex.row-reverse
|
|
|
|
|
%button.button.danger.remove-row
|
|
|
|
|
Supprimer l’élément
|