Skip to content

Commit 958b6cb

Browse files
committed
Merge pull request #680 from dhermes/fix-98
Make it easy to open a documentation bug from the docs themselves
2 parents c248824 + d95dd47 commit 958b6cb

File tree

3 files changed

+56
-21
lines changed

3 files changed

+56
-21
lines changed

docs/_static/css/main.css

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

748+
#file-issue {
749+
position: absolute;
750+
right: 20px;
751+
top: 20px;
752+
display: none;
753+
}
754+
755+
#file-issue-secondary {
756+
margin-top: 1em;
757+
display: inline-block;
758+
}
759+
748760
.v-list {
749761
color: rgba(0,0,0,0.2);
750762
}
@@ -1022,26 +1034,6 @@ h2 .headerlink:hover {
10221034

10231035
}
10241036

1025-
@media only screen and (min-width: 45em) {
1026-
1027-
/*
1028-
Docs Header
1029-
*/
1030-
1031-
.versions {
1032-
position: absolute;
1033-
top: 6em;
1034-
right: 2em;
1035-
margin: 0;
1036-
}
1037-
1038-
.v-btn {
1039-
font-size: 0.7em;
1040-
line-height: normal;
1041-
}
1042-
1043-
}
1044-
10451037
@media only screen and (min-width: 50em) {
10461038

10471039
/*
@@ -1062,6 +1054,14 @@ h2 .headerlink:hover {
10621054
line-height: 70px;
10631055
}
10641056

1057+
#file-issue {
1058+
display: inline;
1059+
}
1060+
1061+
#file-issue-secondary {
1062+
display: none;
1063+
}
1064+
10651065
/*
10661066
Logo
10671067
*/
@@ -1133,7 +1133,15 @@ h2 .headerlink:hover {
11331133
}
11341134

11351135
.versions {
1136-
top: 7em;
1136+
position: absolute;
1137+
top: 6em;
1138+
right: 2em;
1139+
margin: 0;
1140+
}
1141+
1142+
.v-btn {
1143+
font-size: 0.7em;
1144+
line-height: normal;
11371145
}
11381146

11391147
/*

docs/_templates/layout.html

Lines changed: 13 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|urlencode, release|urlencode) %}
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

@@ -101,6 +108,12 @@ <h1 class="page-title">Python</h1>
101108
Version History ({{ release|e }})
102109
</a>
103110
</div><!-- end of .versions -->
111+
<div>
112+
<a href="{{ issue_uri }}" target="_blank" class="v-btn" id="file-issue-secondary">
113+
<img src="_static/images/icon-link-github.svg" />
114+
Report an Issue
115+
</a>
116+
</div>
104117
</header>
105118

106119
<section class="content">

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)