summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-12-21 23:12:04 +0100
committermsquare <msquare@notrademark.de>2018-12-22 12:01:23 +0100
commit330356043df8e9c08fb3a408c74fe54bc2b9813d (patch)
tree5b9517fd4cd1b2130844157ec07926397d7f4396
parent393db492948a16f246790b88a38a1235cb167659 (diff)
credits: Allow customization
-rw-r--r--config/config.default.php7
-rw-r--r--resources/views/pages/credits.twig34
-rw-r--r--src/Controllers/CreditsController.php16
-rw-r--r--tests/Unit/Controllers/CreditsControllerTest.php6
4 files changed, 37 insertions, 26 deletions
diff --git a/config/config.default.php b/config/config.default.php
index 219ac56b..8467e144 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -163,4 +163,11 @@ return [
//'Strict-Transport-Security' => 'max-age=7776000',
//'Expect-CT' => 'max-age=7776000,enforce,report-uri="[uri]"',
],
+
+ // A list of credits
+ 'credits' => [
+ 'Contribution' => 'Please visit [engelsystem/engelsystem](https://github.com/engelsystem/engelsystem) if '
+ . 'you want to to contribute, have found any [bugs](https://github.com/engelsystem/engelsystem/issues) '
+ . 'or need help.'
+ ]
];
diff --git a/resources/views/pages/credits.twig b/resources/views/pages/credits.twig
index ff2bf873..eb98c7e7 100644
--- a/resources/views/pages/credits.twig
+++ b/resources/views/pages/credits.twig
@@ -6,35 +6,25 @@
<div class="container">
<h1>Credits</h1>
<div class="row">
+ {% for title, credit in credits %}
+ <div class="col-md-4">
+ <h2>{{ title }}</h2>
+ {{ credit|markdown }}
+ </div>
+ {% endfor %}
+
<div class="col-md-4">
<h2>Source code</h2>
<p>
- The original system was written by <a href="https://github.com/cookieBerlin/engelsystem">cookie</a>.
+ The original engelsystem was written by
+ <a href="https://github.com/cookieBerlin/engelsystem">cookie</a>.
It was then completely rewritten and enhanced by
- <a href="https://notrademark.de">msquare</a> (maintainer),
- <a href="https://myigel.name">MyIgel</a>,
- <a href="https://mortzu.de">mortzu</a>,
- <a href="https://jplitza.de">jplitza</a> and
- <a href="https://github.com/gnomus">gnomus</a>.
+ <a href="https://notrademark.de">msquare</a> (maintainer) and
+ <a href="https://myigel.name">MyIgel</a>.
</p>
<p>
Please look at the <a href="https://github.com/engelsystem/engelsystem/graphs/contributors">
- contributor list on github</a> for a more complete version.
- </p>
- </div>
- <div class="col-md-4">
- <h2>Hosting</h2>
- <p>
- Webspace, development platform and domain on <a href="https://engelsystem.de">engelsystem.de</a>
- is currently provided by <a href="https://www.wybt.net/">would you buy this?</a> (ichdasich)
- and adminstrated by <a href="https://mortzu.de">mortzu</a>,
- <a href="http://derf.homelinux.org">derf</a> and ichdasich.
- </p>
- </div>
- <div class="col-md-4">
- <h2>Translation</h2>
- <p>
- Many thanks for the german translation: <a href="http://e7p.de">e7p</a>
+ contributor list on GitHub</a> for a complete list.
</p>
</div>
</div>
diff --git a/src/Controllers/CreditsController.php b/src/Controllers/CreditsController.php
index 568811c7..b2805b84 100644
--- a/src/Controllers/CreditsController.php
+++ b/src/Controllers/CreditsController.php
@@ -2,15 +2,24 @@
namespace Engelsystem\Controllers;
+use Engelsystem\Config\Config;
use Engelsystem\Http\Response;
class CreditsController extends BaseController
{
+ /** @var Config */
+ protected $config;
+
/** @var Response */
protected $response;
- public function __construct(Response $response)
+ /**
+ * @param Response $response
+ * @param Config $config
+ */
+ public function __construct(Response $response, Config $config)
{
+ $this->config = $config;
$this->response = $response;
}
@@ -19,6 +28,9 @@ class CreditsController extends BaseController
*/
public function index()
{
- return $this->response->withView('pages/credits.twig');
+ return $this->response->withView(
+ 'pages/credits.twig',
+ ['credits' => $this->config->get('credits')]
+ );
}
}
diff --git a/tests/Unit/Controllers/CreditsControllerTest.php b/tests/Unit/Controllers/CreditsControllerTest.php
index 6f0200f2..3ce92cb1 100644
--- a/tests/Unit/Controllers/CreditsControllerTest.php
+++ b/tests/Unit/Controllers/CreditsControllerTest.php
@@ -2,6 +2,7 @@
namespace Unit\Controllers;
+use Engelsystem\Config\Config;
use Engelsystem\Controllers\CreditsController;
use Engelsystem\Http\Response;
use PHPUnit\Framework\MockObject\MockObject;
@@ -17,12 +18,13 @@ class CreditsControllerTest extends TestCase
{
/** @var Response|MockObject $response */
$response = $this->createMock(Response::class);
+ $config = new Config(['foo' => 'bar', 'credits' => ['lor' => 'em']]);
$response->expects($this->once())
->method('withView')
- ->with('pages/credits.twig');
+ ->with('pages/credits.twig', ['credits' => ['lor' => 'em']]);
- $controller = new CreditsController($response);
+ $controller = new CreditsController($response, $config);
$controller->index();
}
}