demarches-normaliennes/app/controllers/root_controller.rb

63 lines
1.9 KiB
Ruby
Raw Normal View History

class RootController < ApplicationController
def index
if administrateur_signed_in?
2016-12-19 16:54:41 +01:00
return redirect_to admin_procedures_path
elsif instructeur_signed_in?
return redirect_to instructeur_procedures_path
elsif user_signed_in?
return redirect_to dossiers_path
2016-02-23 16:51:24 +01:00
elsif administration_signed_in?
2018-01-16 17:09:25 +01:00
return redirect_to manager_root_path
end
2016-12-14 18:41:33 +01:00
2017-06-14 14:42:09 +02:00
render 'landing'
end
def administration
end
2017-06-14 14:42:09 +02:00
def patron
description = 'aller voir le super site : https://demarches-simplifiees.fr'
2017-08-02 15:29:12 +02:00
2017-08-02 14:56:08 +02:00
all_champs = TypeDeChamp.type_champs
.map { |name, _| TypeDeChamp.new(type_champ: name, private: false, libelle: name, description: description, mandatory: true) }
2018-02-09 17:38:30 +01:00
.map.with_index { |type_de_champ, i| type_de_champ.champ.build(id: i) }
2017-08-02 14:56:08 +02:00
all_champs
2019-09-12 11:26:22 +02:00
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section) }
.each { |champ| champ.type_de_champ.libelle = 'un super titre de section' }
2017-08-02 14:56:08 +02:00
all_champs
2019-09-12 11:26:22 +02:00
.filter { |champ| [TypeDeChamp.type_champs.fetch(:drop_down_list), TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)].include?(champ.type_champ) }
.each do |champ|
champ.type_de_champ.drop_down_list = DropDownList.new(type_de_champ: champ.type_de_champ)
champ.drop_down_list.value =
"option A
option B
-- avant l'option C --
option C"
champ.value = '["option B", "option C"]'
end
type_champ_values = {
2018-08-28 11:52:15 +02:00
TypeDeChamp.type_champs.fetch(:date) => '2016-07-26',
TypeDeChamp.type_champs.fetch(:datetime) => '26/07/2016 07:35',
TypeDeChamp.type_champs.fetch(:textarea) => 'Une description de mon projet'
}
type_champ_values.each do |(type_champ, value)|
2017-08-02 14:56:08 +02:00
all_champs
2019-09-12 11:26:22 +02:00
.filter { |champ| champ.type_champ == type_champ }
.each { |champ| champ.value = value }
end
2017-08-02 14:56:08 +02:00
@dossier = Dossier.new(champs: all_champs)
end
2018-11-07 16:54:18 +01:00
def accessibilite
end
2018-11-07 16:54:18 +01:00
def suivi
end
end