Skip to content

Add link & target props to big_number.handlebars #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 19, 2025
33 changes: 31 additions & 2 deletions sqlpage/templates/big_number.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@
>
<div class="card flex-fill {{#if color}}bg-{{color}}-lt{{/if}}">
<div class="card-body d-flex flex-column">

{{#if title}}
<div class="d-flex align-items-center">
<div class="subheader text-truncate me-2">{{title}}</div>
<!-- Otsikko (title): mahdollisuus linkkiin ja targetiin -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we translate the comments to english and use handlebars comments ?

<div class="subheader text-truncate me-2">
{{#if title_link}}
<a href="{{title_link}}"
class="text-decoration-none"
{{#if title_target}} target="{{title_target}}" rel="noopener noreferrer" {{/if}}>
{{title}}
</a>
{{else}}
{{title}}
{{/if}}
</div>

{{#if dropdown_item}}
<div class="ms-auto lh-1">
<div class="dropdown">
Expand All @@ -31,8 +44,21 @@
{{/if}}
</div>
{{/if~}}

<div class="d-flex align-items-center mt-1">
<div class="h1 {{#if description}}mb-3{{else}}mb-0{{/if}} mt-auto text-nowrap text-truncate">{{value}}{{#if unit}} {{unit}}{{/if}}</div>
<!-- Arvo (value): mahdollisuus linkkiin ja targetiin -->
<div class="h1 {{#if description}}mb-3{{else}}mb-0{{/if}} mt-auto text-nowrap text-truncate">
{{#if value_link}}
<a href="{{value_link}}"
class="text-decoration-none"
{{#if value_target}} target="{{value_target}}" rel="noopener noreferrer" {{/if}}>
{{value}}{{#if unit}} {{unit}}{{/if}}
</a>
{{else}}
{{value}}{{#if unit}} {{unit}}{{/if}}
{{/if}}
</div>

{{#if (and change_percent (not description))}}
<div class="ms-auto">
{{#if change_percent}}
Expand All @@ -48,6 +74,7 @@
</div>
{{/if}}
</div>

{{~#if description}}
<div class="d-flex flex-wrap mb-2" title="{{description}}">
<div class="text-truncate me-2">{{description}}</div>
Expand All @@ -65,13 +92,15 @@
{{~/if~}}
</div>
{{~/if~}}

{{~#if progress_percent~}}
<div class="progress progress-sm">
<div class="progress-bar bg-{{progress_color}}" style="width: {{progress_percent}}%" role="progressbar" aria-valuenow="{{progress_percent}}" aria-valuemin="0" aria-valuemax="100" aria-label="{{progress_percent}}% Complete">
<span class="visually-hidden">{{progress_percent}}% Complete</span>
</div>
</div>
{{~/if}}

</div>
</div>
</div>
Expand Down