Browse Source

add configuration site name and site logo

develop
Simon Vieille 2 months ago
parent
commit
01f6134d87
  1. 0
      assets/images/blank.png
  2. 0
      assets/images/logo.png
  3. 0
      assets/images/no-image.png
  4. 7
      assets/js/admin.js
  5. 2
      config/packages/app.yaml
  6. 10
      core/Controller/Admin/AdminController.php
  7. 14
      core/Controller/Auth/AuthController.php
  8. 8
      core/DependencyInjection/Configuration.php
  9. 6
      core/Resources/views/admin/layout.html.twig
  10. 4
      core/Resources/views/auth/login.html.twig
  11. 4
      core/Resources/views/auth/resetting_request.html.twig
  12. 4
      core/Resources/views/auth/resetting_update.html.twig
  13. 3
      package.json
  14. 5
      webpack.config.js
  15. 32
      yarn.lock

0
assets/img/blank.png → assets/images/blank.png

Before

Width: 50  |  Height: 50  |  Size: 163 B

After

Width: 50  |  Height: 50  |  Size: 163 B

0
assets/img/logo.png → assets/images/logo.png

Before

Width: 465  |  Height: 479  |  Size: 32 KiB

After

Width: 465  |  Height: 479  |  Size: 32 KiB

0
assets/img/no-image.png → assets/images/no-image.png

Before

Width: 150  |  Height: 150  |  Size: 1.5 KiB

After

Width: 150  |  Height: 150  |  Size: 1.5 KiB

7
assets/js/admin.js

@ -1,10 +1,3 @@
const imagesContext = require.context(
'../img',
true, /\.(png|jpg|jpeg|gif|ico|svg|webp)$/
);
imagesContext.keys().forEach(imagesContext);
import '../css/admin.scss';
require('../../node_modules/bootstrap/dist/js/bootstrap.min.js');

2
config/packages/app.yaml

@ -1,5 +1,7 @@
core:
site:
name: "Tinternet & cie"
logo: "build/images/logo.png"
pages:
App\Entity\Page\SimplePage:
name: 'Page simple'

10
core/Controller/Admin/AdminController.php

@ -4,15 +4,25 @@ namespace App\Core\Controller\Admin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
abstract class AdminController extends AbstractController
{
protected array $coreParameters;
public function __construct(ParameterBagInterface $parameters)
{
$this->coreParameters = $parameters->get('core');
}
/**
* {@inheritdoc}
*/
protected function render(string $view, array $parameters = [], Response $response = null): Response
{
$parameters['section'] = $this->getSection();
$parameters['site_name'] = $this->coreParameters['site']['name'];
$parameters['site_logo'] = $this->coreParameters['site']['logo'];
return parent::render($view, $parameters, $response);
}

14
core/Controller/Auth/AuthController.php

@ -14,9 +14,17 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use ZxcvbnPhp\Zxcvbn;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
class AuthController extends AbstractController
{
protected array $coreParameters;
public function __construct(ParameterBagInterface $parameters)
{
$this->coreParameters = $parameters->get('core');
}
/**
* @Route("/login", name="auth_login")
*/
@ -32,6 +40,8 @@ class AuthController extends AbstractController
return $this->render('@Core/auth/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
'site_name' => $this->coreParameters['site']['name'],
'site_logo' => $this->coreParameters['site']['logo'],
]);
}
@ -70,6 +80,8 @@ class AuthController extends AbstractController
return $this->render('@Core/auth/resetting_request.html.twig', [
'email_sent' => $request->isMethod('POST'),
'site_name' => $this->coreParameters['site']['name'],
'site_logo' => $this->coreParameters['site']['logo'],
]);
}
@ -128,6 +140,8 @@ class AuthController extends AbstractController
'password_updated' => $passwordUpdated,
'token' => $token,
'expired' => $expired,
'site_name' => $this->coreParameters['site']['name'],
'site_logo' => $this->coreParameters['site']['logo'],
]);
}

8
core/DependencyInjection/Configuration.php

@ -15,6 +15,14 @@ class Configuration implements ConfigurationInterface
->children()
->arrayNode('site')
->children()
->scalarNode('name')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('logo')
->isRequired()
->cannotBeEmpty()
->end()
->arrayNode('pages')
->prototype('array')
->children()

