Browse Source

add settings (stats, giphy)

develop
Simon Vieille 4 months ago
parent
commit
d0d3502657
  1. 2
      .env
  2. 3
      config/packages/twig.yaml
  3. 4
      src/EventSuscriber/SettingEventSubscriber.php
  4. 2
      templates/bundles/TwigBundle/Exception/error.html.twig
  5. 2
      templates/core/dashboard/index.html.twig

2
.env

@ -35,5 +35,3 @@ MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
ASSET_BASE_URL=null
UMAMI_URL=
GIPHY_API_KEY=

3
config/packages/twig.yaml

@ -5,6 +5,3 @@ twig:
paths:
'%kernel.project_dir%/templates/core/': Core
'%kernel.project_dir%/core/Resources/views/': Core
globals:
umami_url: '%env(UMAMI_URL)%'
giphy_api_key: '%env(GIPHY_API_KEY)%'

4
src/EventSuscriber/SettingEventSubscriber.php

@ -30,6 +30,10 @@ class SettingEventSubscriber extends EventSubscriber
$this->manager->init('email_sender', '🤖 E-mail', 'Expéditeur', '');
$this->manager->init('email_contact', '🤖 E-mail', 'Destinataire formulaire de contact', '');
$this->manager->init('email_comment', '🤖 E-mail', 'Destinataire nouveau commentaire', '');
$this->manager->init('stats_umami_url', '📊 Statistiques', 'Adresse tableau de bord Umami', '');
$this->manager->init('giphy_api_key', '🌐 API', 'Clé d\'API Giphy', '');
}
public function onFormInit(SettingEvent $event)

2
templates/bundles/TwigBundle/Exception/error.html.twig

@ -114,7 +114,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<script>
const giphy = {
baseURL: 'https://api.giphy.com/v1/gifs/',
apiKey: '{{ giphy_api_key }}',
apiKey: '{{ setting('giphy_api_key') }}',
tag: '{% block tag %}error{% endblock %}',
type: 'random',
rating: 'pg-13'

2
templates/core/dashboard/index.html.twig

@ -4,6 +4,6 @@
{% block body %}
<div class="row">
<iframe src="{{ umami_url }}" class="col-12" frameborder="0" style="height: calc(100vh - 60px)"></iframe>
<iframe src="{{ setting('stats_umami_url') }}" class="col-12" frameborder="0" style="height: calc(100vh - 60px)"></iframe>
</div>
{% endblock %}

Loading…
Cancel
Save