"Report a bug" link in HTML manuals automatically fills in bug's tag
The "Report a bug" link in the HTML manuals populate information about the page. Since manuals within openstack-manuals project have their own tag within launchpad, this patch automatically tags the bug using a tag defined in conf.py. Change-Id: I3c9214a4f5a00648d325b4acaa493057ab0e4821 Closes-Bug: #1342373
This commit is contained in:
@@ -37,6 +37,8 @@ metadata for the project where the docs reside::
|
||||
# The git SHA checksum is used by "log-a-bug"
|
||||
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
|
||||
gitsha = os.popen(git_cmd).read().strip('\n')
|
||||
# tag that reported bugs will be tagged with
|
||||
bug_tag = "your-chosen-tag"
|
||||
# source tree
|
||||
pwd = os.popen("pwd").read().strip('\n')
|
||||
# html_context allows us to pass arbitrary values into the html template
|
||||
|
||||
@@ -65,10 +65,13 @@ release = '1.0'
|
||||
# The git SHA checksum is used by "log-a-bug"
|
||||
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
|
||||
gitsha = os.popen(git_cmd).read().strip('\n')
|
||||
# tag that reported bugs will be tagged with when using the "log a bug"
|
||||
# clickthrough on each page, such as user-guide or install-guide
|
||||
bug_tag = "doc-builds"
|
||||
# source tree
|
||||
pwd = os.popen("pwd").read().strip('\n')
|
||||
# html_context allows us to pass arbitrary values into the html template
|
||||
html_context = { "pwd":pwd, "gitsha":gitsha }
|
||||
html_context = { "pwd":pwd, "gitsha":gitsha, "bug_tag": bug_tag}
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<!-- Javascript for page -->
|
||||
<script language="JavaScript">
|
||||
/* build a description of this page including SHA, source location on git repo and
|
||||
build time and set the HREF of the bug buttons */
|
||||
build time, the project's launchpad bug tag and set the HREF of the bug buttons */
|
||||
|
||||
var lineFeed = "%0A";
|
||||
|
||||
@@ -34,9 +34,10 @@
|
||||
gitlink += pwd.slice(pwd.lastIndexOf("/doc/")) + "/" + sourceFile
|
||||
{%- endif %}
|
||||
|
||||
/* gitsha and project rely on variables in conf.py */
|
||||
/* gitsha, project and bug_tag rely on variables in conf.py */
|
||||
var gitSha = "SHA: {{ gitsha }}"
|
||||
var bugTitle = "{{ title }} in {{ project }}"
|
||||
var fieldTags = "{{bug_tag}}"
|
||||
|
||||
/* "last_updated" is the build date and time. It relies on the
|
||||
conf.py variable "html_last_updated_fmt", which should include
|
||||
@@ -47,7 +48,7 @@
|
||||
lineFeed + encodeURI(gitSha) +
|
||||
lineFeed + encodeURI(gitlink)
|
||||
|
||||
logABug(bugTitle, fieldComment)
|
||||
logABug(bugTitle, fieldComment, fieldTags)
|
||||
</script>
|
||||
<!-- Javascript for search boxes (both sidebar and top nav) -->
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -125,11 +125,13 @@ $('div.warning > p.admonition-title').text(function(ignored_para,original) {
|
||||
|
||||
// Gives the log a bug icon the information it needs to generate the bug in
|
||||
// Launchpad with pre-filled information such as git SHA, git.openstack.org
|
||||
// source URL, and published document URL.
|
||||
function logABug(bugTitle, fieldComment) {
|
||||
// source URL, published document URL and tag.
|
||||
function logABug(bugTitle, fieldComment, fieldTags) {
|
||||
var lineFeed = "%0A";
|
||||
var urlBase = "https://bugs.launchpad.net/openstack-manuals/+filebug?field.title="
|
||||
var bugLink = urlBase + encodeURIComponent(bugTitle) + "&field.comment=" + lineFeed + lineFeed + "-----------------------------------" + lineFeed + fieldComment;
|
||||
document.getElementById("logABugLink1").href=bugLink;
|
||||
document.getElementById("logABugLink2").href=bugLink;
|
||||
var bugLink = urlBase + encodeURIComponent(bugTitle) +
|
||||
"&field.comment=" + lineFeed + lineFeed + "-----------------------------------" + lineFeed + fieldComment +
|
||||
"&field.tags=" + fieldTags;
|
||||
document.getElementById("logABugLink1").href=bugLink;
|
||||
document.getElementById("logABugLink2").href=bugLink;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user