Skip to content

Commit

Permalink
Adding support for opening an issue from any page.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
dhermes committed Feb 25, 2015
1 parent 0e41dc3 commit 6e9c548
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/_static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,12 @@ h2 .headerlink:hover {
opacity: 0.3;
}

#file-issue {
position: absolute;
right: 20px;
top: 20px;
}

.v-list {
color: rgba(0,0,0,0.2);
}
Expand Down
7 changes: 7 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ <h1 class="logo">
</li>
</ul>
</nav><!-- end of .main-nav -->
{%- if show_source and has_source and pagename %}
{%- set issue_uri = issue_uri_template.format(pagename, release) %}
{%- endif %}
<a href="{{ issue_uri }}" target="_blank" class="v-btn" id="file-issue">
<img src="_static/images/icon-link-github.svg" />
Report an Issue
</a>
</header><!-- end of .page-header -->
{% endblock %}

Expand Down
14 changes: 14 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -179,6 +180,8 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'gclouddoc'

html_context = {}


# -- Options for LaTeX output --------------------------------------------------

Expand Down Expand Up @@ -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,
)

0 comments on commit 6e9c548

Please sign in to comment.