mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove old doc index page, replace by the generic doc index page
This commit is contained in:
parent
e550817ded
commit
2b5d007fda
@ -39,10 +39,6 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private AccompanyingCourseDocumentRepository $courseRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
/**
|
||||
* DocumentAccompanyingCourseController constructor.
|
||||
*/
|
||||
@ -50,14 +46,10 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
AccompanyingCourseDocumentRepository $courseRepository
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->courseRepository = $courseRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +74,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-period_index', ['id' => $course->getId()]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
@ -136,40 +128,6 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="accompanying_course_document_index", methods="GET")
|
||||
*/
|
||||
public function index(AccompanyingPeriod $course): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if (null === $course) {
|
||||
throw $this->createNotFoundException('Accompanying period not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
||||
|
||||
$total = $this->courseRepository->countByCourse($course);
|
||||
$pagination = $this->paginatorFactory->create($total);
|
||||
|
||||
$documents = $this->courseRepository
|
||||
->findBy(
|
||||
['course' => $course],
|
||||
['date' => 'DESC', 'id' => 'DESC'],
|
||||
$pagination->getItemsPerPage(),
|
||||
$pagination->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'ChillDocStoreBundle:AccompanyingCourseDocument:index.html.twig',
|
||||
[
|
||||
'documents' => $documents,
|
||||
'accompanyingCourse' => $course,
|
||||
'pagination' => $pagination,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="accompanying_course_document_new", methods="GET|POST")
|
||||
*/
|
||||
|
@ -62,9 +62,9 @@ final class MenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
if ($this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $course)) {
|
||||
$menu->addChild($this->translator->trans('Documents'), [
|
||||
'route' => 'accompanying_course_document_index',
|
||||
'route' => 'chill_docstore_generic-doc_by-period_index',
|
||||
'routeParameters' => [
|
||||
'course' => $course->getId(),
|
||||
'id' => $course->getId(),
|
||||
],
|
||||
])
|
||||
->setExtras([
|
||||
|
@ -31,8 +31,8 @@
|
||||
'title' : 'Delete document ?'|trans,
|
||||
'display_content' : block('docdescription'),
|
||||
'confirm_question' : 'Are you sure you want to remove this document ?'|trans,
|
||||
'cancel_route' : 'accompanying_course_document_index',
|
||||
'cancel_parameters' : {'course' : accompanyingCourse.id, 'id': document.id},
|
||||
'cancel_route' : 'chill_docstore_generic-doc_by-period_index',
|
||||
'cancel_parameters' : {'id' : accompanyingCourse.id},
|
||||
'form' : delete_form
|
||||
} ) }}
|
||||
{% endblock %}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-period_index', {'id': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
@ -31,7 +31,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="edit">
|
||||
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
|
||||
<button class="btn btn-save">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% block title %}
|
||||
{{ 'Documents' }}
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
||||
{{ encore_entry_script_tags('mod_document_action_buttons_group') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
||||
{{ encore_entry_link_tags('mod_entity_workflow_pick') }}
|
||||
{{ encore_entry_link_tags('mod_document_action_buttons_group') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="document-list">
|
||||
<h1>{{ 'Documents' }}</h1>
|
||||
|
||||
{% if documents|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||
{% else %}
|
||||
<div class="flex-table chill-task-list">
|
||||
{% for document in documents %}
|
||||
{% include '@ChillDocStore/List/list_item.html.twig' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ chill_pagination(pagination) }}
|
||||
|
||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
||||
|
||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="create">
|
||||
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
||||
{{ 'Create'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
@ -25,7 +25,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-period_index', {'id': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-period_index', {'id': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user