Browse Source

fix filters, add titles

develop
Simon Vieille 2 weeks ago
parent
commit
412db9bd7f
  1. 6
      src/Controller/Blog/PostAdminController.php
  2. 3
      src/Form/Blog/Filter/PostFilterType.php
  3. 8
      templates/admin/menu.html.twig
  4. 17
      templates/base.html.twig
  5. 24
      templates/blog/post/post.html.twig
  6. 2
      templates/blog/post_admin/edit.html.twig
  7. 2
      templates/blog/post_admin/index.html.twig
  8. 2
      templates/blog/post_admin/new.html.twig
  9. 2
      templates/blog/post_admin/show.html.twig
  10. 5
      webpack.config.js

6
src/Controller/Blog/PostAdminController.php

@ -122,7 +122,7 @@ class PostAdminController extends AdminController
public function filters(Session $session): Response
{
$form = $this->createForm(PostFilterType::class);
$form->submit($session->get('post_filter'));
$form->submit($session->get('post_filter', []));
return $this->render('blog/post_admin/filters.html.twig', [
'form' => $form->createView(),
@ -167,10 +167,10 @@ class PostAdminController extends AdminController
if (empty($filters)) {
$this->filters = $filters;
$session->set('post_filter', $this->filters);
$session->set('post_filter', $filters);
} elseif ($form->isValid()) {
$this->filters = $form->getData();
$session->set('post_filter', $this->filters);
$session->set('post_filter', $filters);
}
}
}

3
src/Form/Blog/Filter/PostFilterType.php

@ -10,6 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\ChoiceList\ChoiceList;
class PostFilterType extends AbstractType
{
@ -50,9 +51,9 @@ class PostFilterType extends AbstractType
'label' => 'Catégories',
'class' => Category::class,
'choice_label' => 'title',
'choice_value' => 'id',
'required' => false,
'attr' => [
'data-jschoice' => '',
],
'query_builder' => function (EntityRepository $repo) {
return $repo->createQueryBuilder('a')

8
templates/admin/menu.html.twig

@ -20,4 +20,12 @@
<span class="nav-item-label">Catégories</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link {{ macros_menu.active_class('blog_comment', section) }}" href="{{ path('admin_blog_comment_index') }}">
<span class="fa fa-comment-alt"></span>
<span class="nav-item-label">Commentaires</span>
</a>
</li>
</ul>

17
templates/base.html.twig

@ -19,16 +19,29 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<title>Blog - {% block meta_title %}{{ _page ? _page.title.value : null }}{% endblock %}</title>
<title>Blog - {% block meta_title %}{{ _page is defined ? _page.title.value }}{% endblock %}</title>
{% block metas %}
<meta name="description" content="{% block meta_description %}{{ _page.metaTitle }}{% endblock %}">
<meta name="description" content="{% block meta_description %}{{ _page is defined and _page ? _page.metaTitle }}{% endblock %}">
<link rel="openid.server" href="https://id.deblan.org/" />
<link rel="openid.delegate" href="https://www.deblan.io/" />
<link rel="openid2.provider" href="https://id.deblan.org/" />
<link rel="openid2.local_id" href="https://www.deblan.io/" />
{% endblock %}
{% block openGraph %}
{% if _page is defined and _page %}
<meta property="og:title" content="{{ _page.ogTitle }}" />
<meta property="og:url" content="{{ app.request.uri }}" />
<meta property="og:description" content="{{ _page.ogDescription }}" />
{% if _page.ogImage %}
<meta property="og:image" content="{{ asset(_page.ogImage) }}" />
<meta property="og:image:secure_url" content="{{ image }}" />
{% endif %}
{% endif %}
{% endblock %}
{% block css %}
{{ encore_entry_link_tags('app') }}
{% endblock %}

24
templates/blog/post/post.html.twig

@ -37,27 +37,27 @@
{{ include('blog/post/_post.html.twig', {full: true}) }}
{% endblock %}
{%- block metas -%}
{#
{{ parent() }}
{% if not page.object.quick %}
{%- block openGraph -%}
{% if not post.isQuick %}
{% set name = 'Deblan Blog' %}
{% set title = 'Blog - ' ~ block('meta_title') %}
{% set image = app.request.getSchemeAndHttpHost() ~ asset(page.object.getWebPathForPicture) %}
{% set image = post.image ? asset(post.image) : null %}
{% else %}
{% set image = page.object.quickImage %}
{% set image = post.quickImage %}
{% set title = block('meta_title') %}
{% set name = '' %}
{% endif %}
<link rel="canonical" href="{{ cms_path('post', {post: page.object.id, slug: page.object.slug}, true) }}" />
<link rel="canonical" href="{{ safe_url(_node.routeName, {post: post.id, slug: post.slug}) }}" />
<meta property="og:title" content="{{ title|raw }}" />
<meta property="og:url" content="{{ cms_path('post', {post: page.object.id, slug: page.object.slug}, true) }}" />
<meta property="og:image" content="{{ image }}" />
<meta property="og:image:secure_url" content="{{ image }}" />
<meta property="og:url" content="{{ safe_url(_node.routeName, {post: post.id, slug: post.slug}) }}" />
{% if image %}
<meta property="og:image" content="{{ image }}" />
<meta property="og:image:secure_url" content="{{ image }}" />
{% endif %}
<meta property="og:site_name" content="{{ name }}" />
<meta property="og:locale" content="fr_FR" />
<meta property="og:type" content="article" />
#}
{% endblock %}

2
templates/blog/post_admin/edit.html.twig

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

2
templates/blog/post_admin/index.html.twig

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5">
<div class="d-flex">

2
templates/blog/post_admin/new.html.twig

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

2
templates/blog/post_admin/show.html.twig

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

5
webpack.config.js

@ -61,7 +61,10 @@ Encore
from: './assets/fonts',
to: 'fonts/[path][name].[hash:8].[ext]'
})
.copyFiles({
from: './assets/webapp',
to: 'webapp/[path][name].[hash:8].[ext]'
})
// enables Sass/SCSS support
.enableSassLoader()

Loading…
Cancel
Save