From 6e9c5484e914e8d3b983053f585411d6df8617bd Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Tue, 24 Feb 2015 22:52:52 -0800 Subject: [PATCH 1/4] Adding support for opening an issue from any page. - Anchored as part of {% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 364eeab570c1..3e007d256e20 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ from pkg_resources import get_distribution import sys, os +import urllib # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -179,6 +180,8 @@ # Output file base name for HTML help builder. htmlhelp_basename = 'gclouddoc' +html_context = {} + # -- Options for LaTeX output -------------------------------------------------- @@ -257,3 +260,14 @@ # This pulls class descriptions from the class docstring, # and parameter definitions from the __init__ docstring. autoclass_content = 'both' + +issue_uri = ('https://github.com/GoogleCloudPlatform/gcloud-python/issues/' + 'new?' + urllib.urlencode({'title': '[Documentation Issue] '})) +issue_uri_template = ( + issue_uri + '&' + urllib.urlencode({'body': 'Page Name: '}) + '{0}' + + urllib.quote('\nRelease: ') + '{1}') + +html_context.update( + issue_uri=issue_uri, + issue_uri_template=issue_uri_template, +) From 046ed3db5bb43a61ae528ed97d1868bec27d1ae9 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Tue, 24 Feb 2015 23:31:13 -0800 Subject: [PATCH 2/4] Adding CSS to "Report an Issue" button, hidden under 50em. --- docs/_static/css/main.css | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/_static/css/main.css b/docs/_static/css/main.css index 9c1d3f52424b..5e7ccfaa79e9 100755 --- a/docs/_static/css/main.css +++ b/docs/_static/css/main.css @@ -746,9 +746,10 @@ h2 .headerlink:hover { } #file-issue { - position: absolute; - right: 20px; - top: 20px; + position: absolute; + right: 20px; + top: 20px; + display: none; } .v-list { @@ -1068,6 +1069,10 @@ h2 .headerlink:hover { line-height: 70px; } + #file-issue { + display: inline; + } + /* Logo */ From 0f237b9cc02000f6c585578f0b9d518f9cc62444 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Tue, 24 Feb 2015 23:45:47 -0800 Subject: [PATCH 3/4] Adding secondary "Report an Issue" button mobile. Responsive CSS reduces the amount of horizontal items at 50em (800px) so we hide the anchored button and reveal one at the top next to "Version History". --- docs/_static/css/main.css | 39 +++++++++++++++++-------------------- docs/_templates/layout.html | 6 ++++++ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/docs/_static/css/main.css b/docs/_static/css/main.css index 5e7ccfaa79e9..674948469063 100755 --- a/docs/_static/css/main.css +++ b/docs/_static/css/main.css @@ -752,6 +752,11 @@ h2 .headerlink:hover { display: none; } +#file-issue-secondary { + margin-top: 1em; + display: inline-block; +} + .v-list { color: rgba(0,0,0,0.2); } @@ -1029,26 +1034,6 @@ h2 .headerlink:hover { } -@media only screen and (min-width: 45em) { - - /* - Docs Header - */ - - .versions { - position: absolute; - top: 6em; - right: 2em; - margin: 0; - } - - .v-btn { - font-size: 0.7em; - line-height: normal; - } - -} - @media only screen and (min-width: 50em) { /* @@ -1073,6 +1058,10 @@ h2 .headerlink:hover { display: inline; } + #file-issue-secondary { + display: none; + } + /* Logo */ @@ -1144,7 +1133,15 @@ h2 .headerlink:hover { } .versions { - top: 7em; + position: absolute; + top: 6em; + right: 2em; + margin: 0; + } + + .v-btn { + font-size: 0.7em; + line-height: normal; } /* diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index a5c230e976a9..7f2839eef195 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -108,6 +108,12 @@

Python

Version History ({{ release|e }}) +
+ + + Report an Issue + +
From d95dd4750f27a815f648742c069dac8e4eb89c35 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 25 Feb 2015 00:19:04 -0800 Subject: [PATCH 4/4] Escaping release and pagename for use in URL string. --- docs/_templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 7f2839eef195..edc1c8652d87 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -82,7 +82,7 @@

{%- if show_source and has_source and pagename %} - {%- set issue_uri = issue_uri_template.format(pagename, release) %} + {%- set issue_uri = issue_uri_template.format(pagename|urlencode, release|urlencode) %} {%- endif %}