diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 8d5cfec18..0bb093d67 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -33,7 +33,7 @@ class RootController < ApplicationController def patron @all_champs = TypeDeChamp.type_champs - .map { |name, _| TypeDeChamp.new(type_champ: name, libelle: name) } + .map { |name, _| TypeDeChamp.new(type_champ: name, libelle: name, mandatory: true) } .map { |type_de_champ| Champ.new(type_de_champ: type_de_champ) } .map.with_index do |champ, i| champ.id = i diff --git a/app/views/new_gestionnaire/dossiers/champs/_address.html.haml b/app/views/new_gestionnaire/dossiers/champs/_address.html.haml index 34f1ce5e9..e42aa8584 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_address.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_address.html.haml @@ -4,4 +4,5 @@ name: "champs['#{champ.id}']", id: "champs_#{champ.id}", placeholder: champ.libelle, - value: champ.value } + value: champ.value, + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml index e99954f45..7807b7c6a 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml @@ -1 +1 @@ -%label{ for: :"champs_#{champ.id}" }>= champ.libelle +%label{ for: :"champs_#{champ.id}" }> #{champ.libelle} #{champ.mandatory ? '*' : nil} diff --git a/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml b/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml index 5722da3bc..09600b354 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml @@ -3,6 +3,7 @@ %input{ type: 'checkbox', name: "champs['#{champ.id}']", id: "champs_#{champ.id}", - checked: ('checked' if champ.value == 'on') } + checked: ('checked' if champ.value == 'on'), + required: champ.mandatory } %br diff --git a/app/views/new_gestionnaire/dossiers/champs/_date.html.haml b/app/views/new_gestionnaire/dossiers/champs/_date.html.haml index fc8e807ce..0e8060144 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_date.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_date.html.haml @@ -4,4 +4,5 @@ placeholder: "JJ/MM/AAAA", id: "champs_#{champ.id}", value: champ.value, - type: "date" } + type: "date", + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml b/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml index 4819347a3..8704e17bc 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml @@ -5,15 +5,16 @@ placeholder: champ.libelle, id: "champs_#{champ.id}", value: (champ.value.split(/[ ][0-9]*:[0-9]*/).first unless champ.value.nil?), - type: 'date' } + type: 'date', + required: champ.mandatory } - %select{ name: "time_hour['#{champ.id}']", id: "time_hour_#{champ.id}" } + %select{ name: "time_hour['#{champ.id}']", id: "time_hour_#{champ.id}", required: champ.mandatory } - (0..23).each do |num| - num = "%.2i" %num %option{ value: num, selected: (:selected if champ.same_hour?(num)) } = num h - %select{ name: "time_minute['#{champ.id}']", id: "time_minute_#{champ.id}" } + %select{ name: "time_minute['#{champ.id}']", id: "time_minute_#{champ.id}", required: champ.mandatory } - (0..55).step(5) do |num| - num = "%.2i" %num %option{ value: num, selected: (:selected if champ.same_minute?(num)) } diff --git a/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml b/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml index 647ab8d9e..8ecf58dc3 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml @@ -12,7 +12,8 @@ value: champ.value, type: 'number', 'autocomplete' => 'off', - 'data-type' => 'dossier-link' } + 'data-type' => 'dossier-link', + required: champ.mandatory } .help-block %p.text-info{ style: show_text_summary ? nil : 'display: none;' } diff --git a/app/views/new_gestionnaire/dossiers/champs/_email.html.haml b/app/views/new_gestionnaire/dossiers/champs/_email.html.haml index 727d092e4..6684b7865 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_email.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_email.html.haml @@ -4,4 +4,5 @@ name: "champs['#{champ.id}']", id: "champs_#{champ.id}", placeholder: champ.libelle, - value: champ.value } + value: champ.value, + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml b/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml index 5722da3bc..09600b354 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml @@ -3,6 +3,7 @@ %input{ type: 'checkbox', name: "champs['#{champ.id}']", id: "champs_#{champ.id}", - checked: ('checked' if champ.value == 'on') } + checked: ('checked' if champ.value == 'on'), + required: champ.mandatory } %br diff --git a/app/views/new_gestionnaire/dossiers/champs/_number.html.haml b/app/views/new_gestionnaire/dossiers/champs/_number.html.haml index dd66c4e8f..5e2b61e8d 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_number.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_number.html.haml @@ -4,4 +4,5 @@ name: "champs['#{champ.id}']", id: "champs_#{champ.id}", placeholder: champ.libelle, - value: champ.value } + value: champ.value, + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml b/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml index fcc6e043e..c1bbfd1ce 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml @@ -4,4 +4,5 @@ name: "champs['#{champ.id}']", id: "champs_#{champ.id}", placeholder: champ.libelle, - value: champ.value } + value: champ.value, + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_text.html.haml b/app/views/new_gestionnaire/dossiers/champs/_text.html.haml index 34f1ce5e9..e42aa8584 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_text.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_text.html.haml @@ -4,4 +4,5 @@ name: "champs['#{champ.id}']", id: "champs_#{champ.id}", placeholder: champ.libelle, - value: champ.value } + value: champ.value, + required: champ.mandatory } diff --git a/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml b/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml index 4f057c115..37c5e031d 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml @@ -3,5 +3,6 @@ %textarea{ name: "champs['#{champ.id}']", placeholder: champ.description, id: "champs_#{champ.id}", - row: '6' } + row: '6', + required: champ.mandatory } = sanitize(champ.value)