add wizard

This commit is contained in:
Eric Leroy-Terquem 2023-04-27 10:10:57 +02:00 committed by LeSim
parent 2e1b8b9ef2
commit 526f70f9c0
3 changed files with 27 additions and 0 deletions

View file

@ -62,6 +62,18 @@ module Administrateurs
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
end
def wizard
if params[:choice][:state] == 'routage_custom'
new_label = procedure.defaut_groupe_instructeur.label + ' bis'
procedure.groupe_instructeurs
.create({ label: new_label, instructeurs: [current_administrateur.instructeur] })
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
elsif params[:choice][:state] == 'routage_simple'
redirect_to simple_routing_admin_procedure_groupe_instructeurs_path
end
end
def show
@procedure = procedure
@groupe_instructeur = groupe_instructeur

View file

@ -0,0 +1,14 @@
import { Controller } from '@hotwired/stimulus';
export class RadioEnabledSubmitController extends Controller {
static targets = ['submit'];
declare readonly submitTarget: HTMLButtonElement;
click() {
if (
this.element.querySelectorAll('input[type="radio"]:checked').length > 0
) {
this.submitTarget.disabled = false;
}
}
}

View file

@ -535,6 +535,7 @@ Rails.application.routes.draw do
get 'options'
get 'ajout'
post 'ajout' => 'groupe_instructeurs#create'
patch 'wizard'
get 'simple_routing'
post 'create_simple_routing'
delete 'destroy_all_groups_but_defaut'