From 406ec14c3d35ccbc887c077081312261948dd3e8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 27 Nov 2021 16:28:14 +0100 Subject: [PATCH] add JS masonry placement on resume page --- .../page/accompanying_course_index/masonry.js | 6 ++ .../views/AccompanyingCourse/index.html.twig | 69 +++++++++---------- .../ChillPersonBundle/chill.webpack.config.js | 1 + 3 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js b/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js new file mode 100644 index 000000000..e2dadd2a9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js @@ -0,0 +1,6 @@ +import Masonry from 'masonry-layout/masonry'; + +let elem = document.querySelector('#dashboards'); +let msnry = new Masonry( elem, { + // options +}); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index dd4b99558..697a3e2b2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -15,34 +15,35 @@ {% block js %} {{ parent() }} {{ encore_entry_script_tags('page_accompanying_course_index_person_locate') }} +{{ encore_entry_script_tags('page_accompanying_course_index_masonry') }} {% endblock %} {% block content %} -
+
- {% if 'DRAFT' == accompanyingCourse.step %} -
- {% include '@ChillPerson/AccompanyingCourse/_still_draft.html.twig' %} -
- {% endif %} - - {% if 'DRAFT' != accompanyingCourse.step %} - {% if withoutHousehold|length > 0 %} -
- {% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' %} +
+ {% if 'DRAFT' == accompanyingCourse.step %} +
+ {% include '@ChillPerson/AccompanyingCourse/_still_draft.html.twig' %}
{% endif %} - {% endif %} - {% if accompanyingCourse.locationStatus == 'address' - or accompanyingCourse.locationStatus == 'none' %} -
- {% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' %} -
- {% endif %} + {% if 'DRAFT' != accompanyingCourse.step %} + {% if withoutHousehold|length > 0 %} +
+ {% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' %} +
+ {% endif %} + {% endif %} -
-
+ {% if accompanyingCourse.locationStatus == 'address' + or accompanyingCourse.locationStatus == 'none' %} +
+ {% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' %} +
+ {% endif %} + +
{% if accompanyingCourse.locationStatus == 'person' %}

{{ 'This course is located by'|trans }}

{{ accompanyingCourse.personLocation|chill_entity_render_string }}

@@ -54,28 +55,21 @@ {{ accompanyingCourse.location|chill_entity_render_box }} {% endif %}
-
- {% if accompanyingCourse.scopes is not empty - or (accompanyingCourse.requestorThirdParty is not null - or accompanyingCourse.requestorPerson is not null) - or accompanyingCourse.participations is not empty - or accompanyingCourse.resources is not empty - %} -
-
+
{% if accompanyingCourse.scopes is not empty %}

{{ 'Scopes'|trans }}

-

+

{% for s in accompanyingCourse.scopes %} {{ s.name|localize_translatable_string|capitalize }}{% if not loop.last %}, {% endif %} {% endfor %} -

+
{% else %} {{ 'No scopes'|trans }} {% endif %}
-
+ +
{% if accompanyingCourse.requestorPerson is not null %}

{{ 'Requestor'|trans }}

{{ _self.insert_onthefly('person', accompanyingCourse.requestorPerson) }} @@ -86,7 +80,8 @@ {{ 'No requestor'|trans }} {% endif %}
-
+ +
{% if accompanyingCourse.participations is not empty %}

{{ 'Persons associated'|trans }}

{% for r in accompanyingCourse.participations %} @@ -100,7 +95,8 @@ {{ 'No participations'|trans }} {% endif %}
-
+ +
{% if accompanyingCourse.resources is not empty %}

{{ 'Resources'|trans }}

{% for r in accompanyingCourse.resources %} @@ -115,15 +111,14 @@ {% endif %}
- {% endif %} -