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-col {
&:first-child {
flex-basis: 27%;
flex-basis: 15%;
}
ul.list-content {
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">
{% if activity.user and t.userVisible %}
<li>
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
<b>{{ activity.user.usernameCanonical }}</b>
</li>
{% endif %}
@ -98,7 +99,7 @@
<li class="social-actions">
{%- if activity.socialActions is not empty -%}
{% for r in activity.socialActions %}
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
{{ r|chill_entity_render_box }}
{% endfor %}
{%- endif -%}
</li>
@ -133,6 +134,7 @@
</div>
</div>
{#
{% if activity.comment.comment is not empty
or activity.persons|length > 0
or activity.thirdParties|length > 0
@ -140,7 +142,11 @@
%}
<div class="item-row details">
<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>
{% if activity.comment.comment is not empty %}
@ -154,6 +160,7 @@
{% endif %}
</div>
{% endif %}
#}
</div>
{% endfor %}

View File

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

View File

@ -79,4 +79,4 @@ Created by: Creér par
#Aside activity delete
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%" ?
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
// define visual badge for all social issues
///
$social-issue-color: $chill-pink;
@mixin badge_social_issue {
text-transform: capitalize !important;
font-weight: 500 !important;
@ -16,3 +17,20 @@ $social-issue-color: $chill-pink;
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 {
@ -18,6 +16,15 @@
@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 %}
<span class="chill-entity chill-entity__social-action">
<span class="{% if not options['no-badge'] %}badge bg-primary{% endif %}">
<span class="chill-entity entity-social-action">
<span class="{% if not options['no-badge'] %}badge bg-light text-dark{% endif %}">
{%- 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'] }}
</span>
{%- endfor -%}
<span class="chill-entity__social-action__child">
<span class="child">
{{ socialAction.title|localize_translatable_string }}
</span>
</span>