Skip to content

Commit 9d7046a

Browse files
committed
Add initial component versions to credits page
1 parent 4282c1a commit 9d7046a

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

src/Controller/Dashboard/DashboardRootController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use CodedMonkey\Dirigent\Doctrine\Entity\Registry;
99
use CodedMonkey\Dirigent\Doctrine\Entity\User;
1010
use CodedMonkey\Dirigent\Doctrine\Repository\PackageRepository;
11+
use CodedMonkey\Dirigent\Kernel;
12+
use Composer\Composer;
1113
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
1214
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
1315
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
@@ -17,6 +19,7 @@
1719
use Symfony\Component\DependencyInjection\Attribute\Autowire;
1820
use Symfony\Component\HttpFoundation\Response;
1921
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
22+
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
2023
use Symfony\Component\Routing\Attribute\Route;
2124
use Symfony\Component\Security\Core\User\UserInterface;
2225
use Symfony\Component\Security\Http\Attribute\IsGranted;
@@ -138,7 +141,12 @@ public function adminDocs(string $page = 'readme'): Response
138141
#[Route('/dashboard/credits', name: 'dashboard_credits')]
139142
public function credits(): Response
140143
{
141-
return $this->render('dashboard/credits.html.twig');
144+
return $this->render('dashboard/credits.html.twig', [
145+
'composerVersion' => Composer::VERSION,
146+
'dirigentVersion' => Kernel::VERSION,
147+
'phpVersion' => PHP_VERSION,
148+
'symfonyVersion' => HttpKernel::VERSION,
149+
]);
142150
}
143151

144152
private function parseDocumentationFile(string $directory, string $page): array

templates/dashboard/credits.html.twig

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,54 @@
33
{% block page_title %}Credits{% endblock %}
44

55
{% block page_content %}
6-
<h2 class="h5">Administrators</h2>
6+
<h3 class="h5">Administrators</h3>
77

8-
<h2 class="h5">Developer</h2>
8+
<h3 class="h5">Developer</h3>
99
<p>Dirigent was developed by <a href="https://www.codedmonkey.com">Coded Monkey</a>.</p>
1010
<div class="mb-3">
1111
<a href="https://www.codedmonkey.com" title="Coded Monkey">
1212
<img src="https://www.gravatar.com/avatar/c23d082464fd39da2bca3936abc9372e" alt="Coded Monkey" class="img-thumbnail">
1313
</a>
1414
</div>
15-
<h3 class="h6">Sponsors</h3>
15+
16+
<h4 class="h6">Sponsors</h4>
1617
<p>
1718
Dirigent is looking for sponsors. <a href="https://www.codedmonkey.com/sponsor?project=dirigent">Click here</a>
1819
to sponsor development of Dirigent.
1920
</p>
21+
22+
<h2 class="h4">Components</h2>
23+
<div class="row">
24+
<div class="col-md-5 col-lg-4">
25+
<div class="list-group">
26+
<div class="list-group-item">
27+
<div class="d-flex justify-content-between">
28+
<div><a href="https://dirigent.dev" target="_blank" rel="noreferrer">Dirigent</a></div>
29+
<div>v{{ dirigentVersion }}</div>
30+
</div>
31+
</div>
32+
33+
<div class="list-group-item">
34+
<div class="d-flex justify-content-between">
35+
<div><a href="https://getcomposer.org" target="_blank" rel="noreferrer">Composer</a></div>
36+
<div>v{{ composerVersion }}</div>
37+
</div>
38+
</div>
39+
40+
<div class="list-group-item">
41+
<div class="d-flex justify-content-between">
42+
<div><a href="https://symfony.com" target="_blank" rel="noreferrer">Symfony</a></div>
43+
<div>v{{ symfonyVersion }}</div>
44+
</div>
45+
</div>
46+
47+
<div class="list-group-item">
48+
<div class="d-flex justify-content-between">
49+
<div><a href="https://www.php.net" target="_blank" rel="noreferrer">PHP</a></div>
50+
<div>v{{ phpVersion }}</div>
51+
</div>
52+
</div>
53+
</div>
54+
</div>
55+
</div>
2056
{% endblock %}

tests/FunctionalTests/DashboardRootControllerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace CodedMonkey\Dirigent\Tests\FunctionalTests;
44

5+
use CodedMonkey\Dirigent\Kernel;
56
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
67

78
class DashboardRootControllerTest extends WebTestCase
@@ -19,4 +20,16 @@ public function testIndex(): void
1920

2021
$this->assertAnySelectorTextSame('#total_packages .display-6', '1');
2122
}
23+
24+
public function testCredits(): void
25+
{
26+
$client = static::createClient();
27+
$this->loginUser();
28+
29+
$client->request('GET', '/?routeName=dashboard_credits');
30+
31+
$this->assertResponseStatusCodeSame(200);
32+
33+
$this->assertAnySelectorTextSame('.list-group-item div', 'v' . Kernel::VERSION);
34+
}
2235
}

0 commit comments

Comments
 (0)