ui icon indicating copy to clipboard operation
ui copied to clipboard

Wizard - previous steps are not clickable

Open mvorisek opened this issue 4 years ago • 8 comments

image

mvorisek avatar Apr 08 '20 11:04 mvorisek

It's not always desirable. Probably it should be configurable.

DarkSide666 avatar Apr 08 '20 13:04 DarkSide666

@DarkSide666 Of course, but as long as "Previous" button is active/clickable it should be desireable :)

mvorisek avatar Apr 08 '20 13:04 mvorisek

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

VividhPandey003 avatar Sep 24 '22 17:09 VividhPandey003

PR welcomed, see the screenshot red note

mvorisek avatar Sep 24 '22 17:09 mvorisek

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

VividhPandey003 avatar Sep 25 '22 10:09 VividhPandey003

git clone this repo, run composer update and then open demos/interactive/wizard.php demo

mvorisek avatar Sep 25 '22 11:09 mvorisek

What about that feature? It's desirable to me 😉

bedengler avatar Oct 10 '23 14:10 bedengler

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);
    }
  }

bedengler avatar Oct 10 '23 15:10 bedengler