mirror of https://github.com/docker/docs.git
Enable hide/show of elements that don't apply to archives (#4798)
This commit is contained in:
parent
322593c050
commit
c6391e5998
|
@ -1,4 +1,4 @@
|
||||||
<div class="btn-group">
|
<div class="btn-group" style="visibility: hidden">
|
||||||
<button type="button" class="btn btn-default dropdown-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button type="button" class="btn btn-default dropdown-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
{% for item in site.data.docsarchive.archives %}{% if item.current == true %}Docker {{ item.name }} (current) {% endif %} {% endfor %}<span class="caret"></span>
|
{% for item in site.data.docsarchive.archives %}{% if item.current == true %}Docker {{ item.name }} (current) {% endif %} {% endfor %}<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="search-form" id="search-div">
|
<div class="search-form" id="search-div" style="visibility: hidden">
|
||||||
<form class="search-form form-inline ng-pristine ng-valid" id="searchForm" action="/search/">
|
<form class="search-form form-inline ng-pristine ng-valid" id="searchForm" action="/search/">
|
||||||
<input class="search-field form-control ds-input" id="st-search-input" value="" name="q" placeholder="Search the docs" type="search" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top;">
|
<input class="search-field form-control ds-input" id="st-search-input" value="" name="q" placeholder="Search the docs" type="search" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top;">
|
||||||
<div id="autocompleteContainer">
|
<div id="autocompleteContainer">
|
||||||
|
|
|
@ -121,7 +121,7 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor %
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{% if page.noratings != true %}
|
{% if page.noratings != true %}
|
||||||
<div style="color:#b9c2cc; text-align: center; margin-top: 150px">
|
<div id="ratings-div" style="color:#b9c2cc; text-align: center; margin-top: 150px; visibility: hidden">
|
||||||
<div id="pd_rating_holder_8453675"></div>
|
<div id="pd_rating_holder_8453675"></div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
PDRTJS_settings_8453675 = {
|
PDRTJS_settings_8453675 = {
|
||||||
|
@ -156,7 +156,7 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor %
|
||||||
<div class="feedback-links">
|
<div class="feedback-links">
|
||||||
<ul>
|
<ul>
|
||||||
{% if edit_url != "" %}
|
{% if edit_url != "" %}
|
||||||
<li><a href="{{ edit_url }}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit this page</a></li>{% endif %}
|
<li style="visibility: hidden"><a href="{{ edit_url }}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit this page</a></li>{% endif %}
|
||||||
<li><a href="https://github.com/docker/docker.github.io/issues/new?assignee={% if page.assignee %}{{ page.assignee }}{% else %}{{ page.defaultassignee }}{% endif %}&body=File: [{{ page.path }}](https://docs.docker.com{{ page.url }}), CC @{{ assignee }}"
|
<li><a href="https://github.com/docker/docker.github.io/issues/new?assignee={% if page.assignee %}{{ page.assignee }}{% else %}{{ page.defaultassignee }}{% endif %}&body=File: [{{ page.path }}](https://docs.docker.com{{ page.url }}), CC @{{ assignee }}"
|
||||||
class="nomunge"><i class="fa fa-check" aria-hidden="true"></i> Request docs changes</a></li>
|
class="nomunge"><i class="fa fa-check" aria-hidden="true"></i> Request docs changes</a></li>
|
||||||
<li><a href="https://www.docker.com/docker-support-services"><i class="fa fa-question" aria-hidden="true"></i> Get support</a></li>
|
<li><a href="https://www.docker.com/docker-support-services"><i class="fa fa-question" aria-hidden="true"></i> Get support</a></li>
|
||||||
|
@ -216,6 +216,12 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor %
|
||||||
<script src="/js/jquery.js"></script>
|
<script src="/js/jquery.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
<!-- Always include the archive.js, but it doesn't do much unless we are an archive -->
|
<!-- Always include the archive.js, but it doesn't do much unless we are an archive -->
|
||||||
|
<script language="javascript">
|
||||||
|
// Default to assuming this is an archive and hiding some stuff
|
||||||
|
// See js/archive.js and js/docs.js for logic relating to this
|
||||||
|
var isArchive = true;
|
||||||
|
var dockerVersion = 'v{{ site.engine_version }}';
|
||||||
|
</script>
|
||||||
<script src="/js/archive.js"></script>
|
<script src="/js/archive.js"></script>
|
||||||
<script src="/js/stickyfill.min.js"></script>
|
<script src="/js/stickyfill.min.js"></script>
|
||||||
<script defer src="/js/docs.js"></script>
|
<script defer src="/js/docs.js"></script>
|
||||||
|
|
|
@ -4,7 +4,6 @@ layout: null
|
||||||
|
|
||||||
/* Only run this if we are online*/
|
/* Only run this if we are online*/
|
||||||
if (window.navigator.onLine) {
|
if (window.navigator.onLine) {
|
||||||
var dockerVersion = 'v{{ site.engine_version }}';
|
|
||||||
var suppressButterBar = false;
|
var suppressButterBar = false;
|
||||||
/* This JSON file contains a current list of all docs versions of Docker */
|
/* This JSON file contains a current list of all docs versions of Docker */
|
||||||
$.getJSON("/js/archives.json", function(result){
|
$.getJSON("/js/archives.json", function(result){
|
||||||
|
@ -33,10 +32,16 @@ if (window.navigator.onLine) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// only append the butterbar if we are NOT the current version
|
// only append the butterbar if we are NOT the current version
|
||||||
|
// Also set the isArchive variable to true if it's an archive. It defaults
|
||||||
|
// to true, set in _layouts/docs.html. We default to true because it looks
|
||||||
|
// better in CSS to show stuff than to hide stuff onLoad.
|
||||||
if ( suppressButterBar == false ) {
|
if ( suppressButterBar == false ) {
|
||||||
$( 'body' ).prepend(outerDivStart + buttonCode + listStart + listItems.join("") + listEnd + outerDivEnd);
|
$( 'body' ).prepend(outerDivStart + buttonCode + listStart + listItems.join("") + listEnd + outerDivEnd);
|
||||||
|
isArchive = true;
|
||||||
|
console.log("Detected that this is an archive.");
|
||||||
} else {
|
} else {
|
||||||
console.log("Suppressing the archive versions bar");
|
isArchive = false;
|
||||||
|
console.log("This is not an archive. Suppressing the archive versions bar");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
20
js/docs.js
20
js/docs.js
|
@ -292,6 +292,26 @@ window.onload = function() {
|
||||||
var group = $(this).attr('data-group');
|
var group = $(this).attr('data-group');
|
||||||
$('.nav-tabs > li > a[data-group="'+ group +'"]').tab('show');
|
$('.nav-tabs > li > a[data-group="'+ group +'"]').tab('show');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// isArchive is set by logic in archive.js
|
||||||
|
if ( isArchive == false ) {
|
||||||
|
console.log("Showing content that should only be in the current version.");
|
||||||
|
// Hide elements that are not appropriate for archives
|
||||||
|
// PollDaddy
|
||||||
|
$('#ratings-div').css("visibility","visible");
|
||||||
|
console.log("Ratings widget shown.");
|
||||||
|
// Archive drop-down
|
||||||
|
$('.ctrl-right .btn-group').css("visibility","visible");
|
||||||
|
console.log("Archive widget shown.");
|
||||||
|
// Swarch
|
||||||
|
$('.search-form').css("visibility","visible");
|
||||||
|
console.log("Search widget shown.");
|
||||||
|
// Page edit link
|
||||||
|
$('.feedback-links li').first().css("visibility","visible");
|
||||||
|
console.log("Page edit link shown.");
|
||||||
|
} else {
|
||||||
|
console.log("Keeping non-applicable elements hidden.");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$('.glossLink').popover();
|
$('.glossLink').popover();
|
||||||
|
|
Loading…
Reference in New Issue