Skip to content

Commit 220a690

Browse files
tresfheadquarter8302
authored andcommitted
Cleanup meta-data
1 parent d5b8146 commit 220a690

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

lib/Asset.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@
33

44
class Asset
55
{
6+
private string $metaData = '';
67
public function __construct(
78
private Platform $platform,
89
private string $platformName,
910
private string $releaseName,
1011
private string $downloadUrl,
1112
private ?string $description,
1213
private string $gitRef,
13-
private string $date
14-
)
15-
{ }
14+
private string $date,
15+
) {
16+
$_metaData = array();
17+
$_metaData['data-arch'] = $this->platform->architecture->name;
18+
$_metaData['data-os'] = $this->platform->os->name;
19+
$_metaData['data-qualifier'] = $this->platform->qualifier->name;
20+
$_metaData['data-osver'] = $this->platform->osVersion;
21+
22+
foreach ($_metaData as $attr => $value) {
23+
$_value = strtolower($value);
24+
$this->metaData .= " $attr=\"$_value\"";
25+
}
26+
}
1627

1728
public function getPlatform(): Platform
1829
{
@@ -48,4 +59,9 @@ public function getDate(): string
4859
{
4960
return $this->date;
5061
}
62+
63+
public function getMetaData(): string
64+
{
65+
return $this->metaData;
66+
}
5167
}

templates/download/index.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
{# Macro for printing oversized download buttons #}
66
{% macro printrelbutton(rel, btnclass = 'btn-dl-stable') %}
77
{% if rel != null %}
8-
{# Keep these on a single line for easier shell parsing #}
9-
<a class="btn btn-lg btn-dl {{ btnclass }}" href="{{ rel.downloadUrl }}" data-arch="{{ rel.platform.architecture.value }}" data-os="{{ rel.platform.os.value }}" data-qualifier="{{ rel.platform.qualifier.value }}" data-osver="{{ rel.platform.osVersion }}">
8+
<a class="btn btn-lg btn-dl {{ btnclass }}" href="{{ rel.downloadUrl }}" {{ rel.metaData|raw }}>
109
<span class="fas fa-cloud-download-alt fa-3x download-icon"></span>
1110
<span class="big">{{ rel.platformName }}</span><br>
1211
<span class="small">LMMS&nbsp;{{ rel.releaseName }}</span>

0 commit comments

Comments
 (0)