ui
ui copied to clipboard
Wizard - previous steps are not clickable
It's not always desirable. Probably it should be configurable.
@DarkSide666 Of course, but as long as "Previous" button is active/clickable it should be desireable :)
Hey, I am a beginner. It was mentioned with "good first issue" label. Could you please explain me the issue so if I'm able to I'd really love to contribute
PR welcomed, see the screenshot red note
Hello again, Sorry.. I am not able to understand the image well regarding how to fix it. could you please tell me how can I access the Wizard, and view the dashboard
git clone this repo, run composer update and then open demos/interactive/wizard.php
demo
What about that feature? It's desirable to me 😉
Fixed it for now with that code directly in the file where I call wizard:
// Get current step
$currentStep = $wizard->currentStep;
$alwaysLink = true; // If false, only previous steps can be selected directly
foreach ($wizard->steps as $stepNr => $stepCallback) {
if($stepNr < $currentStep OR $alwaysLink == true){
// Some logic needed here due to the construction of the IDs of the wizard
if ($stepNr == "0"){
$stepNr1 = "";
}
else{
$stepNr = $stepNr;
$stepNr1 = "_".($stepNr+1);
}
$stepUrl = $app->url(['atk_layout_admin_wizard' => $stepNr]);
$currentStepUrl = $app->url(['atk_layout_admin_wizard' => $currentStep]);
// jQuery chain to bind click event
$jsChain = $wizard->js()->find("#atk_layout_admin_wizard_step" . $stepNr1)->on('click', new \Atk4\Ui\JsExpression('function() { if([] !== window.location.href) { window.location.href = []; } }', [$currentStepUrl, $stepUrl]));
// Execute this chain now
$wizard->js(true, $jsChain);
}
}