add wizard
This commit is contained in:
parent
2e1b8b9ef2
commit
526f70f9c0
3 changed files with 27 additions and 0 deletions
|
@ -62,6 +62,18 @@ module Administrateurs
|
||||||
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
||||||
end
|
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
|
def show
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
@groupe_instructeur = groupe_instructeur
|
@groupe_instructeur = groupe_instructeur
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -535,6 +535,7 @@ Rails.application.routes.draw do
|
||||||
get 'options'
|
get 'options'
|
||||||
get 'ajout'
|
get 'ajout'
|
||||||
post 'ajout' => 'groupe_instructeurs#create'
|
post 'ajout' => 'groupe_instructeurs#create'
|
||||||
|
patch 'wizard'
|
||||||
get 'simple_routing'
|
get 'simple_routing'
|
||||||
post 'create_simple_routing'
|
post 'create_simple_routing'
|
||||||
delete 'destroy_all_groups_but_defaut'
|
delete 'destroy_all_groups_but_defaut'
|
||||||
|
|
Loading…
Reference in a new issue