diff --git a/.env b/.env index 21b1313..953f939 100644 --- a/.env +++ b/.env @@ -58,6 +58,7 @@ ORG_LOGO='assets/image/logo.png' PRIVACY_POLICY_URL='https://roodjongeren.nl/privacybeleid/' LISTMONK_URL='https://listmonk.roodjongeren.nl/admin' USE_MIDDLE_NAME=true +CONTRIBUTION_ENABLED=true # Set to https in production environment SECURE_SCHEME='http' diff --git a/config/services.yaml b/config/services.yaml index 3b3725a..124a5f6 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -14,6 +14,7 @@ parameters: app.privacyPolicyUrl: '%env(PRIVACY_POLICY_URL)%' app.listmonkUrl: '%env(string:LISTMONK_URL)%' app.useMiddleName: '%env(bool:USE_MIDDLE_NAME)%' + app.contributionEnabled: '%env(bool:CONTRIBUTION_ENABLED)%' router.request_context.scheme: '%env(SECURE_SCHEME)%' asset.request_context.secure: true diff --git a/src/Controller/DocumentsController.php b/src/Controller/DocumentsController.php index 61f483e..32c8dba 100644 --- a/src/Controller/DocumentsController.php +++ b/src/Controller/DocumentsController.php @@ -30,6 +30,7 @@ public function documents(Request $requset, $folderId): Response { 'choices' => $repoFolders->findAll(), 'action' => $this->generateUrl('member_documents_move') ]); + $contributionEnabled = $this->getParameter('app.contributionEnabled'); return $this->render('user/documents.html.twig', [ 'folders' => $folders, @@ -43,7 +44,8 @@ public function documents(Request $requset, $folderId): Response { 'uploadForm' => $uploadForm->createView(), 'newFolderForm' => $newFolderForm->createView(), - 'moveForm' => $moveForm->createView() + 'moveForm' => $moveForm->createView(), + 'contributionEnabled' => $contributionEnabled, ]); } @@ -93,7 +95,8 @@ public function createFolder(Request $request, $folderId): Response { return $this->json(['status' => 'success', 'id' => $newFolder->getId()]); } - return $this->redirectToRoute('member_documents', ['folderId' => $newFolder->getId()]); + $contributionEnabled = $this->getParameter('app.contributionEnabled'); + return $this->redirectToRoute('member_documents', ['folderId' => $newFolder->getId(), 'contributionEnabled' => $contributionEnabled]); } throw $this->createNotFoundException(); @@ -157,8 +160,10 @@ public function upload(Request $request, $folderId): Response { ]); } + $contributionEnabled = $this->getParameter('app.contributionEnabled'); return $this->redirectToRoute('member_documents', [ - 'folderId' => $folder ? $folder->getId() : '' + 'folderId' => $folder ? $folder->getId() : '', + 'contributionEnabled' => $contributionEnabled, ]); } diff --git a/src/Controller/MemberController.php b/src/Controller/MemberController.php index 4ebeeaa..a4d4047 100644 --- a/src/Controller/MemberController.php +++ b/src/Controller/MemberController.php @@ -37,6 +37,7 @@ public function memberAcceptPersonalDetails(Request $request): Response { $member = $this->getUser(); $orgName = $this->getParameter('app.organizationName'); $privacyPolicyUrl = $this->getParameter('app.privacyPolicyUrl'); + $contributionEnabled = $this->getParameter('app.contributionEnabled'); $form = $this->createFormBuilder($member) ->add('acceptUsePersonalInformation', null, [ 'label' => "Ik ga ermee akkoord dat $orgName mijn persoonsgegevens opslaat in haar ledenadministratie, zoals beschreven in het privacybeleid.", @@ -57,7 +58,8 @@ public function memberAcceptPersonalDetails(Request $request): Response { } return $this->render('user/privacy-policy.html.twig', [ - 'form' => $form->createView() + 'form' => $form->createView(), + 'contributionEnabled' => $contributionEnabled, ]); } @@ -69,6 +71,7 @@ public function home(Request $request): Response { if (!$member->getAcceptUsePersonalInformation()) return $this->memberAcceptPersonalDetails($request); + $contributionEnabled = $this->getParameter('app.contributionEnabled'); $events = $this->getDoctrine()->getRepository(Event::class)->createQueryBuilder('e') ->where('e.division IS NULL or e.division = ?1') ->andWhere('e.timeEnd > ?2') @@ -79,7 +82,8 @@ public function home(Request $request): Response { ->getResult(); return $this->render('user/home.html.twig', [ - 'events' => $events + 'events' => $events, + 'contributionEnabled' => $contributionEnabled, ]); } @@ -264,7 +268,7 @@ public function details(Request $request, UserPasswordEncoderInterface $password $member = $this->getUser(); if (!$member->getAcceptUsePersonalInformation()) return $this->memberAcceptPersonalDetails($request); - + $contributionEnabled = $this->getParameter('app.contributionEnabled'); $form = $this->createForm(MemberDetailsType::class, $member); $revision = new MemberDetailsRevision($member, true); $success = false; @@ -301,7 +305,8 @@ public function details(Request $request, UserPasswordEncoderInterface $password 'form' => $form->createView(), 'formPassword' => $formPassword->createView(), 'success' => $success, - 'successPassword' => $successPassword + 'successPassword' => $successPassword, + 'contributionEnabled' => $contributionEnabled, ]); } diff --git a/templates/user/details.html.twig b/templates/user/details.html.twig index 0de2d49..b22fce0 100644 --- a/templates/user/details.html.twig +++ b/templates/user/details.html.twig @@ -101,7 +101,7 @@ {{ form_end(formPassword) }} - + {% if contributionEnabled %}