Add bug report project definition feature

Some teams use openstackdocstheme which have each launchpad project.
To report a bug to the appropriate project directly,
enable each project to define the bug report project.

To define it, add the html_context at Sphinx conf.py.
For example:
  html_context = {"bug_project": 'openstack-training-guides', ...}

Change-Id: I75d3c068305ad475ba75649e6185741dc511668b
This commit is contained in:
KATO Tomoyuki 2015-12-03 21:15:05 +09:00
parent 06a856a457
commit 119f9888b9
3 changed files with 13 additions and 3 deletions

View File

@ -36,6 +36,11 @@
/* gitsha, project and bug_tag rely on variables in conf.py */
var gitSha = "SHA: {{ gitsha }}";
{%- if bug_project %}
var bugProject = "{{ bug_project }}";
{%- else %}
var bugProject = "openstack-manuals";
{%- endif %}
var bugTitle = "{{ title }} in {{ project }}";
var fieldTags = "{{ bug_tag }}";
@ -48,7 +53,7 @@
lineFeed + encodeURI(gitSha) +
lineFeed + encodeURI(gitURL) ;
logABug(bugTitle, fieldComment, fieldTags);
logABug(bugTitle, bugProject, fieldComment, fieldTags);
</script>
<!-- Javascript for search boxes (both sidebar and top nav) -->

View File

@ -126,9 +126,9 @@ $('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, published document URL and tag.
function logABug(bugTitle, fieldComment, fieldTags) {
function logABug(bugTitle, bugProject, fieldComment, fieldTags) {
var lineFeed = "%0A";
var urlBase = "https://bugs.launchpad.net/openstack-manuals/+filebug?field.title="
var urlBase = "https://bugs.launchpad.net/" + bugProject + "/+filebug?field.title="
var currentURL = "URL: " + window.location.href;
var bugLink = urlBase + encodeURIComponent(bugTitle) +
"&field.comment=" + lineFeed + lineFeed + "-----------------------------------" + lineFeed + fieldComment +

View File

@ -0,0 +1,5 @@
---
features:
- Some teams use openstackdocstheme which have each launchpad project.
To report a bug to the appropriate project directly,
enable each project to define the bug report project.