6
core/Resources/views/admin/layout.html.twig

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}Tinternet &amp; cie{% endblock %}</title>
<title>{% block title %}{{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}
@ -15,9 +15,9 @@
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-light border-bottom">
<a class="navbar-brand" href="{{ path('admin_dashboard_index') }}">
<img id="logo" src="{{ asset('build/images/logo.png') }}" alt="Tinternet &amp; cie" title="Tinternet &amp; cie">
<img id="logo" src="{{ asset(site_logo) }}" alt="Tinternet &amp; cie" title="Tinternet &amp; cie">
Tinternet &amp; cie
{{ site_name }}
</a>
<div class="ml-auto">

4
core/Resources/views/auth/login.html.twig

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}Tinternet &amp; cie{% endblock %}</title>
<title>{% block title %}{{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}
@ -79,7 +79,7 @@
</div>
<div class="col-md-6 bg-light d-flex">
<div class="flex-fill align-self-center text-center p-3">
<img class="login-image" src="{{ asset('build/images/logo.png') }}" alt="Tinternet &amp; cie" title="Tinternet &amp; cie">
<img class="login-image" src="{{ asset(site_logo) }}" alt="{{ site_name }}" title="{{ site_name }}">
</div>
</div>
</div>

4
core/Resources/views/auth/resetting_request.html.twig

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}Tinternet &amp; cie{% endblock %}</title>
<title>{% block title %}{{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}
@ -64,7 +64,7 @@
</div>
<div class="col-md-6 bg-light d-flex">
<div class="flex-fill align-self-center text-center p-3">
<img class="login-image" src="{{ asset('build/images/logo.png') }}" alt="Tinternet &amp; cie" title="Tinternet &amp; cie">
<img class="login-image" src="{{ asset(site_logo) }}" alt="{{ site_name }}" title="{{ site_name }}">
</div>
</div>
</div>

4
core/Resources/views/auth/resetting_update.html.twig

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}Tinternet &amp; cie{% endblock %}</title>
<title>{% block title %}{{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}
@ -97,7 +97,7 @@
</div>
<div class="col-md-6 bg-light d-flex">
<div class="flex-fill align-self-center text-center p-3">
<img class="login-image" src="{{ asset('build/images/logo.png') }}" alt="Tinternet &amp; cie" title="Tinternet &amp; cie">
<img class="login-image" src="{{ asset(site_logo) }}" alt="{{ site_name }}" title="{{ site_name }}">
</div>
</div>
</div>

3
package.json

@ -3,9 +3,10 @@
"@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.0.0",
"core-js": "^3.0.0",
"file-loader": "^6.0.0",
"node-sass": "^4.13.1",
"regenerator-runtime": "^0.13.2",
"sass-loader": "^7.0.1",
"sass-loader": "^11.0.0",
"stimulus": "^2.0.0",
"webpack-notifier": "^1.6.0"
},

5
webpack.config.js

@ -55,6 +55,11 @@ Encore
// enables Sass/SCSS support
.enableSassLoader()
.copyFiles({
from: './assets/images',
to: 'images/[path][name].[hash:8].[ext]'
})
// uncomment if you use TypeScript
//.enableTypeScriptLoader()

32
yarn.lock

@ -2687,6 +2687,14 @@ faye-websocket@^0.11.3:
dependencies:
websocket-driver ">=0.5.1"
file-loader@^6.0.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==
dependencies:
loader-utils "^2.0.0"
schema-utils "^3.0.0"
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
@ -3619,6 +3627,11 @@ kind-of@^6.0.2:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
klona@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0"
integrity sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==
load-json-file@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"
@ -3644,7 +3657,7 @@ loader-utils@1.2.3:
emojis-list "^2.0.0"
json5 "^1.0.1"
loader-utils@^1.0.1, loader-utils@^1.4.0:
loader-utils@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
@ -3969,7 +3982,7 @@ negotiator@0.6.2:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==
neo-async@^2.5.0, neo-async@^2.6.2:
neo-async@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
@ -5180,16 +5193,13 @@ sass-graph@2.2.5:
scss-tokenizer "^0.2.3"
yargs "^13.3.2"
sass-loader@^7.0.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.3.1.tgz#a5bf68a04bcea1c13ff842d747150f7ab7d0d23f"
integrity sha512-tuU7+zm0pTCynKYHpdqaPpe+MMTQ76I9TPZ7i4/5dZsigE350shQWe5EZNl5dBidM49TPET75tNqRbcsUZWeNA==
sass-loader@^11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-11.0.1.tgz#8672f896593466573b904f47693e0695368e38c9"
integrity sha512-Vp1LcP4slTsTNLEiDkTcm8zGN/XYYrZz2BZybQbliWA8eXveqA/AxsEjllQTpJbg2MzCsx/qNO48sHdZtOaxTw==
dependencies:
clone-deep "^4.0.1"
loader-utils "^1.0.1"
neo-async "^2.5.0"
pify "^4.0.1"
semver "^6.3.0"
klona "^2.0.4"
neo-async "^2.6.2"
sax@~1.2.4:
version "1.2.4"

Loading…
Cancel
Save