Merge lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 2229
Proposed branch: lp:~rvb/maas/add-version-switcher-1.5
Merge into: lp:maas/1.5
Diff against target: 85 lines (+41/-0)
4 files modified
Makefile (+3/-0)
docs/_templates/maas/layout.html (+1/-0)
docs/_templates/maas/relations.html (+12/-0)
docs/conf.py (+25/-0)
To merge this branch: bzr merge lp:~rvb/maas/add-version-switcher-1.5
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+214422@code.launchpad.net

Commit message

Add the version switcher widget. Add the new `doc-with-versions` make target to generate a version of the documentation that includes the version switcher widget.

Description of the change

This works in conjunction with https://code.launchpad.net/~rvb/maas/multiple-versions-doc-1.6/+merge/214424.

The change to the 1.5 branch should be a one-off. No further modification should be required, even when publishing a new version of the documentation.

If 'add_version_switcher' is set to True, the code in docs/_templates/maas/relations.html dynamically fetches the Javascript file used to generate the version switcher widget from the trunk documentation.

See the result at http://162.213.35.95:8000/docs

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 review: approve

Nice work Raphers! Just a question and a suggestion:

On 07/04/14 02:32, Raphaël Badin wrote:
> Raphaël Badin has proposed merging
> lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5.
>
> Commit message: Add the version switcher widget. Add the new
> `doc-with-versions` make target to generate a version of the
> documentation that includes the version switcher widget.

Is there a reason to make this conditional?

> This works in conjunction with
> https://code.launchpad.net/~rvb/maas/multiple-versions-doc-1.6/+merge/214424.
>
> The change to the 1.5 branch should be a one-off. No further
> modification should be required, even when publishing a new version
> of the documentation.
>
> If 'add_version_switcher' is set to True, the code in
> docs/_templates/maas/relations.html dynamically fetches the
> Javascript file used to generate the version switcher widget from
> the trunk documentation.
>
> See the result at http://162.213.35.95:8000/docs
>

I think it would look better if you could put the switcher at the top
somewhere so that it's more prominent. Also, its title should be
"Documentation for MAAS version:"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNCVUAACgkQWhGlTF8G/Hc9CQCdESXPX3wM1L41K9GXftUY5Xiw
0asAn1po0JklTowRClocmJarUHRTm9P8
=yGGO
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> review: approve
>
> Nice work Raphers! Just a question and a suggestion:
>
> On 07/04/14 02:32, Raphaël Badin wrote:
> > Raphaël Badin has proposed merging
> > lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5.
> >
> > Commit message: Add the version switcher widget. Add the new
> > `doc-with-versions` make target to generate a version of the
> > documentation that includes the version switcher widget.
>
> Is there a reason to make this conditional?

Yes, I want to keep a way to generate the documentation *without* the version switcher widget. This is the documentation we will someday package in a maas-doc package.

> I think it would look better if you could put the switcher at the top
> somewhere so that it's more prominent. Also, its title should be
> "Documentation for MAAS version:"

Okay, I'll that.

Revision history for this message
Raphaël Badin (rvb) wrote :

> > I think it would look better if you could put the switcher at the top
> > somewhere so that it's more prominent. Also, its title should be
> > "Documentation for MAAS version:"
>
> Okay, I'll do that.

I moved the widget at the top… but I left the title as is since "Documentation for MAAS version:" really doesn't fit (it takes two lines and it's ugly).

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On 08/04/14 03:37, Raphaël Badin wrote:
>
>>> I think it would look better if you could put the switcher at the top
>>> somewhere so that it's more prominent. Also, its title should be
>>> "Documentation for MAAS version:"
>>
>> Okay, I'll do that.
>
> I moved the widget at the top… but I left the title as is since "Documentation for MAAS version:" really doesn't fit (it takes two lines and it's ugly).
>
>

Please, the title needs to change, make the text smaller if you have to.

