warning banner when using latest version (#1454)

fixes PIE-1474 add warning banner when using latest version

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Nicolas MASSART 6 years ago committed by GitHub
parent e536e1b8fb
commit f8f81e57f9
  1. 11
      docs/custom_theme/assets/javascripts/pantheon_custom.js
  2. 10
      docs/custom_theme/assets/stylesheets/pantheon_custom.css
  3. 8
      docs/custom_theme/main.html
  4. 5
      mkdocs.yml

@ -0,0 +1,11 @@
$( document ).ready(function() {
displayLatestWarning();
});
$(window).on('hashchange', function(){
displayLatestWarning();
});
function displayLatestWarning(){
$( ".latest-warning" ).css( "display", $(location).attr('href').includes(latestWarningTrigger)?"inherit":"none" );
}

@ -29,3 +29,13 @@
font-weight: 900;
font-size: small;
}
.latest-warning {
display: none;
padding: 1em;
background-color: orange;
color: black;
font-size: 1.5em;
text-align: center;
width: inherit;
}

@ -8,7 +8,7 @@
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="{{ 'assets/javascripts/pantheon_custom.js' | url }}"></script>
{% if config.extra.google.site_verification %}
<!-- Google site verification for search console -->
<meta name="google-site-verification" content="{{config.extra.google.site_verification}}" />
@ -28,3 +28,9 @@
{% block analytics %}
<!--Empty the footer analytics bloc as we need it the headers -->
{% endblock %}
{% block hero %}
{# hero is not used, so use it for warning banner #}
<script>const latestWarningTrigger = "{{config.extra.latest_version_warning.url_contains}}";</script>
<div class="latest-warning">{{config.extra.latest_version_warning.text}}</div>
{% endblock %}

@ -22,6 +22,11 @@ extra:
versions:
pantheon_stable: &pantheon_stable_version 1.1.0
quickstart: *pantheon_stable_version
latest_version_warning:
url_contains: /latest/
text: 'You are reading Pantheon development version documentation and
some displayed features may not be available in the stable release.
You can switch to stable version using the version box at screen bottom.'
support:
gitter: https://gitter.im/PegaSysEng/pantheon
email: support@pegasys.tech

Loading…
Cancel
Save