Fix the incorrect storyboard url

Using "repository_name" instead of "bug_project" to combine with the
"urlBase" string, if set use_storyboard to "True". storyboard URLs are
in this format:
"https://storyboard.openstack.org/#!/project/"+"openstack/whereto"
not:
"https://storyboard.openstack.org/#!/project/"+"whereto"

Change-Id: Ib553d95f22c7848a5bd537b8929a2d6e6625451b
This commit is contained in:
chenxing 2018-09-13 00:21:53 +08:00
parent fde94a8a86
commit c7f1ed0028
4 changed files with 23 additions and 17 deletions

View File

@ -49,23 +49,22 @@ Using the theme
The prefix and repo name. For example,
``'openstack/python-glanceclient'``.
``use_storyboard``
Set to ``True`` if using StoryBoard.
.. note::
If using StoryBoard, do not set ``bug_project`` and ``bug_tag``
options.
``bug_project``
The project name or ID. For launchpad, it's a string like
``python-glanceclient``. If unspecified, the "Report a bug"
links are not shown.
If your project uses ``storyboard.openstack.org``, it's a
string like ``openstack-ci`` for the project group.
..note:: Previously StoryBoard showed numbers, and thus you set
this to a project number instead like ``901``. Set this to a
string instead and also use the ``use_storyboard`` variable.
links are not shown. This option can be removed if using StoryBoard.
``bug_tag``
Launchpad bug tag. If unspecified, no tag is set. The default is empty.
``use_storyboard``
Set to ``True`` if using StoryBoard.
Launchpad bug tag. If unspecified, no tag is set. The default is empty.
This option can be removed if using StoryBoard.
One example for a project using launchpad::
@ -79,8 +78,6 @@ Using the theme
# openstackdocstheme options
repository_name = 'openstack-infra/infra-manual'
use_storyboard = True
bug_project = 'openstack-ci'
bug_tag = ''
#. Remove the options that will be automatically configured by the theme.

View File

@ -53,6 +53,9 @@
/* gitsha, project and bug_tag rely on variables in conf.py */
var gitSha = "SHA: {{ gitsha }}";
{%- if repository_name %}
var repositoryName = "{{ repository_name }}";
{%- endif %}
{%- if bug_project %}
var bugProject = "{{ bug_project }}";
{%- endif %}
@ -78,5 +81,5 @@
lineFeed + encodeURI(gitSha) +
lineFeed + encodeURI(gitURL) ;
logABug(bugTitle, bugProject, fieldComment, fieldTags);
logABug(bugTitle, bugProject, fieldComment, fieldTags, repositoryName);
</script>

View File

@ -104,7 +104,7 @@ $('div.deprecated > p').prepend('<div class="fa fa-fw fa-minus-circle">&nbsp;</d
// 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, bugProject, fieldComment, fieldTags) {
function logABug(bugTitle, bugProject, fieldComment, fieldTags, repositoryName) {
var lineFeed = "%0A";
@ -126,7 +126,7 @@ function logABug(bugTitle, bugProject, fieldComment, fieldTags) {
var bugLink = "";
if (useStoryboard) {
var urlBase = "https://storyboard.openstack.org/#!/project/";
bugLink = urlBase + bugProject;
bugLink = urlBase + repositoryName;
} else {
bugLink = urlBase + encodeURIComponent(bugTitle) +
"&field.tags=" + fieldTags +

View File

@ -0,0 +1,6 @@
---
fixes:
- |
If you use storyboard via ``use_storyboard``, now only ``repository_name``
is used and not ``bug_project`` anymore to construct the URL for storyboard.
The generated URL has been fixed as well.