mirror of https://github.com/docker/docs.git
Merge pull request #7151 from SvenDowideit/add-version-selection-ux
Add version selection ux to the Documentation.
This commit is contained in:
commit
2f23e204d9
2
Makefile
2
Makefile
|
@ -34,7 +34,7 @@ docs-shell: docs-build
|
||||||
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
|
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
|
||||||
|
|
||||||
docs-release: docs-build
|
docs-release: docs-build
|
||||||
$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./release.sh
|
$(DOCKER_RUN_DOCS) -e BUILD_ROOT "$(DOCKER_DOCS_IMAGE)" ./release.sh
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli
|
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli
|
||||||
|
|
|
@ -16,6 +16,9 @@ RUN pip install mkdocs
|
||||||
# this version works, the current versions fail in different ways
|
# this version works, the current versions fail in different ways
|
||||||
RUN pip install awscli==1.3.9
|
RUN pip install awscli==1.3.9
|
||||||
|
|
||||||
|
# make sure the git clone is not an old cache - we've published old versions a few times now
|
||||||
|
ENV CACHE_BUST Jul2014
|
||||||
|
|
||||||
# get my sitemap.xml branch of mkdocs and use that for now
|
# get my sitemap.xml branch of mkdocs and use that for now
|
||||||
RUN git clone https://github.com/SvenDowideit/mkdocs &&\
|
RUN git clone https://github.com/SvenDowideit/mkdocs &&\
|
||||||
cd mkdocs/ &&\
|
cd mkdocs/ &&\
|
||||||
|
@ -27,12 +30,17 @@ ADD MAINTAINERS /docs/sources/humans.txt
|
||||||
WORKDIR /docs
|
WORKDIR /docs
|
||||||
|
|
||||||
RUN VERSION=$(cat /docs/VERSION) &&\
|
RUN VERSION=$(cat /docs/VERSION) &&\
|
||||||
|
MAJOR_MINOR="${VERSION%.*}" &&\
|
||||||
|
for i in $(seq $MAJOR_MINOR -0.1 1.0) ; do echo "<li><a class='version' href='/v$i'>Version v$i</a></li>" ; done > /docs/sources/versions.html_fragment &&\
|
||||||
GIT_BRANCH=$(cat /docs/GIT_BRANCH) &&\
|
GIT_BRANCH=$(cat /docs/GIT_BRANCH) &&\
|
||||||
GITCOMMIT=$(cat /docs/GITCOMMIT) &&\
|
GITCOMMIT=$(cat /docs/GITCOMMIT) &&\
|
||||||
AWS_S3_BUCKET=$(cat /docs/AWS_S3_BUCKET) &&\
|
AWS_S3_BUCKET=$(cat /docs/AWS_S3_BUCKET) &&\
|
||||||
|
BUILD_DATE=$(date) &&\
|
||||||
sed -i "s/\$VERSION/$VERSION/g" /docs/theme/mkdocs/base.html &&\
|
sed -i "s/\$VERSION/$VERSION/g" /docs/theme/mkdocs/base.html &&\
|
||||||
|
sed -i "s/\$MAJOR_MINOR/v$MAJOR_MINOR/g" /docs/theme/mkdocs/base.html &&\
|
||||||
sed -i "s/\$GITCOMMIT/$GITCOMMIT/g" /docs/theme/mkdocs/base.html &&\
|
sed -i "s/\$GITCOMMIT/$GITCOMMIT/g" /docs/theme/mkdocs/base.html &&\
|
||||||
sed -i "s/\$GIT_BRANCH/$GIT_BRANCH/g" /docs/theme/mkdocs/base.html &&\
|
sed -i "s/\$GIT_BRANCH/$GIT_BRANCH/g" /docs/theme/mkdocs/base.html &&\
|
||||||
|
sed -i "s/\$BUILD_DATE/$BUILD_DATE/g" /docs/theme/mkdocs/base.html &&\
|
||||||
sed -i "s/\$AWS_S3_BUCKET/$AWS_S3_BUCKET/g" /docs/theme/mkdocs/base.html
|
sed -i "s/\$AWS_S3_BUCKET/$AWS_S3_BUCKET/g" /docs/theme/mkdocs/base.html
|
||||||
|
|
||||||
# note, EXPOSE is only last because of https://github.com/dotcloud/docker/issues/3525
|
# note, EXPOSE is only last because of https://github.com/dotcloud/docker/issues/3525
|
||||||
|
|
|
@ -27,6 +27,10 @@ if [ "$$AWS_S3_BUCKET" == "docs.docker.com" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove the last version - 1.0.2-dev -> 1.0
|
||||||
|
MAJOR_MINOR="v${VERSION%.*}"
|
||||||
|
export MAJOR_MINOR
|
||||||
|
|
||||||
export BUCKET=$AWS_S3_BUCKET
|
export BUCKET=$AWS_S3_BUCKET
|
||||||
|
|
||||||
export AWS_CONFIG_FILE=$(pwd)/awsconfig
|
export AWS_CONFIG_FILE=$(pwd)/awsconfig
|
||||||
|
@ -69,7 +73,8 @@ upload_current_documentation() {
|
||||||
|
|
||||||
# a really complicated way to send only the files we want
|
# a really complicated way to send only the files we want
|
||||||
# if there are too many in any one set, aws s3 sync seems to fall over with 2 files to go
|
# if there are too many in any one set, aws s3 sync seems to fall over with 2 files to go
|
||||||
endings=( json html xml css js gif png JPG ttf svg woff)
|
# versions.html_fragment
|
||||||
|
endings=( json html xml css js gif png JPG ttf svg woff html_fragment )
|
||||||
for i in ${endings[@]}; do
|
for i in ${endings[@]}; do
|
||||||
include=""
|
include=""
|
||||||
for j in ${endings[@]}; do
|
for j in ${endings[@]}; do
|
||||||
|
@ -101,13 +106,16 @@ upload_current_documentation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_s3
|
setup_s3
|
||||||
|
|
||||||
|
# Default to only building the version specific docs so we don't clober the latest by accident with old versions
|
||||||
|
if [ "$BUILD_ROOT" == "yes" ]; then
|
||||||
|
echo "Building root documentation"
|
||||||
build_current_documentation
|
build_current_documentation
|
||||||
upload_current_documentation
|
upload_current_documentation
|
||||||
|
fi
|
||||||
# Remove the last version - 1.0.2-dev -> 1.0
|
|
||||||
MAJOR_MINOR="v${VERSION%.*}"
|
|
||||||
|
|
||||||
#build again with /v1.0/ prefix
|
#build again with /v1.0/ prefix
|
||||||
sed -i "s/^site_url:.*/site_url: \/$MAJOR_MINOR\//" mkdocs.yml
|
sed -i "s/^site_url:.*/site_url: \/$MAJOR_MINOR\//" mkdocs.yml
|
||||||
|
echo "Building the /$MAJOR_MINOR/ documentation"
|
||||||
build_current_documentation
|
build_current_documentation
|
||||||
upload_current_documentation "/$MAJOR_MINOR/"
|
upload_current_documentation "/$MAJOR_MINOR/"
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||||
{% set docker_version = "$VERSION" %}{% set docker_commit = "$GITCOMMIT" %}{% set docker_branch = "$GIT_BRANCH" %}{% set aws_bucket = "$AWS_S3_BUCKET" %}
|
{% set docker_version = "$VERSION" %}{% set major_minor = "$MAJOR_MINOR" %}{% set docker_commit = "$GITCOMMIT" %}{% set docker_branch = "$GIT_BRANCH" %}{% set aws_bucket = "$AWS_S3_BUCKET" %}{% set build_date = "$BUILD_DATE" %}
|
||||||
<meta name="docker_version" content="{{ docker_version }}">
|
<meta name="docker_version" content="{{ docker_version }}">
|
||||||
<meta name="docker_git_branch" content="{{ docker_branch }}">
|
<meta name="docker_git_branch" content="{{ docker_branch }}">
|
||||||
<meta name="docker_git_commit" content="{{ docker_commit }}">
|
<meta name="docker_git_commit" content="{{ docker_commit }}">
|
||||||
|
<meta name="docker_build_date" content="{{ build_date }}">
|
||||||
|
|
||||||
{% if meta.page_description %}<meta name="description" content="{{ meta.page_description[0] }}">{% endif %}
|
{% if meta.page_description %}<meta name="description" content="{{ meta.page_description[0] }}">{% endif %}
|
||||||
{% if meta.page_keywords %}<meta name="keywords" content="{{ meta.page_keywords[0] }}">{% endif %}
|
{% if meta.page_keywords %}<meta name="keywords" content="{{ meta.page_keywords[0] }}">{% endif %}
|
||||||
|
@ -48,11 +49,23 @@
|
||||||
<div id="content" class="container">
|
<div id="content" class="container">
|
||||||
{% if current_page.title != '**HIDDEN**' %}
|
{% if current_page.title != '**HIDDEN**' %}
|
||||||
<div class="row" id="top-header">
|
<div class="row" id="top-header">
|
||||||
<div class="span8">
|
<div class="span7">
|
||||||
<h1 class="header2">{{ current_page.title }}</h1>
|
<h1 class="header2">{{ current_page.title }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="span4 text-right edit-on-github">
|
<div class="span5">
|
||||||
<a class="home-link3" href="https://github.com/dotcloud/docker/blob/master/docs/sources/{{ current_page.input_path }}" class="tertiary-nav">Edit on GitHub</a>
|
<div id="versionnav" class="span3 pull-right">
|
||||||
|
<ul class="nav version pull-right">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a id="logged-in-header-username" class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||||
|
Latest (Version {{ major_minor }})
|
||||||
|
</a>
|
||||||
|
<ul id="documentation-version-list" class="dropdown-menu pull-right">
|
||||||
|
<li role="presentation" class="divider"></li>
|
||||||
|
<li> <a class="home-link3 tertiary-nav" href="https://github.com/dotcloud/docker/blob/master/docs/sources/{{ current_page.input_path }}" >Edit on GitHub</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -132,6 +145,16 @@ piCId = '1482';
|
||||||
});
|
});
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#content').css("min-height", $(window).height() - 553 );
|
$('#content').css("min-height", $(window).height() - 553 );
|
||||||
|
// load the complete versions list
|
||||||
|
$.get("/versions.html_fragment", function( data ) {
|
||||||
|
$('#documentation-version-list').prepend(data);
|
||||||
|
//remove any "/v1.1/" bits from font.
|
||||||
|
path = document.location.pathname.replace(/^\/v\d\.\d/, "");
|
||||||
|
$('#documentation-version-list a.version').each(function(i, e) {
|
||||||
|
e.href = e.href+path;
|
||||||
|
$(e).removeClass()
|
||||||
|
});
|
||||||
|
});
|
||||||
})
|
})
|
||||||
var userName = getCookie('docker_sso_username');
|
var userName = getCookie('docker_sso_username');
|
||||||
if (userName) {
|
if (userName) {
|
||||||
|
|
|
@ -847,7 +847,8 @@ div + .form-inline {
|
||||||
.navbar #usernav .nav li {
|
.navbar #usernav .nav li {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
.navbar #usernav .nav li a {
|
.navbar #usernav .nav li a,
|
||||||
|
#versionnav .nav li a.dropdown-toggle {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #394d54;
|
color: #394d54;
|
||||||
|
@ -856,10 +857,12 @@ div + .form-inline {
|
||||||
padding: 0 20px 0 0;
|
padding: 0 20px 0 0;
|
||||||
background: url("../img/nav/caret-down-user-icon.svg") no-repeat 100% 50%;
|
background: url("../img/nav/caret-down-user-icon.svg") no-repeat 100% 50%;
|
||||||
}
|
}
|
||||||
.navbar #usernav .nav li a:hover {
|
.navbar #usernav .nav li a:hover,
|
||||||
|
#versionnav .nav li a.dropdown-toggle:hover {
|
||||||
background-image: url("../img/nav/caret-down-user-icon-over.svg");
|
background-image: url("../img/nav/caret-down-user-icon-over.svg");
|
||||||
}
|
}
|
||||||
.navbar #usernav .nav li ul li {
|
.navbar #usernav .nav li ul li,
|
||||||
|
#versionnav .version {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
|
|
@ -146,7 +146,7 @@ To make a shared test at http://beta-docs.docker.io:
|
||||||
(You will need the `awsconfig` file added to the `docs/` dir)
|
(You will need the `awsconfig` file added to the `docs/` dir)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make AWS_S3_BUCKET=beta-docs.docker.io docs-release
|
make AWS_S3_BUCKET=beta-docs.docker.io BUILD_ROOT=yes docs-release
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Commit and create a pull request to the "release" branch
|
### 5. Commit and create a pull request to the "release" branch
|
||||||
|
@ -249,6 +249,16 @@ branch afterwards!
|
||||||
|
|
||||||
### 11. Update the docs branch
|
### 11. Update the docs branch
|
||||||
|
|
||||||
|
If this is a MAJOR.MINOR.0 release, you need to make an branch for the previous release's
|
||||||
|
documentation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout -b docs-$PREVIOUS_MAJOR_MINOR docs
|
||||||
|
git fetch
|
||||||
|
git reset --hard origin/docs
|
||||||
|
git push -f origin docs-$PREVIOUS_MAJOR_MINOR
|
||||||
|
```
|
||||||
|
|
||||||
You will need the `awsconfig` file added to the `docs/` directory to contain the
|
You will need the `awsconfig` file added to the `docs/` directory to contain the
|
||||||
s3 credentials for the bucket you are deploying to.
|
s3 credentials for the bucket you are deploying to.
|
||||||
|
|
||||||
|
@ -257,13 +267,15 @@ git checkout -b docs release || git checkout docs
|
||||||
git fetch
|
git fetch
|
||||||
git reset --hard origin/release
|
git reset --hard origin/release
|
||||||
git push -f origin docs
|
git push -f origin docs
|
||||||
make AWS_S3_BUCKET=docs.docker.io docs-release
|
make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes docs-release
|
||||||
```
|
```
|
||||||
|
|
||||||
The docs will appear on http://docs.docker.io/ (though there may be cached
|
The docs will appear on http://docs.docker.com/ (though there may be cached
|
||||||
versions, so its worth checking http://docs.docker.io.s3-website-us-west-2.amazonaws.com/).
|
versions, so its worth checking http://docs.docker.com.s3-website-us-east-1.amazonaws.com/).
|
||||||
For more information about documentation releases, see `docs/README.md`.
|
For more information about documentation releases, see `docs/README.md`.
|
||||||
|
|
||||||
|
Ask Sven, or JohnC to invalidate the cloudfront cache using the CND Planet chrome applet.
|
||||||
|
|
||||||
### 12. Create a new pull request to merge release back into master
|
### 12. Create a new pull request to merge release back into master
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
Loading…
Reference in New Issue