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,
|
||||
'data-address': 'true',
|
||||
placeholder: champ.libelle,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
.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}",
|
||||
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,
|
||||
{ required: champ.mandatory },
|
||||
'on',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at }
|
||||
|
||||
.radios
|
||||
%label
|
||||
= 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,
|
||||
value: champ.value,
|
||||
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
|
||||
|
||||
.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,
|
||||
Champ.departements,
|
||||
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)
|
||||
- show_text_summary = dossier.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?
|
||||
= form.select :value,
|
||||
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,
|
||||
placeholder: champ.libelle,
|
||||
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,
|
||||
{ required: champ.mandatory },
|
||||
'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?
|
||||
= form.select :value,
|
||||
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,
|
||||
placeholder: champ.libelle,
|
||||
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,
|
||||
Champ.pays,
|
||||
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,
|
||||
placeholder: champ.libelle,
|
||||
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,
|
||||
Champ.regions,
|
||||
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,
|
||||
placeholder: champ.libelle,
|
||||
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,
|
||||
row: 6,
|
||||
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
|
||||
%label
|
||||
= form.radio_button :value, true
|
||||
|
|
Loading…
Reference in a new issue