diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index 9905c363e..3f3c62cf4 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -2,7 +2,8 @@ namespace Chill\DocStoreBundle\Controller; -use App\Entity\AccompanyingCourseDocument; +use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; +use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Privacy\PrivacyEvent; @@ -12,12 +13,13 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Component\Routing\Annotation\Route; /** * Class DocumentAccompanyingCourseController * * @package Chill\DocStoreBundle\Controller - * @Route("/{_locale}/parcours/course/document") + * @Route("/{_locale}/parcours/{course}/document") * * TODO faire un controller abstrait ? */ @@ -92,7 +94,7 @@ class DocumentAccompanyingCourseController extends AbstractController 'ChillDocStoreBundle:AccompanyingCourseDocument:index.html.twig', [ 'documents' => $documents, - 'course' => $course + 'accompanyingCourse' => $course ]); } @@ -134,7 +136,7 @@ class DocumentAccompanyingCourseController extends AbstractController return $this->render('ChillDocStoreBundle:AccompanyingCourseDocument:new.html.twig', [ 'document' => $document, 'form' => $form->createView(), - 'course' => $course, + 'accompanyingCourse' => $course, ]); } @@ -155,7 +157,7 @@ class DocumentAccompanyingCourseController extends AbstractController return $this->render( 'ChillDocStoreBundle:AccompanyingCourseDocument:show.html.twig', - ['document' => $document, 'course' => $course]); + ['document' => $document, 'accompanyingCourse' => $course]); } /** @@ -187,7 +189,7 @@ class DocumentAccompanyingCourseController extends AbstractController return $this->redirectToRoute( 'accompanying_course_document_edit', - ['id' => $document->getId(), 'course' => $course->getId()]); + ['id' => $document->getId(), 'accompanyingCourse' => $course->getId()]); } elseif ($form->isSubmitted() and !$form->isValid()) { $this->addFlash('error', $this->translator->trans("This form contains errors")); @@ -205,7 +207,7 @@ class DocumentAccompanyingCourseController extends AbstractController [ 'document' => $document, 'form' => $form->createView(), - 'person' => $course, + 'accompanyingCourse' => $course, ]); } @@ -224,6 +226,6 @@ class DocumentAccompanyingCourseController extends AbstractController } return $this->redirectToRoute( - 'accompanying_course_document_index', ['course' => $course->getId()]); + 'accompanying_course_document_index', ['accompanyingCourse' => $course->getId()]); } } diff --git a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php index beadbc27d..3649bd51c 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php @@ -1,24 +1,17 @@ + + + + diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig new file mode 100644 index 000000000..e2b0a9559 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig @@ -0,0 +1,45 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% set activeRouteKey = '' %} + +{% block title %} + {# {{ 'Editing document for %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #} +{% endblock %} +{% block accompanyingCoursecontent %} + +

{{ 'Edit Document' | trans }}

+ + {{ form_errors(form) }} + + {{ form_start(form) }} + + {{ form_row(form.title) }} + {{ form_row(form.date) }} + {{ form_row(form.category) }} + {{ form_row(form.scope) }} + {{ form_row(form.description) }} + {{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }} + + + + {{ form_end(form) }} + + +{% endblock %} + +{% block js %} + {{ encore_entry_script_tags('mod_async_upload') }} +{% endblock %} + +{% block css %} + {{ encore_entry_link_tags('mod_async_upload') }} +{% endblock %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig new file mode 100644 index 000000000..3e8ed7f9c --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig @@ -0,0 +1,70 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% set activeRouteKey = '' %} + +{% import "@ChillDocStore/Macro/macro.html.twig" as m %} + +{% block title %} + {{ 'Documents' }} +{% endblock %} + +{% block js %} + {{ encore_entry_script_tags('mod_async_upload') }} +{% endblock %} + +{% block content %} +

{{ 'Documents' }}

+ + + + + + + + + + + + {% for document in documents %} + + + + + + + {% else %} + + + + {% endfor %} + +
{{ 'Title' | trans }}{{ 'Category'|trans }}{{ 'Circle' | trans }}{{ 'Actions' | trans }}
{{ document.title }}{{ document.category.name|localize_translatable_string }}{{ document.scope.name|localize_translatable_string }} +
    + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %} +
  • + {{ m.download_button(document.object, document.title) }} +
  • +
  • + +
  • + {% endif %} + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} +
  • + +
  • + {% endif %} +
+
+ {{ 'Any document found'|trans }} +
+ + {# {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %} #} + + {# {% endif %} #} +{% endblock %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/new.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/new.html.twig new file mode 100644 index 000000000..b3b9950ab --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/new.html.twig @@ -0,0 +1,45 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% set activeRouteKey = '' %} + +{% block title %} + {# {{ 'New document for %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #} +{% endblock %} + + +{% block content %} + + {#

{{ 'New document for %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }}

#} + + + {{ form_errors(form) }} + + {{ form_start(form) }} + + {{ form_row(form.title) }} + {{ form_row(form.date) }} + {{ form_row(form.category) }} + {# {{ form_row(form.scope) }} #} + {{ form_row(form.description) }} + {{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }} + + + {{ form_end(form) }} +{% endblock %} + +{% block js %} + {{ encore_entry_script_tags('mod_async_upload') }} +{% endblock %} + +{% block css %} + {{ encore_entry_link_tags('mod_async_upload') }} +{% endblock %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig new file mode 100644 index 000000000..901d84540 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig @@ -0,0 +1,61 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% set activeRouteKey = '' %} + +{% import "@ChillDocStore/Macro/macro.html.twig" as m %} + +{% block title %} + {# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #} +{% endblock %} + + +{% block js %} + {{ encore_entry_script_tags('mod_async_upload') }} +{% endblock %} + +{% block accompanyingCoursecontent %} + +

{{ 'Document %title%' | trans({ '%title%': document.title }) }}

+ +
+
{{ 'Title'|trans }}
+
{{ document.title }}
+ +
{{ 'Scope' | trans }}
+
{{ document.scope.name | localize_translatable_string }}
+ +
{{ 'Category'|trans }}
+
{{ document.category.name|localize_translatable_string }}
+ +
{{ 'Description' | trans }}
+
+ {% if document.description is empty %} + {{ 'Any description'|trans }} + {% else %} +
+ {{ document.description|chill_markdown_to_html }} +
+ {% endif %} +
+ +
+ +