Migrated templates to plates

This commit is contained in:
Alejandro Celaya 2017-10-12 10:03:14 +02:00
parent 453ca1728e
commit e53ffc8d43
9 changed files with 61 additions and 50 deletions

View File

@ -4,6 +4,9 @@ return [
'templates' => [
'extension' => 'phtml',
],
'plates' => [
'extensions' => [
// extension service names or instances
],

View File

@ -5,7 +5,7 @@ use Shlinkio\Shlink\Common\Template\Extension\TranslatorExtension;
return [
'templates' => [
'plates' => [
'extensions' => [
TranslatorExtension::class,
],

View File

@ -1,17 +0,0 @@
{% extends 'core/layout/default.html.twig' %}
{% block title %}{{ translate('URL Not Found') }}{% endblock %}
{% block stylesheets %}
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
{% endblock %}
{% block content %}
<h1>{{ translate('Oops!') }}</h1>
<hr>
<p>{{ translate('This short URL doesn\'t seem to be valid.') }}</p>
<p>{{ translate('Make sure you included all the characters, with no extra punctuation.') }}</p>
{% endblock %}

View File

@ -0,0 +1,19 @@
<?php $this->layout('ShlinkCore::layout/default') ?>
<?php $this->start('title') ?>
<?= $this->translate('URL Not Found') ?>
<?php $this->end() ?>
<?php $this->start('stylesheets') ?>
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
<?php $this->end() ?>
<?php $this->start('main') ?>
<h1><?= $this->translate('Oops!') ?></h1>
<hr>
<p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p>
<p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p>
<?php $this->end() ?>

View File

@ -1,21 +0,0 @@
{% extends 'core/layout/default.html.twig' %}
{% block title %}{{ status }} {{ reason }}{% endblock %}
{% block stylesheets %}
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
{% endblock %}
{% block content %}
<h1>{{ translate('Oops!') }}</h1>
<hr>
{% if status != 404 %}
<p>{{ translate('We encountered a %s %s error.') | format(status, reason) }}</p>
{% else %}
<p>{{ translate('This short URL doesn\'t seem to be valid.') }}</p>
<p>{{ translate('Make sure you included all the characters, with no extra punctuation.') }}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,25 @@
<?php $this->layout('ShlinkCore::layout/default') ?>
<?php $this->start('title') ?>
<?= $this->e($status . ' ' . $reason) ?>
<?php $this->end() ?>
<?php $this->start('stylesheets') ?>
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
<?php $this->end() ?>
<?php $this->start('main') ?>
<h1><?= $this->translate('Oops!') ?></h1>
<hr>
<?php if ($status !== 404): ?>
<p><?= sprintf($this->translate('We encountered a %s %s error.'), $status, $reason) ?></p>
<?php else: ?>
<p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p>
<p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p>
<?php endif; ?>
<?php $this->end() ?>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>{% block title %}{% endblock %} | URL shortener</title>
<title><?= $this->section('title', '') ?> | URL shortener</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
@ -13,28 +13,30 @@
.app-content {flex: 1;}
.app-footer p {margin-bottom: 20px;}
</style>
{% block stylesheets %}{% endblock %}
<?= $this->section('stylesheets', '') ?>
</head>
<body class="app">
<div class="app-content">
<main class="container">
{% block content %}{% endblock %}
<?= $this->section('main', '') ?>
</main>
</div>
<footer class="app-footer">
<div class="container">
<hr />
{% block footer %}
<?php if ($this->section('footer')): ?>
<?= $this->section('footer') ?>
<?php else: ?>
<p>
&copy; {{ "now" | date("Y") }} <a href="https://shlink.io">Shlink</a>
&copy; <?= date('Y') ?> <a href="https://shlink.io">Shlink</a>
</p>
{% endblock %}
<?php endif; ?>
</div>
</footer>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
{% block javascript %}{% endblock %}
<?= $this->section('javascript', '') ?>
</body>
</html>

View File

@ -37,7 +37,7 @@ class PathVersionMiddleware implements MiddlewareInterface
$uri = $request->getUri();
$path = $uri->getPath();
// If the path does not begin with the version number, prepend v1 by default for retrocompatibility purposes
// If the path does not begin with the version number, prepend v1 by default for BC compatibility purposes
if (strpos($path, '/v') !== 0) {
$parts = explode('/', $path);
// Remove the first empty part and the

View File

@ -1,9 +1,9 @@
<?php
declare(strict_types=1);
use Interop\Container\ContainerInterface;
use Zend\Expressive\Application;
/** @var ContainerInterface $container */
$container = include __DIR__ . '/../config/container.php';
/** @var Application $app */
$app = $container->get(Application::class);
$app->run();
$app = $container->get(Application::class)->run();