Skip to content

Commit 6e9c548

Browse files
committed
Adding support for opening an issue from any page.
- Anchored as part of <header class="page-header fixed"> - Still needs work for responsive parts (small page sizes) - Link has a template with information about the page the issue is filed from Fixes googleapis#98.
1 parent 0e41dc3 commit 6e9c548

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

docs/_static/css/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,12 @@ h2 .headerlink:hover {
745745
opacity: 0.3;
746746
}
747747

748+
#file-issue {
749+
position: absolute;
750+
right: 20px;
751+
top: 20px;
752+
}
753+
748754
.v-list {
749755
color: rgba(0,0,0,0.2);
750756
}

docs/_templates/layout.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ <h1 class="logo">
8181
</li>
8282
</ul>
8383
</nav><!-- end of .main-nav -->
84+
{%- if show_source and has_source and pagename %}
85+
{%- set issue_uri = issue_uri_template.format(pagename, release) %}
86+
{%- endif %}
87+
<a href="{{ issue_uri }}" target="_blank" class="v-btn" id="file-issue">
88+
<img src="_static/images/icon-link-github.svg" />
89+
Report an Issue
90+
</a>
8491
</header><!-- end of .page-header -->
8592
{% endblock %}
8693

docs/conf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from pkg_resources import get_distribution
1515
import sys, os
16+
import urllib
1617

1718
# If extensions (or modules to document with autodoc) are in another directory,
1819
# add these directories to sys.path here. If the directory is relative to the
@@ -179,6 +180,8 @@
179180
# Output file base name for HTML help builder.
180181
htmlhelp_basename = 'gclouddoc'
181182

183+
html_context = {}
184+
182185

183186
# -- Options for LaTeX output --------------------------------------------------
184187

@@ -257,3 +260,14 @@
257260
# This pulls class descriptions from the class docstring,
258261
# and parameter definitions from the __init__ docstring.
259262
autoclass_content = 'both'
263+
264+
issue_uri = ('https://github.com/GoogleCloudPlatform/gcloud-python/issues/'
265+
'new?' + urllib.urlencode({'title': '[Documentation Issue] '}))
266+
issue_uri_template = (
267+
issue_uri + '&' + urllib.urlencode({'body': 'Page Name: '}) + '{0}' +
268+
urllib.quote('\nRelease: ') + '{1}')
269+
270+
html_context.update(
271+
issue_uri=issue_uri,
272+
issue_uri_template=issue_uri_template,
273+
)

0 commit comments

Comments
 (0)