From 982c704f6cd979840895f003a35272a70ed8426f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 20:21:39 +0200 Subject: [PATCH] improve activity list --- .../Resources/public/chill/chillactivity.scss | 199 ++++++----- .../Resources/views/Activity/list.html.twig | 316 ++++++++---------- .../Activity/listAccompanyingCourse.html.twig | 22 ++ .../views/Activity/listPerson.html.twig | 22 ++ .../views/Activity/selectType.html.twig | 46 +-- .../views/AccompanyingCourse/index.html.twig | 17 +- 6 files changed, 327 insertions(+), 295 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss index 1d271abfe..fc492c7bc 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss +++ b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss @@ -1,14 +1,105 @@ // Access to Bootstrap variables and mixins @import '~ChillMainAssets/module/bootstrap/shared'; -//@import '~ChillMainSass/custom/mixins/entity'; +// activity creation first step: select type page +div.new-activity-select-type { + div.activity-row { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + gap: 12px; -//.chill-entity.chill-entity__activity-reason { -// @include entity($chill-pink, white); -//} + div.bloc { + width: 200px; + align-self: flex-end; + height: 140px; + display: flex; + justify-content: center; + align-items: center; + } + } +} -.activity { - //color: $chill-green; +// exceptions for flex-table in list-records +div.activity-list { + div.flex-table { + div.item-bloc { + div.item-row.main { + div.item-col { + &:first-child { + flex-basis: 27%; + } + ul.list-content { + li.social-issues, li.social-actions { + .badge-primary { + font-variant: small-caps; + font-weight: bold; + font-size: 88%; + margin-bottom: 0.2em; + } + } + li.social-issues .badge-primary { + background-color: $orange; + } + li.social-actions .badge-primary { + background-color: $green; + } + } + } + } + div.item-row.details { + flex-direction: row; + & > div.item-col { + justify-content: flex-start; + align-self: center; + &:nth-child(1) { + flex-grow: 1; flex-shrink: 0; flex-basis: 30%; + } + &:nth-child(2) { + flex-grow: 0; flex-shrink: 1; flex-basis: 70%; + } + + &:only-child { + flex-grow: 0; flex-shrink: 0; flex-basis: 100%; + & > div.concerned-groups { + flex-grow: 0; flex-shrink: 0; flex-basis: 100%; + display: flex; + flex-direction: column; // TODO pas fini + div.group { + flex-grow: 1; flex-shrink: 0; flex-basis: 30%; + h4 {} + ul.list-content { + li { + display: inline; + } + } + } + } + } + } + div.concerned-groups { + font-size: 85%; + h4 { + text-transform: uppercase; + } + } + } + ul.list-content { + list-style-type: none; + padding-left: 1em; + margin: 0 0; + li { + margin-bottom: 0.2em; + } + } + } + div.duration { + font-size: smaller; + padding-left: 1em; + margin-top: 1em; + } + } } // exceptions for flex-bloc in concerned-groups @@ -22,7 +113,7 @@ div.flex-bloc.concerned-groups { li { margin-bottom: 0.2em; a { - color: white; + color: $white; cursor: pointer; &:hover { color: #ffffffab; @@ -36,97 +127,3 @@ div.flex-bloc.concerned-groups { } } -// exceptions for flex-table in list-records -div.flex-table.list-records { - div.item-bloc { - div.item-row.main { - div.item-col { - &:first-child { - flex-basis: 27%; - } - ul.list-content { - li.social-issues, li.social-actions { - .badge-primary { - font-variant: small-caps; - font-weight: bold; - font-size: 88%; - margin-bottom: 0.2em; - } - } - li.social-issues .badge-primary { - background-color: var(--chill-orange); - } - li.social-actions .badge-primary { - background-color: var(--chill-green); - } - } - } - } - div.item-row.details { - flex-direction: row; - & > div.item-col { - justify-content: flex-start; - align-self: center; - &:nth-child(1) { - flex-grow: 1; flex-shrink: 0; flex-basis: 30%; - } - &:nth-child(2) { - flex-grow: 0; flex-shrink: 1; flex-basis: 70%; - } - - &:only-child { - flex-grow: 0; flex-shrink: 0; flex-basis: 100%; - & > div.concerned-groups { - flex-grow: 0; flex-shrink: 0; flex-basis: 100%; - display: flex; - flex-direction: column; // TODO pas fini - div.group { - flex-grow: 1; flex-shrink: 0; flex-basis: 30%; - h4 {} - ul.list-content { - li { - display: inline; - } - } - } - } - } - } - div.concerned-groups { - font-size: 85%; - h4 { - text-transform: uppercase; - } - } - } - ul.list-content { - list-style-type: none; - padding-left: 1em; - margin: 0 0; - li { - margin-bottom: 0.2em; - } - } - } - div.duration { - font-size: smaller; - padding-left: 1em; - margin-top: 1em; - } -} - -div.activity-row { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: center; - gap: 12px; - div.bloc { - width: 200px; - align-self: flex-end; - height: 140px; - display: flex; - justify-content: center; - align-items: center; - } -} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index a312b3858..35d39f609 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -1,189 +1,163 @@ -{% set person_id = null %} -{% if person %} - {% set person_id = person.id %} -{% endif %} +
-{% set accompanying_course_id = null %} -{% if accompanyingCourse %} - {% set accompanying_course_id = accompanyingCourse.id %} -{% endif %} + {% if activities|length == 0 %} +

