Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontpage): add overview for GMM bodies #1924

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions module/Application/language/en.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions module/Application/language/gewisweb.pot

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions module/Application/language/nl.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion module/Application/view/partial/main-nav.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
declare(strict_types=1);

use Application\View\HelperTrait;
use Decision\Model\Enums\OrganTypes;
use Laminas\View\Exception\RuntimeException;
use Laminas\View\Renderer\PhpRenderer;

/** @var PhpRenderer|HelperTrait $this */

$lang = $this->plugin('translate')->getTranslator()->getLocale();
$translator = $this->plugin('translate')->getTranslator();
$lang = $translator->getLocale();
?>
<?php
if ($this->identity()?->getMember()->isBoardMember()): ?>
Expand Down Expand Up @@ -288,6 +290,41 @@ endif; ?>
<?= $this->translate('Fraternities') ?>
</a>
</li>
<li class="dropdown dropdown-submenu">
<a href="<?= $this->hashUrl() ?>" role="button"
class="dropdown-toggle visible-sm visible-xs" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
<?= $this->translate('GMM Bodies') ?>
<span class="caret"></span>
</a>
<a href="<?= $this->hashUrl() ?>" role="button"
class="hidden-sm hidden-xs">
<?= $this->translate('GMM Bodies') ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="<?= $this->url('home/gmm_bodies/rva_list') ?>">
<?= OrganTypes::RvA->getPluralName($translator) ?>
</a>
</li>
<li>
<a href="<?= $this->url('home/gmm_bodies/kcc_list') ?>">
<?= OrganTypes::KCC->getPluralName($translator) ?>
</a>
</li>
<li>
<a href="<?= $this->url('home/gmm_bodies/avw_list') ?>">
<?= OrganTypes::AVW->getPluralName($translator) ?>
</a>
</li>
<li>
<a href="<?= $this->url('home/gmm_bodies/avc_list') ?>">
<?= OrganTypes::AVC->getPluralName($translator) ?>
</a>
</li>
</ul>
</li>
<li>
<a href="<?= $this->url(
'home/page',
Expand Down
12 changes: 12 additions & 0 deletions module/Decision/src/Model/Enums/OrganTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ public function getName(Translator $translator): string
self::RvA => $translator->translate('Advisory Board'),
};
}

public function getPluralName(Translator $translator): string
{
return match ($this) {
self::Committee => $translator->translate('Committees'),
self::AVC => $translator->translate('GMM Committees'),
self::Fraternity => $translator->translate('Fraternities'),
self::KCC => $translator->translate('Financial Audit Committees'),
self::AVW => $translator->translate('GMM Taskforces'),
self::RvA => $translator->translate('Advisory Boards'),
};
}
}
52 changes: 52 additions & 0 deletions module/Frontpage/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,54 @@
],
'priority' => 100,
],
'gmm_bodies' => [
'type' => Literal::class,
'options' => [
'route' => 'association/gmm-bodies',
'defaults' => [
'controller' => OrganController::class,
],
],
'may_terminate' => false,
'child_routes' => [
'avc_list' => [
'type' => Literal::class,
'options' => [
'route' => '/gmm-committees',
'defaults' => [
'action' => 'avcList',
],
],
],
'avw_list' => [
'type' => Literal::class,
'options' => [
'route' => '/gmm-taskforces',
'defaults' => [
'action' => 'avwList',
],
],
],
'kcc_list' => [
'type' => Literal::class,
'options' => [
'route' => '/financial-audit-committees',
'defaults' => [
'action' => 'kccList',
],
],
],
'rva_list' => [
'type' => Literal::class,
'options' => [
'route' => '/advisory-boards',
'defaults' => [
'action' => 'rvaList',
],
],
],
],
],
],
],
'admin_page' => [
Expand Down Expand Up @@ -389,6 +437,10 @@
'news-admin/edit' => __DIR__ . '/../view/frontpage/news-admin/edit.phtml',
'organ/committee-list' => __DIR__ . '/../view/frontpage/organ/committee-list.phtml',
'organ/fraternity-list' => __DIR__ . '/../view/frontpage/organ/fraternity-list.phtml',
'frontpage/organ/avc-list' => __DIR__ . '/../view/frontpage/organ/gmm-body.phtml',
'frontpage/organ/avw-list' => __DIR__ . '/../view/frontpage/organ/gmm-body.phtml',
'frontpage/organ/kcc-list' => __DIR__ . '/../view/frontpage/organ/gmm-body.phtml',
'frontpage/organ/rva-list' => __DIR__ . '/../view/frontpage/organ/gmm-body.phtml',
],
],
'doctrine' => [
Expand Down
29 changes: 29 additions & 0 deletions module/Frontpage/src/Controller/OrganController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,35 @@ public function fraternityListAction(): ViewModel
);
}

public function avcListAction(): ViewModel
{
return $this->getBodies(OrganTypes::AVC);
}

public function avwListAction(): ViewModel
{
return $this->getBodies(OrganTypes::AVW);
}

public function kccListAction(): ViewModel
{
return $this->getBodies(OrganTypes::KCC);
}

public function rvaListAction(): ViewModel
{
return $this->getBodies(OrganTypes::RvA);
}

private function getBodies(OrganTypes $organType): ViewModel
{
return new ViewModel([
'organType' => $organType,
'active' => $this->organService->findActiveOrgansByType($organType),
'abrogated' => $this->organService->findAbrogatedOrgansByType($organType),
]);
}

public function organAction(): ViewModel
{
$type = OrganTypes::from($this->params()->fromRoute('type'));
Expand Down
Loading
Loading