Skip to content

Commit

Permalink
Merge pull request #59 from m-vo/housekeeping
Browse files Browse the repository at this point in the history
Housekeeping
  • Loading branch information
m-vo authored Feb 3, 2022
2 parents 9e54b68 + f979e15 commit c17577d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,12 @@
"@chain",
"yarn build"
]
},
"config": {
"allow-plugins": {
"contao-components/installer": true,
"bamarni/composer-bin-plugin": true,
"contao/manager-plugin": true
}
}
}
3 changes: 1 addition & 2 deletions src/Controller/DisplayRecordsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public function question(Request $request, int $id): Response
throw $this->createAccessDeniedException();
}

$stateParameter = $request->get('state');
$overwriteState = null !== $stateParameter ? (bool) $stateParameter : null;
$overwriteState = $request->query->has('state') ? (bool) $request->query->get('state') : null;

/** @var Question|null $question */
$question = $this->questionRepository->find($id);
Expand Down
11 changes: 9 additions & 2 deletions src/Controller/SurveyFragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Mvo\ContaoSurvey\Form\SurveyManagerFactory;
use Mvo\ContaoSurvey\Registry;
use Mvo\ContaoSurvey\Repository\SurveyRepository;
use Symfony\Component\Form\SubmitButton;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -127,14 +128,20 @@ private function proceedUntilCompleted(SurveyManager $manager): bool
}

// reset (back to the first step)
if ($manager->form['reset']->isClicked()) {
/** @var SubmitButton $resetButton */
$resetButton = $manager->form['reset'];

if ($resetButton->isClicked()) {
$manager->reset();

return false;
}

// back to the previous step
if (isset($manager->form['previous']) && $manager->form['previous']->isClicked() && $manager->previousStep()) {
/** @var SubmitButton|null $backButton */
$backButton = $manager->form['previous'] ?? null;

if ($backButton && $backButton->isClicked() && $manager->previousStep()) {
return false;
}

Expand Down
27 changes: 0 additions & 27 deletions src/DependencyInjection/Compiler/RegisterSessionStoragePass.php

This file was deleted.

3 changes: 0 additions & 3 deletions src/MvoContaoSurveyBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Mvo\ContaoSurvey;

use Mvo\ContaoSurvey\DependencyInjection\Compiler\RegisterSessionStoragePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -18,7 +17,5 @@ class MvoContaoSurveyBundle extends Bundle
public function build(ContainerBuilder $container): void
{
parent::build($container);

$container->addCompilerPass(new RegisterSessionStoragePass());
}
}

0 comments on commit c17577d

Please sign in to comment.