Add single detail page to view entire article from within news item history page

This commit is contained in:
Julie Lenaerts 2023-11-21 10:18:16 +01:00
parent 8f3256e46e
commit 693bf65721
5 changed files with 62 additions and 23 deletions

View File

@ -46,6 +46,21 @@ class NewsItemHistoryController extends AbstractController
]); ]);
} }
/**
* @Route("/{_locale}/news-items/{id}", name="chill_main_single_news_item")
*/
public function showSingleItem(int $id, Request $request): Response
{
$newsItem = $this->newsItemRepository->findOneBy(['id' => $id]);
return $this->render(
'@ChillMain/NewsItem/show.html.twig',
[
'entity' => $newsItem,
]
);
}
private function buildFilterOrder($includeFilterByUser = true, $includeMissionType = false): FilterOrderHelper private function buildFilterOrder($includeFilterByUser = true, $includeMissionType = false): FilterOrderHelper
{ {
$filterBuilder = $this->filterOrderHelperFactory $filterBuilder = $this->filterOrderHelperFactory

View File

@ -4,8 +4,8 @@
{% embed '@ChillMain/CRUD/_index.html.twig' %} {% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %} {% block table_entities_thead_tr %}
<th>{{ 'Title'|trans }}</th> <th>{{ 'Title'|trans }}</th>
<th>{{ 'dashboard.news.startDate'|trans }}</th> <th>{{ 'news.startDate'|trans }}</th>
<th>{{ 'dashboard.news.endDate'|trans }}</th> <th>{{ 'news.endDate'|trans }}</th>
{% endblock %} {% endblock %}
{% block table_entities_tbody %} {% block table_entities_tbody %}
{% for entity in entities %} {% for entity in entities %}
@ -15,7 +15,7 @@
{% if entity.endDate is not null %} {% if entity.endDate is not null %}
<td>{{ entity.endDate|date }}</td> <td>{{ entity.endDate|date }}</td>
{% else %} {% else %}
<td>{{ 'dashboard.news.noDate'|trans }}</td> <td>{{ 'news.noDate'|trans }}</td>
{% endif %} {% endif %}
<td> <td>
<ul class="record_actions"> <ul class="record_actions">

View File

@ -1,18 +1,18 @@
{% extends "@ChillMain/layout.html.twig" %} {% extends "@ChillMain/layout.html.twig" %}
{% block title %} {% block title %}
{{ 'news_history.title'|trans }} {{ 'news.title'|trans }}
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
<div class="col-md-10 asideactivity-list"> <div class="col-md-10 asideactivity-list">
<h2>{{ 'news_history.title'|trans }}</h2> <h2>{{ 'news.title'|trans }}</h2>
{{ filter_order|chill_render_filter_order_helper }} {{ filter_order|chill_render_filter_order_helper }}
{% if entities|length == 0 %} {% if entities|length == 0 %}
<p class="chill-no-data-statement"> <p class="chill-no-data-statement">
{{ "news_history.no_data"|trans }} {{ "news.no_data"|trans }}
</p> </p>
{% else %} {% else %}
@ -39,17 +39,20 @@
<div class="item-col" style="justify-content: flex-end;"> <div class="item-col" style="justify-content: flex-end;">
<div class="box"> <div class="box">
<div> <div>
{% apply markdown_to_html %} {# <blockquote class="chill-user-quote">#}
{{ entity.content }} {{ entity.content|u.truncate(350, '…', false)|chill_markdown_to_html }}
{% endapply %} {# {% if entity.content|length > 350 %}#}
{# <a href="{{ chill_path_add_return_path('chill_main_news_items_history', {'news_item_id': entity.id}) }}">{{ 'news.read_more'|trans }}</a>#}
{# {% endif %}#}
{# </blockquote>#}
<div class="action">
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_main_single_news_item', { 'id': entity.id } ) }}" class="btn btn-show btn-mini"></a>
</li>
</ul>
</div>
</div> </div>
{# <div class="action">#}
{# <ul class="record_actions">#}
{# <li>#}
{# <a href="{{ chill_path_add_return_path('chill_crud_news_item_view', { 'id': entity.id } ) }}" class="btn btn-show btn-mini"></a>#}
{# </li>#}
{# </ul>#}
{# </div>#}
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,21 @@
{% extends '@ChillMain/layout.html.twig' %}
{% block title 'news.show_details'|trans %}
{% block content %}
<h1>{{ entity.title }}</h1>
<div class="flex-table">
<div class="item-row">
<div>
<span>{{ entity.startDate|format_date('long') }}</span>
{% if entity.endDate is not null %}
<span> - {{ entity.endDate|format_date('long') }}</span>
{% endif %}
</div>
</div>
<div class="item-row separator">
{{ entity.content|chill_markdown_to_html }}
</div>
</div>
{% endblock %}

View File

@ -75,7 +75,6 @@ Comment: Commentaire
Comments: Commentaires Comments: Commentaires
Pinned comment: Commentaire épinglé Pinned comment: Commentaire épinglé
Any comment: Aucun commentaire Any comment: Aucun commentaire
Read more: Lire la suite
(more...): (suite...) (more...): (suite...)
# comment embeddable # comment embeddable
@ -683,13 +682,14 @@ admin:
news: Actualités news: Actualités
description: Configuration du tableau de bord description: Configuration du tableau de bord
dashboard:
news: news:
noDate: Pas de date de fin noDate: Pas de date de fin
startDate: Date de début startDate: Date de début
endDate: Date de fin endDate: Date de fin
news_history:
title: Historique des actualités title: Historique des actualités
menu: Actualités menu: Actualités
no_data: Aucune actualité no_data: Aucune actualité
read_more: Lire la suite