light changes to download button

This commit is contained in:
Jeremy Kauffman 2018-05-03 12:45:24 -04:00
parent 9d8c933dcf
commit 8f4145910d
4 changed files with 54 additions and 48 deletions

View file

@ -111,24 +111,25 @@ class DownloadActions extends Actions
$os = static::guessOS();
if ($os && isset($osChoices[$os])) {
list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
$release = Github::getAppRelease();
$asset = Github::getAppAsset($os);
list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
$release = Github::getAppRelease();
$asset = Github::getAppAsset($os);
$vars = $vars + [
'analyticsLabel' => $analyticsLabel,
'buttonLabel' => $buttonLabel,
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
'os' => $os,
'osTitle' => $osTitle,
'osIcon' => $osIcon,
'releaseTimestamp' => $release ? strtotime($release['created_at']) : null,
'size' => $asset ? $asset['size'] / (1024 * 1024) : 0, //bytes -> MB
'version' => $release ? $release['name'] : null,
'isAuto' => Request::getParam('auto'),
];
$vars += [
'analyticsLabel' => $analyticsLabel,
'buttonLabel' => $buttonLabel,
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
'os' => $os,
'osTitle' => $osTitle,
'osIcon' => $osIcon,
'releaseTimestamp' => $release ? strtotime($release['created_at']) : null,
'size' => $asset ? $asset['size'] / (1024 * 1024) : 0, //bytes -> MB
'sourceLink' => false,
'version' => $release ? $release['name'] : null,
'isAuto' => Request::getParam('auto'),
];
}
}
return $vars;
}
}

View file

@ -49,7 +49,6 @@ download:
unavailable: LBRY is not yet out on this platform, but will be soon. Enter your email to be notified when it is released.
verb: Download
windows: Download for Windows
works: "Works with Ubuntu, Debian, or any distro with <code>apt</code> or <code>dpkg</code>."
email:
address: Email
code: Invite Code

View file

@ -1,32 +1,38 @@
<?php if ($downloadUrl): ?>
<a class="btn-<?php echo $buttonStyle?> btn-large"
download
href="<?php echo $downloadUrl ?>"
id="get-download-btn"
data-facebook-track="1"
data-analytics-category="Sign Up"
data-analytics-action="Download"
data-analytics-label="<?php echo $analyticsLabel ?>"
><?php echo $buttonLabel ?></a>
<?php if ($isAuto): ?>
<?php js_start() ?>
var anchor = document.getElementById('get-download-btn');
ga('send', 'event', anchor.getAttribute('data-analytics-category'), anchor.getAttribute('data-analytics-action'), anchor.getAttribute('data-analytics-label'));
setTimeout(function() { window.location = anchor.getAttribute('href'); }, 500);
<?php js_end() ?>
<?php endif ?>
<br/>
<span class="meta"> Latest Version :
<?php echo $version ?>, Download Size :
<?php echo number_format($size, 1) ?> MB,
built on <?php echo date('F d', $releaseTimestamp) ?>
at <?php echo date('H:i:s', $releaseTimestamp) ?> UTC
</span>
<div class="meta">
<div class="spacer-half">
<a class="btn-<?php echo $buttonStyle?> btn-large"
download
href="<?php echo $downloadUrl ?>"
id="get-download-btn"
data-facebook-track="1"
data-analytics-category="Sign Up"
data-analytics-action="Download"
data-analytics-label="<?php echo $analyticsLabel ?>"
><?php echo $buttonLabel ?></a>
<?php if ($isAuto): ?>
<?php js_start() ?>
var anchor = document.getElementById('get-download-btn');
ga('send', 'event', anchor.getAttribute('data-analytics-category'), anchor.getAttribute('data-analytics-action'), anchor.getAttribute('data-analytics-label'));
setTimeout(function() { window.location = anchor.getAttribute('href'); }, 500);
<?php js_end() ?>
<?php endif ?>
</div>
<div class="meta">
Version <?php echo $version ?>,
<?php echo number_format($size, 1) ?> MB,
built on <?php echo date('F d', $releaseTimestamp) ?>
at <?php echo date('g:i:s A', $releaseTimestamp) ?> UTC
</div>
<?php if ($os === OS::OS_LINUX): ?>
{{download.works}}
<div class="meta">
Works with Ubuntu, Debian, or any distro with <code>apt</code> or <code>dpkg</code>.
For other Linux flavors, <a href="https://github.com/lbryio/lbry-app" class="link-primary">see the source</a>.
</div>
<?php elseif ($sourceLink): ?>
<div class="meta">
Like source code? Go <a href="https://github.com/lbryio/lbry-app" class="link-primary">here</a>.<P><P>
</div>
<?php endif ?>
</div>
<?php else: ?>
<a href="/get" class="btn-primary btn-large spacer1">Download LBRY</a><BR>
<a href="/get" class="btn-<?php echo $buttonStyle ?> btn-large">Download LBRY</a><BR>
<?php endif ?>

View file

@ -14,10 +14,10 @@
</p>
<div class="text-center">
<p>
<?php echo View::Render('download/_downloadButton', ['buttonStyle'=>'alt',])?>
<div class="meta">
Like source code? Go <a href="https://github.com/lbryio/lbry-app" class="link-primary">here</a>.<P><P>
</div>
<?php echo View::Render('download/_downloadButton', [
'buttonStyle' => 'alt',
'sourceLink' => true
])?>
</p>
<div class="meta">
<img src="https://spee.ch/5a3e08d52dd2d7cb1c63a480b45dea8b4679cf01/lbryget-gif-mastertest.gif" />