From 260ce8ba1750e00ca5fdbcf87073480011cf6b69 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 28 Feb 2022 14:43:24 +0100 Subject: [PATCH 1/3] issue 463: add delete button on draft periods page --- CHANGELOG.md | 1 + .../AccompanyingPeriod/user_draft_periods_list.html.twig | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ec146ea7..69137f346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to * [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388) * [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person) +* [draft periods] add a delete button (if acl granted) on each draft period listed on draft period page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/463) ## Test releases diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig index 33317d51d..d7bd8eea6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -5,6 +5,12 @@ {% block title %}{{ 'My accompanying periods in draft'|trans }}{% endblock title %} {% macro recordAction(period) %} + {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE', period) %} +
  • + +
  • + {% endif %}
  • From b146f17d2f29ce51229f9146141f6a9b39873055 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 1 Mar 2022 09:58:45 +0100 Subject: [PATCH 2/3] Update twig function `isEditable`. --- .../Templating/WopiEditTwigExtensionRuntime.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index 50f495383..b31b4c538 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -15,11 +15,12 @@ use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Twig\Environment; use Twig\Extension\RuntimeExtensionInterface; + use function array_key_exists; -class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface +final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface { - public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig'; + private const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig'; private DiscoveryInterface $discovery; @@ -32,10 +33,6 @@ class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface { $mime_type = $this->discovery->discoverMimeType($document->getType()); - if ([] === $mime_type) { - return false; - } - foreach ($mime_type as $item) { if (array_key_exists('default', $item) && 'true' === $item['default']) { return true; From 0d38cae217d5fed48367169a6ed2ed4044686c15 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 1 Mar 2022 11:33:33 +0100 Subject: [PATCH 3/3] fix macro metadata + fix merge conflicts from branch ux_corrections --- .../Resources/views/List/list_item.html.twig | 88 +++++++++---------- .../Resources/views/Macro/updatedBy.html.twig | 38 +++++--- 2 files changed, 67 insertions(+), 59 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig index 51a82b5d2..44bcf5cbc 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig @@ -1,8 +1,10 @@ {% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} +{% import '@ChillPerson/Macro/updatedBy.html.twig' as mmm %} +
    -
    +
    {{ document.title }}
    @@ -30,57 +32,51 @@
    {% if document.description is not empty %} -
    -
    +
    +
    {{ document.description|chill_markdown_to_html }}
    {% endif %}
    -
    - {{ 'Created by'|trans }}: - {{ document.createdBy|chill_entity_render_string }} - le {{ document.createdAt|format_date('long') }} -
    + {{ mmm.createdBy(document) }} +
    +
    +
      + {% if document.course is defined %} + {% 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 %} +
    • + {{ chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) }} +
    • + {% else %} + {% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %} +
    • + {{ m.download_button(document.object, document.title) }} +
    • +
    • + +
    • + {% endif %} + {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} +
    • + +
    • + {% endif %} + {% endif %} +
    -
    - {% if document.course is defined %} -
      -
    • - {{ chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) }} -
    • - {% 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 %} -
    - {% else %} -
      - {% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %} -
    • - {{ m.download_button(document.object, document.title) }} -
    • -
    • - -
    • - {% endif %} - {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} -
    • - -
    • - {% endif %} -
    - {% endif %} -
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig index e40cbd3f7..cbfd7660b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig @@ -1,11 +1,17 @@ {% macro updatedBy(entity) %}
    - {{ 'Last updated on'|trans }} - - {{ entity.updatedAt|format_datetime('medium', 'short') }} - - {% if entity.updatedBy %} - {{ ', ' ~ 'by_user'|trans }} + {% if entity.updatedAt != null %} + {{ 'Last updated on'|trans }} + + {{ entity.updatedAt|format_datetime('medium', 'short') }} + + {% endif %} + {% if entity.updatedBy != null %} + {% if entity.updatedAt != null %} + {{ ', ' ~ 'by_user'|trans }} + {% else %} + {{ 'Last updated by'|trans }} + {% endif %} {{ entity.updatedBy|chill_entity_render_box }} @@ -14,13 +20,19 @@ {% endmacro %} {% macro createdBy(entity) %} -
    - {{ 'Created on'|trans }} - - {{ entity.createdAt|format_datetime('medium', 'short') }} - - {% if entity.createdBy %} - {{ ', ' ~ 'by_user'|trans }} +
    + {% if entity.createdAt != null %} + {{ 'Created on'|trans }} + + {{ entity.createdAt|format_datetime('medium', 'short') }} + + {% endif %} + {% if entity.createdBy != null %} + {% if entity.createdAt != null %} + {{ ', ' ~ 'by_user'|trans }} + {% else %} + {{ 'Created by'|trans }} + {% endif %} {{ entity.createdBy|chill_entity_render_string }}