Minimal support for storyboard

Allows setting of bug_project to a storyboard project number
to redirect to project page on storyboard.openstack.org for
report a bug feature.

Also, add some minor cleanups to doc/source/conf.py.

Change-Id: Ia14d30bf0dda89c48dec0a7cc3b8dccc26dc8d86
This commit is contained in:
Andreas Jaeger 2017-06-28 13:37:31 +02:00
parent 36cc0ab48b
commit 9a6159a529
6 changed files with 35 additions and 9 deletions

View File

@ -12,10 +12,7 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import subprocess # import os
import sys
import os
import warnings
import openstackdocstheme import openstackdocstheme
@ -62,8 +59,8 @@ master_doc = 'index'
# 'security guide' or 'network guide' # 'security guide' or 'network guide'
# It's used by the "log-a-bug" button on each page # It's used by the "log-a-bug" button on each page
# and should ultimately be set automatically by the build process # and should ultimately be set automatically by the build process
project = u'network guide' project = u'OpenStack Documentation Theme'
copyright = u'2015, OpenStack Contributors' copyright = u'2015-2017, OpenStack Contributors'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the

View File

@ -54,19 +54,29 @@ Using the Theme
``'openstack/python-glanceclient'``. ``'openstack/python-glanceclient'``.
``bug_project`` ``bug_project``
The launchpad project name. For example, ``python-glanceclient``. The project name or ID. For launchpad, it's a string like
``python-glanceclient``. If your project uses
``storyboard.openstack.org``, use the project number instead
like ``901``
``bug_tag`` ``bug_tag``
Launchpad bug tag. If unspecified, no tag is set. The default is Launchpad bug tag. If unspecified, no tag is set. The default is
empty. empty.
For example:: One example for a project using launchpad::
# openstackdocstheme options # openstackdocstheme options
repository_name = 'openstack/python-glanceclient' repository_name = 'openstack/python-glanceclient'
bug_project = 'python-glanceclient' bug_project = 'python-glanceclient'
bug_tag = '' bug_tag = ''
One example for a project using storyboard::
# openstackdocstheme options
repository_name = 'openstack-infra/infra-manual'
bug_project = '721'
bug_tag = ''
#. Enable the "last-updated" information by setting the format for the #. Enable the "last-updated" information by setting the format for the
timestamp:: timestamp::

View File

@ -58,9 +58,12 @@ def _html_page_context(app, pagename, templatename, context, doctree):
bug_project = app.config.bug_project bug_project = app.config.bug_project
if bug_project: if bug_project:
_html_context_data['bug_project'] = bug_project _html_context_data['bug_project'] = bug_project
if bug_project and bug_project.isdigit():
_html_context_data['use_storyboard'] = True
bug_tag = app.config.bug_tag bug_tag = app.config.bug_tag
if bug_tag: if bug_tag:
_html_context_data['bug_tag'] = bug_tag _html_context_data['bug_tag'] = bug_tag
context.update(_html_context_data) context.update(_html_context_data)

View File

@ -47,6 +47,12 @@
var bugTitle = "{{ title }} in {{ project }}"; var bugTitle = "{{ title }} in {{ project }}";
{%- endif %} {%- endif %}
var fieldTags = "{{ bug_tag }}"; var fieldTags = "{{ bug_tag }}";
{%- if use_storyboard %}
var useStoryboard = "{{ use_storyboard }}";
{%- else %}
var useStoryboard = "";
{%- endif %}
/* "last_updated" is the build date and time. It relies on the /* "last_updated" is the build date and time. It relies on the
conf.py variable "html_last_updated_fmt", which should include conf.py variable "html_last_updated_fmt", which should include

View File

@ -127,11 +127,17 @@ function logABug(bugTitle, bugProject, fieldComment, fieldTags) {
var urlBase = "https://bugs.launchpad.net/" + bugProject + "/+filebug?field.title="; var urlBase = "https://bugs.launchpad.net/" + bugProject + "/+filebug?field.title=";
var currentURL = "URL: " + window.location.href; var currentURL = "URL: " + window.location.href;
var bugLink = urlBase + encodeURIComponent(bugTitle) + var bugLink = "";
if (useStoryboard) {
var urlBase = "https://storyboard.openstack.org/#!/project/";
bugLink = urlBase + bugProject;
} else {
bugLink = urlBase + encodeURIComponent(bugTitle) +
"&field.comment=" + lineFeed + lineFeed + lineFeed + "&field.comment=" + lineFeed + lineFeed + lineFeed +
bugChecklist + lineFeed + "-----------------------------------" + lineFeed + fieldComment + bugChecklist + lineFeed + "-----------------------------------" + lineFeed + fieldComment +
lineFeed + currentURL + lineFeed + currentURL +
"&field.tags=" + fieldTags; "&field.tags=" + fieldTags;
}
document.getElementById("logABugLink1").href=bugLink; document.getElementById("logABugLink1").href=bugLink;
document.getElementById("logABugLink2").href=bugLink; document.getElementById("logABugLink2").href=bugLink;
document.getElementById("logABugLink3").href=bugLink; document.getElementById("logABugLink3").href=bugLink;

View File

@ -0,0 +1,4 @@
---
features:
- Initial integration of storyboard.openstack.org for report a bug,
set ``bug_project`` to the number of the project to use it.