Merge pull request #1104 from sgmap/template-refactor
Mutualize a duplicated render instruction
This commit is contained in:
commit
410a12b966
20 changed files with 9 additions and 37 deletions
5
app/helpers/champ_helper.rb
Normal file
5
app/helpers/champ_helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module ChampHelper
|
||||||
|
def is_not_header_nor_explication?(champ)
|
||||||
|
!['header_section', 'explication'].include?(champ.type_champ)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.text_field :value,
|
= form.text_field :value,
|
||||||
'data-address': 'true',
|
'data-address': 'true',
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
.champ
|
.champ
|
||||||
|
- if is_not_header_nor_explication?(champ)
|
||||||
|
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
||||||
|
|
||||||
= render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}",
|
= render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}",
|
||||||
locals: { champ: champ, form: form, seen_at: seen_at }
|
locals: { champ: champ, form: form }
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.check_box :value,
|
= form.check_box :value,
|
||||||
{ required: champ.mandatory },
|
{ required: champ.mandatory },
|
||||||
'on',
|
'on',
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
.radios
|
.radios
|
||||||
%label
|
%label
|
||||||
= form.radio_button :value, 'M.'
|
= form.radio_button :value, 'M.'
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.date_field :value,
|
= form.date_field :value,
|
||||||
value: champ.value,
|
value: champ.value,
|
||||||
placeholder: 'JJ/MM/AAAA',
|
placeholder: 'JJ/MM/AAAA',
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
- parsed_value = champ.value.present? ? DateTime.parse(champ.value) : DateTime.now
|
- parsed_value = champ.value.present? ? DateTime.parse(champ.value) : DateTime.now
|
||||||
|
|
||||||
.datetime
|
.datetime
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
Champ.departements,
|
Champ.departements,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
- dossier = Dossier.find_by(id: champ.value)
|
- dossier = Dossier.find_by(id: champ.value)
|
||||||
- show_text_summary = dossier.present?
|
- show_text_summary = dossier.present?
|
||||||
- show_warning = !show_text_summary && champ.value.present?
|
- show_warning = !show_text_summary && champ.value.present?
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
champ.drop_down_list.options,
|
champ.drop_down_list.options,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.email_field :value,
|
= form.email_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.check_box :value,
|
= form.check_box :value,
|
||||||
{ required: champ.mandatory },
|
{ required: champ.mandatory },
|
||||||
'on',
|
'on',
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
champ.drop_down_list.options,
|
champ.drop_down_list.options,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.number_field :value,
|
= form.number_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
Champ.pays,
|
Champ.pays,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.phone_field :value,
|
= form.phone_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
Champ.regions,
|
Champ.regions,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
= form.text_field :value,
|
= form.text_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory
|
required: champ.mandatory
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
~ form.text_area :value,
|
~ form.text_area :value,
|
||||||
row: 6,
|
row: 6,
|
||||||
placeholder: champ.description,
|
placeholder: champ.description,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
|
||||||
|
|
||||||
.radios
|
.radios
|
||||||
%label
|
%label
|
||||||
= form.radio_button :value, true
|
= form.radio_button :value, true
|
||||||
|
|
Loading…
Reference in a new issue