activity list: badges for issues, actions and reasons

This commit is contained in:
Mathieu Jaumotte 2021-08-20 23:59:37 +02:00
parent 14cbb1dd28
commit b37de4cd4f
7 changed files with 65 additions and 21 deletions

View File

@ -28,7 +28,7 @@ div.activity-list {
div.item-row.main { div.item-row.main {
div.item-col { div.item-col {
&:first-child { &:first-child {
flex-basis: 27%; flex-basis: 15%;
} }
ul.list-content { ul.list-content {
li.social-issues, li.social-actions { li.social-issues, li.social-actions {
@ -127,3 +127,13 @@ div.flex-bloc.concerned-groups {
} }
} }
/// CHILL ENTITY RENDER BOX
.chill-entity {
/// ACTIVITY-REASON
&.entity-activity-reason {
margin-right: 0.3em;
font-size: 120%;
}
}

View File

@ -50,7 +50,8 @@
<ul class="list-content"> <ul class="list-content">
{% if activity.user and t.userVisible %} {% if activity.user and t.userVisible %}
<li> <li>
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b> <abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
<b>{{ activity.user.usernameCanonical }}</b>
</li> </li>
{% endif %} {% endif %}
@ -98,7 +99,7 @@
<li class="social-actions"> <li class="social-actions">
{%- if activity.socialActions is not empty -%} {%- if activity.socialActions is not empty -%}
{% for r in activity.socialActions %} {% for r in activity.socialActions %}
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span> {{ r|chill_entity_render_box }}
{% endfor %} {% endfor %}
{%- endif -%} {%- endif -%}
</li> </li>
@ -133,6 +134,7 @@
</div> </div>
</div> </div>
{#
{% if activity.comment.comment is not empty {% if activity.comment.comment is not empty
or activity.persons|length > 0 or activity.persons|length > 0
or activity.thirdParties|length > 0 or activity.thirdParties|length > 0
@ -140,7 +142,11 @@
%} %}
<div class="item-row details"> <div class="item-row details">
<div class="item-col"> <div class="item-col">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %} {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': context,
'with_display': 'row',
'entity': activity
} %}
</div> </div>
{% if activity.comment.comment is not empty %} {% if activity.comment.comment is not empty %}
@ -154,6 +160,7 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
#}
</div> </div>
{% endfor %} {% endfor %}

View File

@ -35,35 +35,37 @@ class ActivityReasonRender extends AbstractChillEntityRender
* @var TranslatableStringHelper * @var TranslatableStringHelper
*/ */
protected $translatableStringHelper; protected $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper) public function __construct(TranslatableStringHelper $translatableStringHelper)
{ {
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;
} }
public function renderBox($entity, array $options): string public function renderBox($entity, array $options): string
{ {
return return
$this->getDefaultOpeningBox('activity-reason'). $this->getDefaultOpeningBox('activity-reason').
'<span class="badge bg-chill-pink">'.
'<i class="fa fa-question-circle"></i>&nbsp;'. '<i class="fa fa-question-circle"></i>&nbsp;'.
'<span class="activity-reason__category">'. '<span class="category">'.
$this->translatableStringHelper->localize( $this->translatableStringHelper->localize(
$entity->getCategory()->getName() $entity->getCategory()->getName()
). ).
'</span>'. '</span>'.
'<span class="activity-reason__separator">&nbsp;>&nbsp;</span>'. '<span class="separator">&nbsp;>&nbsp;</span>'.
'<span class="activity-reason__reason">'. '<span class="reason">'.
$this->translatableStringHelper->localize( $this->translatableStringHelper->localize(
$entity->getName() $entity->getName()
). ).
'</span>'. '</span>'.
'</span>'.
$this->getDefaultClosingBox() $this->getDefaultClosingBox()
; ;
} }
/** /**
* *
* @param ActivityReason $entity * @param ActivityReason $entity
* @param array $options * @param array $options
* @return string * @return string
@ -71,12 +73,12 @@ class ActivityReasonRender extends AbstractChillEntityRender
public function renderString($entity, array $options): string public function renderString($entity, array $options): string
{ {
$category = ''; $category = '';
if (null !== $entity->getCategory()) { if (null !== $entity->getCategory()) {
$category = $this->translatableStringHelper->localize( $category = $this->translatableStringHelper->localize(
$entity->getCategory()->getName()). ' > '; $entity->getCategory()->getName()). ' > ';
} }
return $category . return $category .
$this->translatableStringHelper->localize( $this->translatableStringHelper->localize(
$entity->getName() $entity->getName()

View File

@ -79,4 +79,4 @@ Created by: Creér par
#Aside activity delete #Aside activity delete
Delete aside activity: Supprimer une activité annexe Delete aside activity: Supprimer une activité annexe
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ? Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
The activity has been successfully removed.: L'activité a été supprimée. The activity has been successfully removed.: L'activité a été supprimée.

View File

@ -1,10 +1,11 @@
$social-issue-color: #4bafe8;
$social-action-color: $pink;
/// ///
/// Social Issue mixin /// Social Issue mixin
// define visual badge for all social issues // define visual badge for all social issues
/// ///
$social-issue-color: $chill-pink;
@mixin badge_social_issue { @mixin badge_social_issue {
text-transform: capitalize !important; text-transform: capitalize !important;
font-weight: 500 !important; font-weight: 500 !important;
@ -16,3 +17,20 @@ $social-issue-color: $chill-pink;
margin: 0 0.3em 0 -0.7em; margin: 0 0.3em 0 -0.7em;
} }
} }
///
/// Social Action mixin
// define visual badge for all social actions
///
@mixin badge_social_action {
text-transform: capitalize !important;
font-weight: 500 !important;
border-left: 20px groove $social-action-color;
&:before {
content: '\f04b';
font-family: ForkAwesome;
color: $social-action-color;
margin: 0 0.3em 0 -0.7em;
}
}

View File

@ -1,5 +1,3 @@
/// variables
/// CHILL ENTITY RENDER BOX /// CHILL ENTITY RENDER BOX
.chill-entity { .chill-entity {
@ -18,6 +16,15 @@
@include badge_social_issue; @include badge_social_issue;
} }
} }
/// SOCIAL-ACTION
&.entity-social-action {
margin-right: 0.3em;
font-size: 120%;
span.badge {
@include badge_social_action;
}
}
} }

View File

@ -1,12 +1,12 @@
{% set reversed_parents = parents|reverse %} {% set reversed_parents = parents|reverse %}
<span class="chill-entity chill-entity__social-action"> <span class="chill-entity entity-social-action">
<span class="{% if not options['no-badge'] %}badge bg-primary{% endif %}"> <span class="{% if not options['no-badge'] %}badge bg-light text-dark{% endif %}">
{%- for p in reversed_parents %} {%- for p in reversed_parents %}
<span class="chill-entity__social-action__parent--{{ loop.revindex0 }}"> <span class="parent-{{ loop.revindex0 }}">
{{ p.title|localize_translatable_string }}{{ options['default.separator'] }} {{ p.title|localize_translatable_string }}{{ options['default.separator'] }}
</span> </span>
{%- endfor -%} {%- endfor -%}
<span class="chill-entity__social-action__child"> <span class="child">
{{ socialAction.title|localize_translatable_string }} {{ socialAction.title|localize_translatable_string }}
</span> </span>
</span> </span>