1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 09:46:57 +01:00

grab latest release stuff from GitHub API too

This commit is contained in:
Matthias Kretschmann 2017-05-06 18:41:04 +02:00
parent 20d4ff375b
commit 6c095a14a6
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
3 changed files with 18 additions and 10 deletions

View File

@ -30,9 +30,6 @@ address:
city: Berlin
country: Germany
release:
version: "0.10"
post: https://blog.bigchaindb.com/bigchaindb-version-0-10-released-9684fdb2a8ff
# Track all the things
# --------------------

View File

@ -1,21 +1,32 @@
(function() {
var s = document.createElement('script'),
githubApiUrl = 'https://api.github.com/repos/',
owner = 'bigchaindb',
repo = 'bigchaindb';
const s = document.createElement('script'),
t = document.createElement('script'),
githubApiUrl = 'https://api.github.com/repos/',
owner = 'bigchaindb',
repo = 'bigchaindb';
s.type = 'text/javascript';
s.async = true;
s.src = githubApiUrl + owner + '/' + repo + '?callback=' + owner + '.getGitHubRepoInfo';
t.async = true;
t.src = githubApiUrl + owner + '/' + repo + '/releases/latest?callback=' + owner + '.getGitHubReleaseInfo';
window[owner] = window[owner] || {};
window[owner].getGitHubRepoInfo = function(response) {
window[owner].getGitHubRepoInfo = (response) => {
var stargazers = response.data.stargazers_count;
document.getElementById('stargazers').innerText = stargazers;
};
window[owner].getGitHubReleaseInfo = (response) => {
var version = response.data.tag_name;
document.getElementById('version').innerText = version;
};
document.getElementsByTagName('HEAD')[0].appendChild(s);
document.getElementsByTagName('HEAD')[0].appendChild(t);
}());

View File

@ -11,7 +11,7 @@
<aside class="hero__community">
<div class="row">
<a class="btn btn-text btn-sm" href="{{ site.release.post }}" rel="external">Latest release: {{ site.release.version }}</a>
<a class="btn btn-text btn-sm" href="https://github.com/{{ site.github.org }}/{{ site.github.repo }}/releases/latest" rel="external">Latest release: <span id="version"></span></a>
<a class="social-link btn btn-text btn-sm js-social-link" href="https://github.com/{{ site.github.org }}/{{ site.github.repo }}" title="Star {{ site.github.org }}/{{ site.github.repo }} on GitHub">
<svg class="icon icon--social icon--github" aria-labelledby="title">