Commit d3c5708e authored by Carl Schwan's avatar Carl Schwan

Merge branch 'linkToWindowsStore' into 'master'

Add link to windows store

If application is available in the windows store and the visitor
is using Windows.

See merge request !12

Phabricator task: T11808
parents a438e5bf 928cfd71
......@@ -262,9 +262,12 @@ $site_root = "../";
<a href="/applications/<?= $category ?>"><?= $category ?></a>
</div>
<?php if ($category != 'unmaintained') { ?>
<a class="noblefir ml-auto align-self-center" href="appstream://<?= $app->AppStreamId() ?>">
<a class="noblefir ml-auto align-self-center"
id="install-button"
href="appstream://<?= $app->AppStreamId() ?>"
data-windows="<?= $app->getWindowsStoreLink() ?>">
<i class="fa fa-download"></i>
Install
<span id="install-msg">Install on Linux</span>
</a>
<?php } ?>
</div>
......@@ -295,5 +298,12 @@ $site_root = "../";
</div>
</div>
</main>
<script>
let install_button = document.getElementById('install-button');
if (window.navigator.platform.indexOf('Win') > -1 && 'windows' in install_button.dataset) {
install_button.href = install_button.dataset.windows;
document.getElementById('install-msg').innerText = 'Install on Windows';
}
</script>
<?php
require(KDE_ORG . '/aether/footer.php');
......@@ -338,6 +338,14 @@ class AppData
return false;
}
function getWindowsStoreLink(): ?string
{
if (isset($this->data['Custom']) && isset($this->data['Custom']['KDE::windows_store'])) {
return $this->data['Custom']['KDE::windows_store'];
}
return null;
}
// TODO: ebn is broken for now
function hasEbn() {
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment