From 6c095a14a604396107e2a53e3866367022b1a75a Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 6 May 2017 18:41:04 +0200 Subject: [PATCH] grab latest release stuff from GitHub API too --- _config.yml | 3 --- _src/_assets/javascripts/bigchain/github.js | 23 +++++++++++++++------ _src/_includes/hero.html | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/_config.yml b/_config.yml index 1d1d489..6ebcbee 100644 --- a/_config.yml +++ b/_config.yml @@ -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 # -------------------- diff --git a/_src/_assets/javascripts/bigchain/github.js b/_src/_assets/javascripts/bigchain/github.js index deb5652..4d5991a 100644 --- a/_src/_assets/javascripts/bigchain/github.js +++ b/_src/_assets/javascripts/bigchain/github.js @@ -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); }()); diff --git a/_src/_includes/hero.html b/_src/_includes/hero.html index 3f4d43b..67ccbc6 100644 --- a/_src/_includes/hero.html +++ b/_src/_includes/hero.html @@ -11,7 +11,7 @@