+ {{ "There isn't any activities."|trans }} + +

-

{{ 'Activity list' |trans }}

+ {% else %} +
+ {% for activity in activities %} + {% set t = activity.type %} +
+
+
-{% if activities|length == 0 %} -

- {{ "There isn't any activities."|trans }} - -

-{% else %} - -
- - {% for activity in activities %} - {% set t = activity.type %} -
-
-
- - {% if activity.date %} -

{{ activity.date|format_date('long') }}

- {% endif %} - -
- {% if t.durationTimeVisible > 0 %} -

- - {{ activity.durationTime|date('H:i') }} -

- {% endif %} - {% if activity.travelTime and t.travelTimeVisible %} -

- - {{ activity.travelTime|date('H:i') }} -

- {% endif %} -
- - {% if context == 'person' and activity.accompanyingPeriod is not empty %} - - {% endif %} - -
-
-
    - {% if activity.user and t.userVisible %} -
  • - {{ 'by'|trans }}{{ activity.user.usernameCanonical }} -
  • - {% endif %} - -
  • - {{ activity.type.name | localize_translatable_string }} - - {% if activity.attendee is not null and t.attendeeVisible %} - {% if activity.attendee %} - {{ '→ ' ~ 'present'|trans|capitalize }} - {% else %} - {{ '→ ' ~ 'not present'|trans|capitalize }} - {% endif %} + {% if activity.date %} +

    {{ activity.date|format_date('long') }}

    {% endif %} -
  • -
  • - {{ 'location'|trans ~ ': ' }} - Domicile de l'usager - {# - {% if activity.location %}{{ activity.location }}{% endif %} - #} -
  • +
    + {% if t.durationTimeVisible > 0 %} +

    + + {{ activity.durationTime|date('H:i') }} +

    + {% endif %} + {% if activity.travelTime and t.travelTimeVisible %} +

    + + {{ activity.travelTime|date('H:i') }} +

    + {% endif %} +
    - {%- if t.reasonsVisible -%} -
  • - {%- if activity.reasons is empty -%} - {{ 'No reason associated'|trans }} - {%- else -%} - {% for r in activity.reasons %} - {{ r|chill_entity_render_box }} - {% endfor %} - {%- endif -%} -
  • - {% endif %} + {% if context == 'person' and activity.accompanyingPeriod is not empty %} + + {% endif %} - {%- if t.socialIssuesVisible %} - - {% endif %} +
+
+
    + {% if activity.user and t.userVisible %} +
  • + {{ 'by'|trans }}{{ activity.user.usernameCanonical }} +
  • + {% endif %} - {%- if t.socialActionsVisible -%} - - {% endif %} +
  • + {{ activity.type.name | localize_translatable_string }} + + {% if activity.attendee is not null and t.attendeeVisible %} + {% if activity.attendee %} + {{ '→ ' ~ 'present'|trans|capitalize }} + {% else %} + {{ '→ ' ~ 'not present'|trans|capitalize }} + {% endif %} + {% endif %} +
  • + +
  • + {{ 'location'|trans ~ ': ' }} + Domicile de l'usager + {# + {% if activity.location %}{{ activity.location }}{% endif %} + #} +
  • + + {%- if t.reasonsVisible -%} +
  • + {%- if activity.reasons is not empty -%} + {% for r in activity.reasons %} + {{ r|chill_entity_render_box }} + {% endfor %} + {%- endif -%} +
  • + {% endif %} + + {%- if t.socialIssuesVisible %} + + {% endif %} + + {%- if t.socialActionsVisible -%} + + {% endif %} -
