Skip to content

Commit

Permalink
ui: scoreboard: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined-moe committed Dec 3, 2023
1 parent 7f31826 commit 66f5dc6
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/ui-default/templates/partials/scoreboard.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% import "components/user.html" as user with context %}
{% macro renderRecord(cell, canView) %}
<a href="{{ url('record_detail', rid=cell.raw) if canView else '' }}"{% if cell.hover %} data-tooltip="{{ cell.hover }}"{% endif %}>
{%- set _color = utils.status.getScoreColor(cell.score|default(cell.value)) -%}
<span style="font-weight:bold;color:{{ _color }}">{{ cell.value|string|nl2br|safe }}</span>
</a>
{% if canView %}<a href="{{ url('record_detail', rid=cell.raw) }}">{% endif %}
{%- set _color = utils.status.getScoreColor(cell.score|default(cell.value)) -%}
<span {% if cell.hover %} data-tooltip="{{ cell.hover }}"{% endif %} style="font-weight:bold;color:{{ _color }}">{{ cell.value|string|nl2br|safe }}</span>
{% if canView %}</a>{% endif %}
{% endmacro %}

<div data-fragment-id="scoreboard">
Expand Down Expand Up @@ -56,17 +56,12 @@
</button>
{{ user.render_inline(udict[column.raw], badge=false) }}
{%- elif column.type == 'record' and column.raw -%}
<a href="{{ url('record_detail', rid=column.raw) if canView else '' }}" data-tooltip="{{ column.hover }}">
<span style="font-weight:bold;color:{{ utils.status.getScoreColor(column.score|default(column.value)) }}">{{ column.value|string|nl2br|safe }}</span>
</a>
{{ renderRecord(column, canView) }}
{%- elif column.type == 'records' -%}
{%- for record in column.raw -%}
{%- if loop.index0 -%}/{%- endif -%}
{%- if record.raw -%}
<a href="{{ url('record_detail', rid=record.raw) if canView else '' }}">
{%- set _color = utils.status.getScoreColor(record.score|default(record.value)) -%}
<span style="font-weight:bold;color:{{ _color }}">{{ record.value|string|nl2br|safe }}</span>
</a>
{{ renderRecord(record, canView) }}
{%- else -%}
{{ record.value|string|nl2br|safe }}
{%- endif -%}
Expand Down

0 comments on commit 66f5dc6

Please sign in to comment.