Hide the beta version button on the website if there is only a stable version

This commit is contained in:
Tim van der Meij 2018-10-27 20:57:01 +02:00
parent 31bff2d950
commit 2b5bc6bcec
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
2 changed files with 11 additions and 2 deletions

View File

@ -43,9 +43,9 @@ Before downloading PDF.js please take a moment to understand the different layer
<p>
Includes the generic build of PDF.js and the viewer.
</p>
<span class="btn-group-vertical centered">
<span class="GROUP_CLASS">
<a type="button" class="btn btn-primary" href="https://github.com/mozilla/pdf.js/releases/download/vSTABLE_VERSION/pdfjs-STABLE_VERSION-dist.zip">Stable (vSTABLE_VERSION)</a>
<a type="button" class="btn btn-warning" href="https://github.com/mozilla/pdf.js/releases/download/vBETA_VERSION/pdfjs-BETA_VERSION-dist.zip">Beta (vBETA_VERSION)</a>
<a type="button" class="btn btn-warning HIDDEN_CLASS" href="https://github.com/mozilla/pdf.js/releases/download/vBETA_VERSION/pdfjs-BETA_VERSION-dist.zip">Beta (vBETA_VERSION)</a>
</span>
</div>
<div class="col-md-6">

View File

@ -1169,6 +1169,15 @@ gulp.task('wintersmith', ['gh-pages-prepare'], function (done) {
/STABLE_VERSION/g, config.stableVersion);
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
/BETA_VERSION/g, config.betaVersion);
// Hide the beta version button if there is only a stable version.
const groupClass = config.betaVersion ? 'btn-group-vertical centered' : '';
const hiddenClass = config.betaVersion ? '' : 'hidden';
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
/GROUP_CLASS/g, groupClass);
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
/HIDDEN_CLASS/g, hiddenClass);
console.log('Done building with wintersmith.');
done();
});