add debriefing front page

This commit is contained in:
Simon Vieille 2022-04-18 14:22:26 +02:00
parent 22cd0dc375
commit 6a66fe3210
Signed by: deblan
GPG key ID: 579388D585F70417
10 changed files with 161 additions and 5 deletions

13
assets/css/cr.scss Normal file
View file

@ -0,0 +1,13 @@
$theme-colors: (
"primary": #1ab5dc,
"primary-light": lighten(#3183aa, 40%),
"dark-blue": #1e2430,
) !default;
@import "~bootstrap/scss/bootstrap.scss";
@import "~@fortawesome/fontawesome-free/css/all.css";
h1 {
padding-top: 30px;
text-align: center;
}

1
assets/js/cr.js Normal file
View file

@ -0,0 +1 @@
import '../css/cr.scss'

View file

@ -2,13 +2,18 @@ core:
site:
name: "Suivi des interventions"
logo: "build/images/tinternet.png"
# controllers:
# - {name: 'Foo', action: 'App\Controller\ExampleController::foo'}
controllers:
- {name: 'Compte-rendu', action: 'App\Controller\DebriefingController::debriefing'}
pages:
App\Entity\Page\SimplePage:
name: 'Simple page'
templates:
- {name: "Default", file: "page/simple/default.html.twig"}
App\Entity\Page\EntityPage:
name: 'Entité'
templates:
- {name: "Compte-rendu", file: "page/debriefing/default.html.twig"}
file_manager:
# mimes:
# - image/png

View file

@ -0,0 +1,25 @@
<?php
namespace App\Controller;
use App\Core\Controller\Site\PageController;
use App\Entity\Debriefing;
use Symfony\Component\HttpFoundation\Response;
class DebriefingController extends PageController
{
public function debriefing(Debriefing $entity, \DateTime $date): Response
{
if (!$this->siteRequest->getPage()) {
throw $this->createNotFoundException();
}
if ($entity->getDate() != $date) {
throw $this->createNotFoundException();
}
return $this->defaultRender($this->siteRequest->getPage()->getTemplate(), [
'entity' => $entity,
]);
}
}

View file

@ -57,7 +57,7 @@ class Debriefing implements EntityInterface
public function __construct()
{
$this->project = new ArrayCollection();
$this->projects = new ArrayCollection();
}
public function getId(): ?int
@ -94,7 +94,7 @@ class Debriefing implements EntityInterface
*/
public function getProjects(): Collection
{
return $this->projects ?? new ArrayCollection();
return $this->projects;
}
public function addProject(Project $project): self

View file

@ -0,0 +1,19 @@
<?php
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Page;
use App\Core\Entity\Site\Page as BlockEntity;
use App\Core\Form\Site\Page as Block;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @ORM\Entity
*/
class EntityPage extends Page
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
}

View file

@ -36,6 +36,15 @@
-
{% endfor %}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Partager</span>
{% set url = safe_path('main_fr_menu_debriefing', {entity: entity.id, date: entity.date|date('d-m-Y')}) %}
<a class="btn btn-success border btn-sm mb-2 d-block" href="{{ url }}">
Partager
</a>
</li>
</ul>
</div>
<div class="col-md-9 p-3">

View file

@ -22,7 +22,9 @@
{{ encore_entry_link_tags('app') }}
{%- endblock -%}
<title>{{ _page.metaTitle }}</title>
{%- block title -%}
<title>{{ _page.metaTitle }}</title>
{%- endblock -%}
</head>
<body>

View file

@ -0,0 +1,81 @@
{% extends 'base.html.twig' %}
{%- block opengraph -%}
<meta property="og:title" content="{{ _page.ogTitle|build_string(entity) }}" />
<meta property="og:description" content="{{ _page.ogDescription|build_string(entity) }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ app.request.uri }}" />
{%- if _page.ogImage -%}
<meta property="og:image" content="{{ absolute_url(asset(_page.ogImage)) }}" />
{%- endif -%}
{%- endblock -%}
{%- block stylesheets -%}
{{ encore_entry_link_tags('cr') }}
{%- endblock -%}
{%- block javascripts -%}
{{ encore_entry_script_tags('cr') }}
{%- endblock -%}
{%- block title -%}
<title>{{ _page.metaTitle|build_string(entity) }}</title>
{%- endblock -%}
{% block page %}
<div class="container">
<div class="row mt-3 mb-3">
<div class="col-md-3 text-center">
<img src="{{ asset('build/images/tinternet.png') }}" alt="Tinternet &amp; Cie" width="120">
</div>
<div class="col-md-9">
<h1 class="h2">{{ entity.topic }}</h1>
</div>
</div>
<div class="row">
<div class="col-md-3 p-3">
<ul class="list-group">
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Date</span>
{{ entity.date|date('d/m/Y') }}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Projets</span>
{% for item in entity.projects %}
{{ item.label }}<br>
{% else %}
Aucun projet
{% endfor %}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Contributeurs internes</span>
{{ entity.internalContributors|nl2br }}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Contributeurs externes</span>
{{ entity.externalContributors|nl2br }}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Fichiers</span>
{% for item in entity.files %}
<a class="btn btn-light border btn-sm mb-2 d-block" href="{{ asset(item.file) }}" target="_blank">
{{ item.name }}
</a>
{% else %}
-
{% endfor %}
</li>
</ul>
</div>
<div class="col-md-9 p-3">
{{ entity.content|raw }}
</div>
</div>
</div>
{% endblock %}

View file

@ -22,6 +22,7 @@ Encore
*/
.addEntry('admin', './assets/js/admin.js')
.addEntry('app', './assets/js/app.js')
.addEntry('cr', './assets/js/cr.js')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()