demarches-normaliennes/app/helpers/zone_helper.rb
Christophe Robillard 9a9330159c choose zone options with correct label
label of the zone is the one available when the procedure has been published (or at the creation if the procedure has not been published)
2022-09-26 16:58:53 +02:00

12 lines
383 B
Ruby

module ZoneHelper
def grouped_options_for_zone(date)
collectivite = Zone.find_by(acronym: "COLLECTIVITE")
{
"--" => [
[I18n.t('i_dont_know', scope: 'utils'), nil],
[collectivite.label, collectivite.id]
],
I18n.t('ministeres', scope: 'zones') => (Zone.available_at(date) - [collectivite]).map { |m| [m.label_at(date), m.id] }
}
end
end