diff --git a/docs/source/development/embeddable-comments.rst b/docs/source/development/embeddable-comments.rst new file mode 100644 index 000000000..e14e8e84b --- /dev/null +++ b/docs/source/development/embeddable-comments.rst @@ -0,0 +1,121 @@ + +.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + + +Embeddable comments +################### + +Those embeddable comments is a comment with some metadata: + +* the one who updated the comment (the comment itself, and not the whole entity); +* the date and time for the last update (again, the comment itself, and not the whole entity). + +We make usage of `embeddables `_. + +Embed the comment +================= + +The comment may be embedded into the entity: + +.. code-block:: php + + namespace Chill\ActivityBundle\Entity; + + use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; + use Doctrine\ORM\Mapping as ORM; + + /** + * Class Activity + * + * @ORM\Entity() + */ + class Activity + { + /** + * @var integer + * + * @ORM\Id + * @ORM\Column(name="id", type="integer") + * @ORM\GeneratedValue(strategy="AUTO") + */ + private $id; + + /** + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") + */ + private $comment; + + + /** + * @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable + */ + public function getComment() + { + return $this->comment; + } + + /** + * @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment + */ + public function setComment($comment) + { + $this->comment = $comment; + } + } + +Note on relation to :class:`User` +================================= + +The embeddable proposed by Doctrine does not support relationship to other entities. The entity Comment is able to render a user's id, but not an User object. + + +.. code-block:: php + + $activity->getComment()->getUserId(); // return user id of the last author + + $activity->getComment()->getUser(); // does not work ! + + +Usage into form +=============== + +Use the :class:`Chill\MainBundle\Form\Type\CommentType` to load the form widget: + +.. code-block:: php + + namespace Chill\ActivityBundle\Form; + + use Chill\MainBundle\Form\Type\CommentType; + use Symfony\Component\Form\AbstractType; + use Symfony\Component\Form\FormBuilderInterface; + + class ActivityType extends AbstractType + { + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('comment', CommentType::class, [ + 'required' => false, + ]) + ; + } + } + +Render the comment +================== + +.. code-block:: twig + + {{ activity.comment|chill_entity_render_box }} + + diff --git a/docs/source/development/index.rst b/docs/source/development/index.rst index b5d39e166..04f91ede1 100644 --- a/docs/source/development/index.rst +++ b/docs/source/development/index.rst @@ -29,6 +29,7 @@ As Chill rely on the `symfony `_ framework, reading the fram Searching Timelines Exports + Embeddable comments Testing Useful snippets manual/index.rst @@ -40,6 +41,7 @@ Layout and UI .. toctree:: :maxdepth: 2 + Render entities automatically Layout / Template usage Classes and mixins Widgets diff --git a/docs/source/development/render-entity.rst b/docs/source/development/render-entity.rst new file mode 100644 index 000000000..bfc579682 --- /dev/null +++ b/docs/source/development/render-entity.rst @@ -0,0 +1,154 @@ + +Rendering entity automatically +############################## + +Some entity need to be rendered automatically for a couple of times: a person, a user, ... + +One can use some twig filter to render those entities: + +.. code-block:: twig + + {{ person|chill_entity_render_box }} + +Define a renderer +================= + +By default, the object passed through the renderer will be rendered using the :code:`__toString()` method. To customize this behaviour, you have to define a service and tag it using :code:`chill.render_entity`. + +The rendered is implemented using :class:`Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface`. This interface has 3 methods: + +* :code:`public function supports($entity, array $options): bool`: return true if the :code:`$entity` given in parameter, with custom options, is supported by this renderer; +* :code:`public function renderString($entity, array $options): string`: render the entity as a single string, for instance in a select list; +* :code:`public function renderBox($entity, array $options): string`: render the entity in an html box. + +.. warning:: + + The HTML returned by :code:`renderBox` **MUST BE SAFE** of any XSS injection. + +:class:`Chill\MainBundle\Templating\Entity\AbstractChillEntityRender` provides some useful methods to get the opening and closing boxes that should be used. + +Usage about rendering comment: + +.. code-block:: php + + namespace Chill\MainBundle\Templating\Entity; + + use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; + use Chill\MainBundle\Repository\UserRepository; + use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; + use Symfony\Component\Templating\EngineInterface; + + class CommentRender extends AbstractChillEntityRender + { + /** + * @var \Chill\MainBundle\Repository\UserRepository + */ + private $userRepository; + + /** + * + * @var EngineInterface + */ + private $engine; + + public function __construct( + UserRepository $userRepository, + EngineInterface $engine + ) { + $this->userRepository = $userRepository; + $this->engine = $engine; + } + + /** + * @param CommentEmbeddable $entity + * @param array $options + * + * @return string + */ + public function renderBox($entity, array $options): string + { + // default options + $options = \array_merge([ + 'user' => [], + 'disable_markdown' => false, + 'limit_lines' => null, + 'metadata' => true + ], $options); + + if ($entity->getUserId()) { + $user = $this->userRepository->find($entity->getUserId()); + } + + return $this->engine + ->render( + '@ChillMain/Entity/CommentEmbeddable.html.twig', + [ + 'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'), + 'closing_box' => $this->getDefaultClosingBox(), + 'user' => $user ?? NULL, + 'comment' => $entity, + 'options' => $options + ] + ); + } + + /** + * @param CommentEmbeddable $entity + * @param array $options + * + * @return string + */ + public function renderString($entity, array $options): string + { + return $entity->getComment(); + } + + public function supports($entity, array $options): bool + { + return $entity instanceof CommentEmbeddable; + } + } + +Logic inside the template: + +.. code-block:: twig + + {{ opening_box|raw }} +
+ {# logic for rendering #} +
+ {{ closing_box|raw }} + +Usage in templates +================== + +For rendering entity as a box: + +.. code-block:: twig + + {{ entity|chill_entity_render_box }} + +For rendering entity as a string: + +.. code-block:: twig + + {{ entity|chill_entity_render_string }} + +Available renderer and options +============================== + +:code:`Person` (Person Bundle) +------------------------------ + +* no options + +:code:`CommentEmbeddable` (Main Bundle) +--------------------------------------- + +Options: + +* :code:`user`: options which will be passed to "user" renderer +* :code:`disable_markdown`: disable markdown renderer, default to :code:`FALSE` +* :code:`limit_lines` (integer) limit the number of lines. Default to :code:`NULL`. May be an integer. +* :code:`metadata` (boolean): show the last updating user and last updating date. Default to :code:`TRUE`. + diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index ad0e55aa7..3a9a307fd 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -15,7 +15,6 @@ use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTra use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Chill\ActivityBundle\Form\Type\TranslatableActivityType; use Chill\ActivityBundle\Form\Type\TranslatableActivityReason; use Chill\MainBundle\Form\Type\UserPickerType; diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index fa20d33fc..94a9d9a82 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -46,12 +46,7 @@ {{ activity.durationTime|date('H:i') }} {% if activity.comment.comment is not empty %} -
- {{ activity.comment.comment|slice(0, 250) }} {# - sf4 check: if 'slice' could replace 'truncate' filter ? - truncate come with twig-extensions, in conflict with twig 3 - #} -
+ {{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }} {% endif %} {%- if activity.reasons is empty -%} {{ 'No reason associated'|trans }} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Timeline/activity_person_context.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Timeline/activity_person_context.html.twig index d788c1cf3..dddd05cf7 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Timeline/activity_person_context.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Timeline/activity_person_context.html.twig @@ -13,7 +13,7 @@ {% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
-
{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}
{{ activity.comment.comment|nl2br }}
{% endif %}
+
{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}{{ activity.comment|chill_entity_render_box({'metadata': false}) }}{% endif %}
{{ 'Reasons'|trans }}
{%- if activity.reasons is empty -%} diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php index 184bbbe33..1629410af 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php @@ -4,7 +4,6 @@ namespace Chill\DocStoreBundle\Form; use Chill\DocStoreBundle\Entity\Document; -use Chill\DocStoreBundle\Entity\DocumentCategory; use Chill\DocStoreBundle\Entity\PersonDocument; use Chill\MainBundle\Entity\User; use Symfony\Component\Form\AbstractType; @@ -12,15 +11,13 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Doctrine\ORM\EntityRepository; -use Chill\MainBundle\Form\Type\AppendScopeChoiceTypeTrait; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Doctrine\Persistence\ObjectManager; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ScopePickerType; use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Chill\MainBundle\Form\Type\ChillTextareaType; class PersonDocumentType extends AbstractType @@ -62,7 +59,7 @@ class PersonDocumentType extends AbstractType { $builder ->add('title', TextType::class) - ->add('description', TextareaType::class, [ + ->add('description', ChillTextareaType::class, [ 'required' => false ]) ->add('object', StoredObjectType::class, [ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/uploader.js b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/uploader.js index 9e96070bb..3fcfb0a42 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/uploader.js +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/uploader.js @@ -1,5 +1,5 @@ var algo = 'AES-CBC'; -var Dropzone = require('dropzone'); +import Dropzone from 'dropzone'; var initializeDownload = require('./downloader.js'); @@ -121,7 +121,7 @@ var createZone = (zone, zoneData) => { created.classList.add('dropzone'); initMessage.classList.add('dz-message'); initMessage.appendChild(document.createTextNode(initContent)); - + console.log(Dropzone); dropzoneI = new Dropzone(created, { url: function(files) { return getUploadUrl(zoneData, files); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/show.html.twig index ac1b18601..1761b4db7 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/show.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/show.html.twig @@ -45,7 +45,7 @@ {{ 'Any description'|trans }} {% else %}
- {{ document.description }} + {{ document.description|chill_markdown_to_html }}
{% endif %} diff --git a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php index a088af573..a6e664769 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php @@ -20,7 +20,7 @@ namespace Chill\MainBundle\Form\Type; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Chill\MainBundle\Form\Type\ChillTextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -44,8 +44,8 @@ class CommentType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('comment', TextareaType::class, [ - + ->add('comment', ChillTextareaType::class, [ + 'disable_editor' => $options['disable_editor'] ]) ; @@ -72,8 +72,12 @@ class CommentType extends AbstractType public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults([ - 'data_class' => CommentEmbeddable::class, - ]); + $resolver + ->setDefined('disable_editor') + ->setAllowedTypes('disable_editor', 'bool') + ->setDefaults([ + 'data_class' => CommentEmbeddable::class, + 'disable_editor' => false + ]); } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/main.js b/src/Bundle/ChillMainBundle/Resources/public/main.js index 1e03bc527..1e8573f2f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/main.js +++ b/src/Bundle/ChillMainBundle/Resources/public/main.js @@ -36,6 +36,7 @@ require('./modules/breadcrumb/index.js'); require('./modules/download-report/index.js'); require('./modules/select_interactive_loading/index.js'); require('./modules/export-list/export-list.scss'); +require('./modules/entity/index.js'); /* * load img diff --git a/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/index.scss b/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/index.scss index 3e5259af4..5fceab7bc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/index.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/index.scss @@ -1,4 +1,8 @@ // set min height for ckeditor .ck-editor__editable { min-height: 150px; +} + +.ck-editor.ck-reset { + margin-bottom: 1.5em; } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/modules/entity/comment_embeddable.scss b/src/Bundle/ChillMainBundle/Resources/public/modules/entity/comment_embeddable.scss new file mode 100644 index 000000000..e45173e56 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/modules/entity/comment_embeddable.scss @@ -0,0 +1,6 @@ +.chill-entity__comment-embeddable { + .chill-entity__comment-embeddable__metadata { + font-size: smaller; + color: var(--chill-light-gray); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/modules/entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/modules/entity/index.js new file mode 100644 index 000000000..c739899a5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/modules/entity/index.js @@ -0,0 +1,2 @@ +// css classes to render entities +require('./comment_embeddable.scss'); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Entity/CommentEmbeddable.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Entity/CommentEmbeddable.html.twig new file mode 100644 index 000000000..c9b76451c --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Entity/CommentEmbeddable.html.twig @@ -0,0 +1,36 @@ +{{ opening_box|raw }} +
+
+ + {%- if options['limit_lines'] is not null -%} + {% set content = comment.comment|split('\n')|slice(0, options['limit_lines'])|join('\n') %} + {%- else -%} + {% set content = comment.comment %} + {%- endif -%} + +
+ {% if options['disable_markdown'] %} + {{ content|nl2br }} + {% else %} + {{ content|chill_markdown_to_html }} + {% endif %} +
+
+
+{% if options['metadata'] %} + +{% endif %} +{{ closing_box|raw }} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index d5fce5749..9ff0ca90c 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -21,9 +21,9 @@ namespace Chill\MainBundle\Templating\Entity; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Symfony\Component\Templating\EngineInterface; class CommentRender extends AbstractChillEntityRender { @@ -31,10 +31,19 @@ class CommentRender extends AbstractChillEntityRender * @var \Chill\MainBundle\Repository\UserRepository */ private $userRepository; + + /** + * + * @var EngineInterface + */ + private $engine; - public function __construct(UserRepository $userRepository) - { + public function __construct( + UserRepository $userRepository, + EngineInterface $engine + ) { $this->userRepository = $userRepository; + $this->engine = $engine; } /** @@ -45,35 +54,29 @@ class CommentRender extends AbstractChillEntityRender */ public function renderBox($entity, array $options): string { - $username = ''; - + // default options + $options = \array_merge([ + 'user' => [], + 'disable_markdown' => false, + 'limit_lines' => null, + 'metadata' => true + ], $options); + if ($entity->getUserId()) { $user = $this->userRepository->find($entity->getUserId()); - if ($user instanceof User) { - $username = $user->getUsername(); - } } - - $str = $this->getDefaultOpeningBox('comment-embeddable'). - ''. - nl2br($entity->getComment()). - ''; - - if ($entity->getDate() instanceof \DateTime) { - $str .= ''. - $entity->getDate()->format('d/m/Y H:i'); - ''; - } - - if (strlen($username) > 0) { - $str .= ''. - $username. - ''; - } - - $str .= $this->getDefaultClosingBox(); - - return $str; + + return $this->engine + ->render( + '@ChillMain/Entity/CommentEmbeddable.html.twig', + [ + 'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'), + 'closing_box' => $this->getDefaultClosingBox(), + 'user' => $user ?? NULL, + 'comment' => $entity, + 'options' => $options + ] + ); } /** diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index f9bd8d7fb..29dc676d1 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -34,6 +34,7 @@ services: Chill\MainBundle\Templating\Entity\CommentRender: arguments: - '@chill.main.user_repository' + - '@Symfony\Component\Templating\EngineInterface' tags: - { name: 'chill.render_entity' } diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index b19feb69c..a7b71a072 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -35,6 +35,9 @@ This form contains errors: Ce formulaire contient des erreurs Choose an user: Choisir un utilisateur 'You are going to leave a page with unsubmitted data. Are you sure you want to leave ?': "Vous allez quitter la page alors que des données n'ont pas été enregistrées. Êtes vous sûr de vouloir partir ?" No value: Aucune information +Last updated by: Dernière mise à jour par +Last updated on: Dernière mise à jour le +on: le Edit: Modifier Update: Mettre à jour diff --git a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php index 2de2011a1..b4c146960 100644 --- a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php +++ b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php @@ -6,17 +6,16 @@ use Chill\MainBundle\Entity\Center; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Form\FormEvents; -use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Chill\MainBundle\Form\Type\ChillTextareaType; use Symfony\Component\Form\Extension\Core\Type\DateType; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\MainBundle\Form\Type\UserPickerType; use Symfony\Component\Security\Core\Role\Role; use Chill\PersonBundle\Form\Type\ClosingMotivePickerType; + /** * Class AccompanyingPeriodType * @@ -89,7 +88,7 @@ class AccompanyingPeriodType extends AbstractType ]); } - $builder->add('remark', TextareaType::class, [ + $builder->add('remark', ChillTextareaType::class, [ 'required' => false ]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index 4d82813d0..54908b7cc 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -48,8 +48,13 @@ {% endif %} - - {{ accompanying_period.remark|chill_print_or_message('No remark', 'blockquote') }} + {% if accompanying_period is not empty %} +
+ {{ accompanying_period.remark|chill_markdown_to_html }} +
+ {% else %} + {{ null|chill_print_or_message('No remark', 'blockquote') }} + {% endif %}
    diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php index d215c2b75..16f000aa2 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php @@ -22,15 +22,12 @@ use Symfony\Component\Form\FormBuilderInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Entity\Center; use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Chill\MainBundle\Form\Type\UserPickerType; use Chill\MainBundle\Form\Type\ScopePickerType; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Role\Role; -use Chill\TaskBundle\Security\Authorization\TaskVoter; use Chill\MainBundle\Form\Type\DateIntervalType; +use Chill\MainBundle\Form\Type\ChillTextareaType; /** * @@ -43,7 +40,7 @@ class SingleTaskType extends AbstractType { $builder ->add('title', TextType::class) - ->add('description', TextareaType::class, [ + ->add('description', ChillTextareaType::class, [ 'required' => false ]) ->add('assignee', UserPickerType::class, [ diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/show.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/show.html.twig index 4f01b6b27..7dc48f058 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/show.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/show.html.twig @@ -37,7 +37,7 @@ {{"No description"|trans}} {% else %}
    - {{ task.description }} + {{ task.description|chill_markdown_to_html }}
    {% endif %} diff --git a/src/Bundle/ChillTaskBundle/Resources/views/Timeline/single_task_transition_person_context.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/Timeline/single_task_transition_person_context.html.twig index ec0c5195d..234bbc134 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/Timeline/single_task_transition_person_context.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/Timeline/single_task_transition_person_context.html.twig @@ -18,7 +18,7 @@
    {{ 'Description'|trans }}
    - {{ event.task.description }} + {{ event.task.description|chill_markdown_to_html }}
    {% endif %}