Skip to content

Commit

Permalink
fix: Display attribute code in list with usage count
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed May 31, 2024
1 parent f491bac commit 4f88a0a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
5 changes: 5 additions & 0 deletions lib/RoadizCoreBundle/src/Model/AttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,9 @@ public function getTypeLabel(): string
default => 'attributes.form.type.string',
};
}

public function getAttributeValues(): Collection
{
return $this->attributeValues;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@
<target state="translated">Attribute %attributeValueId% value does not exist</target>
<note/>
</trans-unit>
<trans-unit xml:space="preserve" id="attributes.usage">
<source>attributes.usage</source>
<target state="translated">Usage count</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@
<target state="translated">La valeur de l’attribut %attributeValueId% n’existe pas</target>
<note/>
</trans-unit>
<trans-unit xml:space="preserve" id="attributes.usage">
<source>attributes.usage</source>
<target state="translated">Nombre d'utilisations</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions lib/RoadizRozierBundle/translations/attributes/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@
<target></target>
<note></note>
</trans-unit>
<trans-unit xml:space="preserve" id="attributes.usage">
<source>attributes.usage</source>
<target></target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
19 changes: 16 additions & 3 deletions lib/Rozier/src/Resources/views/attributes/attribute_row.html.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
<td class="name">
<a href="{{ path('attributesEditPage', { id: item.id }) }}">
<span class="color" style="background-color:{{ item.color|default('transparent') }};"></span>
{{ item.attributeTranslations.first.label|default(item.code) -}}
{{ item.code -}}
</a>
</td>
<td>{{ item.attributeTranslations.first.label -}}</td>
<td>{{- item.typeLabel|trans -}}</td>
<td>{%- if item.group -%}
<td class="mobile-hidden">
{%- if item.attributeValues|length > 0 -%}
<span
data-uk-tooltip="{animation:true}"
title="{% trans %}attributes.usage{% endtrans %}"
class="uk-button-status">
{{- item.attributeValues|length -}}
</span>
{%- endif -%}
</td>
<td class="mobile-hidden">
{%- if item.group -%}
{{- item.group.name -}}
{%- endif -%}</td>
{%- endif -%}
</td>
<td class="table-actions-row">
{% apply spaceless %}
{% if hasBulkActions %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<th>
<th colspan="2">
{% trans %}attributes.code{% endtrans %}
{% if not no_sort %}
{% include '@RoadizRozier/includes/column_ordering.html.twig' with {
Expand All @@ -8,7 +8,8 @@
{% endif %}
</th>
<th>{% trans %}attributes.form.type{% endtrans %}</th>
<th>{% trans %}attributes.group{% endtrans %}</th>
<th class="mobile-hidden"></th>
<th class="mobile-hidden">{% trans %}attributes.group{% endtrans %}</th>
<th class="table-actions-row table-actions-row-3">
{% if hasBulkActions %}
<div class="bulk-selection">
Expand Down

0 comments on commit 4f88a0a

Please sign in to comment.