credits: Allow customization

This commit is contained in:
Igor Scheller 2018-12-21 23:12:04 +01:00 committed by msquare
parent 393db49294
commit 330356043d
4 changed files with 37 additions and 26 deletions

View File

@ -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.'
]
];

View File

@ -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>

View File

@ -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')]
);
}
}

View File

@ -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();
}
}