-
    -
  • - -
  • - {# TOOD +
+
    +
  • + +
  • + {# TOOD {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} - #} -
  • - -
  • - {# TOOD + #} +
  • + +
  • + {# TOOD {% endif %} {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} - #} -
  • - -
  • - {# - {% endif %} - #} -
-
-
+ #} +
  • + +
  • + {# + {% endif %} + #} + +
    +
    - {% if activity.comment.comment is not empty - or activity.persons|length > 0 - or activity.thirdParties|length > 0 - or activity.users|length > 0 - %} -
    -
    - {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %} -
    + {% if activity.comment.comment is not empty + or activity.persons|length > 0 + or activity.thirdParties|length > 0 + or activity.users|length > 0 + %} +
    +
    + {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %} +
    - {% if activity.comment.comment is not empty %} -
    - {{ activity.comment|chill_entity_render_box({ - 'disable_markdown': false, - 'limit_lines': 3, - 'metadata': false, - }) }} -
    - {% endif %} -
    - {% endif %} + {% if activity.comment.comment is not empty %} +
    + {{ activity.comment|chill_entity_render_box({ + 'disable_markdown': false, + 'limit_lines': 3, + 'metadata': false, + }) }} +
    + {% endif %} +
    + {% endif %} +
    + {% endfor %}
    - {% endfor %} -
    -{% endif %} + {% endif %} -{% if context != 'person' %} -{# TODO set this condition in configuration #} - -{% endif %} +
    diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listAccompanyingCourse.html.twig index 53e7ec86e..a988debfd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listAccompanyingCourse.html.twig @@ -5,5 +5,27 @@ {% block title %}{{ 'Activity list' |trans }}{% endblock title %} {% block content %} + + {% set person_id = null %} + {% if person %} + {% set person_id = person.id %} + {% endif %} + + {% set accompanying_course_id = null %} + {% if accompanyingCourse %} + {% set accompanying_course_id = accompanyingCourse.id %} + {% endif %} + +

    {{ 'Activity list' |trans }}

    + {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %} + + + {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig index 649821dc7..5a9f0125f 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig @@ -21,5 +21,27 @@ {% block title %}{{ 'Activity list' |trans }}{% endblock title %} {% block personcontent %} + + {% set person_id = null %} + {% if person %} + {% set person_id = person.id %} + {% endif %} + + {% set accompanying_course_id = null %} + {% if accompanyingCourse %} + {% set accompanying_course_id = accompanyingCourse.id %} + {% endif %} + +

    {{ 'Activity list' |trans }}

    + {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %} + + + {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/selectType.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/selectType.html.twig index 484deb55a..996d95b0f 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/selectType.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/selectType.html.twig @@ -1,28 +1,30 @@ -

    {{ "Activity creation"|trans }}

    +
    +

    {{ "Activity creation"|trans }}

    -{# TODO: refaire l'html css des tuilles #} + {# TODO: refaire l'html css des tuilles #} -{% for row in data %} -

    {{ row.activityTypeCategory.name|localize_translatable_string }}

    -
    - {% for activityType in row.activityTypes %} + {% for row in data %} +

    {{ row.activityTypeCategory.name|localize_translatable_string }}

    +
    + {% for activityType in row.activityTypes %} - {% set person_id = null %} - {% if person %} - {% set person_id = person.id %} - {% endif %} + {% set person_id = null %} + {% if person %} + {% set person_id = person.id %} + {% endif %} - {% set accompanying_course_id = null %} - {% if accompanyingCourse %} - {% set accompanying_course_id = accompanyingCourse.id %} - {% endif %} + {% set accompanying_course_id = null %} + {% if accompanyingCourse %} + {% set accompanying_course_id = accompanyingCourse.id %} + {% endif %} - + -
    - {{ activityType.name|localize_translatable_string }} -
    -
    - {% endfor %} -
    -{% endfor %} +
    + {{ activityType.name|localize_translatable_string }} +
    + + {% endfor %} +
    + {% endfor %} +
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index d488c2684..ea2fcd710 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -29,6 +29,8 @@
    {% endif %} +

    {{ 'Resume Accompanying Course'|trans }}

    +

    {{ 'Associated peoples'|trans }}

    @@ -119,8 +121,21 @@
    {% block contentActivity %} -
    +
    {% set person = null %} + + {% set person_id = null %} + {% if person %} + {% set person_id = person.id %} + {% endif %} + + {% set accompanying_course_id = null %} + {% if accompanyingCourse %} + {% set accompanying_course_id = accompanyingCourse.id %} + {% endif %} + +

    {{ 'Activity list' |trans }}

    + {% include 'ChillActivityBundle:Activity:list.html.twig' with { 'context': 'accompanyingCourse' } %}
    {% endblock %}