"Version" doesn't mean much on its own like that. "Version what?" was
my first thought, especially when I clicked on it it was initially empty
and only loaded later. Maybe its default values should say "loading...".

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-03-27 04:02:16 +0000
3+++ Makefile 2014-04-07 17:12:29 +0000
4@@ -164,6 +164,9 @@
5 doc: bin/sphinx docs/api.rst
6 bin/sphinx
7
8+doc-with-versions: bin/sphinx
9+ cd docs/_build; make SPHINXOPTS="-A add_version_switcher=true" html
10+
11 man: $(patsubst docs/man/%.rst,man/%,$(wildcard docs/man/*.rst))
12
13 man/%: docs/man/%.rst | bin/sphinx-build
14
15=== modified file 'docs/_templates/maas/layout.html'
16--- docs/_templates/maas/layout.html 2013-12-06 15:11:12 +0000
17+++ docs/_templates/maas/layout.html 2014-04-07 17:12:29 +0000
18@@ -5,6 +5,7 @@
19 <a style="border:0" title="MAAS Documentation Homepage" href="{{ pathto('index.html', 1) }}"><img src="{{ pathto('_static/maas-logo-200.png',1) }}" alt="MAAS logo"/></a>
20 <h2 style="text-align:center;">MAAS</h2>
21 <p style="font-style:italic;font-size:0.9em; text-align:center; margin-bottom:1.5em">Metal As A Service.</p>
22+<span id="version_switcher"></span>
23 <br/>
24 <br/>
25 {% endblock %}
26
27=== modified file 'docs/_templates/maas/relations.html'
28--- docs/_templates/maas/relations.html 2013-12-06 15:11:12 +0000
29+++ docs/_templates/maas/relations.html 2014-04-07 17:12:29 +0000
30@@ -1,3 +1,15 @@
31+<script type="text/javascript">
32+$(document).ready(function () {
33+ if ({{ add_version_switcher }}) {
34+ $.ajaxSetup({cache: true});
35+ $.getScript('{{ versions_json_path }}', function() {
36+ console.log( "Versions script loaded." );
37+ set_up_version_switcher('#version_switcher', '{{ doc_prefix }}');
38+ });
39+}
40+});
41+</script>
42+
43 <h3>Related Topics</h3>
44 <ul>
45 <li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul>
46
47=== modified file 'docs/conf.py'
48--- docs/conf.py 2014-03-05 22:17:59 +0000
49+++ docs/conf.py 2014-04-07 17:12:29 +0000
50@@ -22,6 +22,23 @@
51
52 # -- General configuration -----------------------------------------------------
53
54+# Add a widget to switch between different versions of the documentation to
55+# each generated page.
56+add_version_switcher = False
57+
58+# In order for the version widget to be able to redirect correctly to the
59+# other versions of the documentation, each version of the documentation
60+# has to be accessible at the following addresses:
61+# /<doc_prefix>/ -> documentation for trunk.
62+# /<doc_prefix>1.4/ -> documentation for 1.4.
63+# etc.
64+doc_prefix = 'docs'
65+
66+# Path of the JSON document, relative to homepage of the documentation for trunk
67+# (i.e. '/<doc_prefix>/'), with the list of the versions to include in the
68+# version switcher widget.
69+versions_path = '_static/versions.js'
70+
71 # If your documentation needs a minimal Sphinx version, state it here.
72 #needs_sphinx = '1.0'
73
74@@ -240,3 +257,11 @@
75
76 # Example configuration for intersphinx: refer to the Python standard library.
77 intersphinx_mapping = {'http://docs.python.org/': None}
78+
79+# Populate html_context with the variables used in the templates.
80+html_context = {
81+ 'add_version_switcher': 'true' if add_version_switcher else 'false',
82+ 'versions_json_path': '/'.join(['', doc_prefix, versions_path]),
83+ 'doc_prefix': doc_prefix,
84+}
85+

Subscribers

People subscribed via source and target branches

to all changes: