From 119f9888b9d4832a976c440f517043d946cd833c Mon Sep 17 00:00:00 2001 From: KATO Tomoyuki Date: Thu, 3 Dec 2015 21:15:05 +0900 Subject: [PATCH] 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 --- openstackdocstheme/theme/openstackdocs/script_footer.html | 7 ++++++- openstackdocstheme/theme/openstackdocs/static/js/docs.js | 4 ++-- releasenotes/notes/bug-project-e9ff50f6149d2be1.yaml | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/bug-project-e9ff50f6149d2be1.yaml diff --git a/openstackdocstheme/theme/openstackdocs/script_footer.html b/openstackdocstheme/theme/openstackdocs/script_footer.html index b1b1891..70f6401 100644 --- a/openstackdocstheme/theme/openstackdocs/script_footer.html +++ b/openstackdocstheme/theme/openstackdocs/script_footer.html @@ -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); diff --git a/openstackdocstheme/theme/openstackdocs/static/js/docs.js b/openstackdocstheme/theme/openstackdocs/static/js/docs.js index 5c05e2a..99013e9 100644 --- a/openstackdocstheme/theme/openstackdocs/static/js/docs.js +++ b/openstackdocstheme/theme/openstackdocs/static/js/docs.js @@ -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 + diff --git a/releasenotes/notes/bug-project-e9ff50f6149d2be1.yaml b/releasenotes/notes/bug-project-e9ff50f6149d2be1.yaml new file mode 100644 index 0000000..9861b2e --- /dev/null +++ b/releasenotes/notes/bug-project-e9ff50f6149d2be1.yaml @@ -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.