From 845c133d0b60f30a89332e6a49902e24298c0b1b Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 17 Aug 2013 15:55:30 +0200 Subject: [PATCH] Explicitly list beta and development versions in docs as "devel" Previously we listed both those as unsupported, which confused some users particularly with new beta releases. While they are technically not supported yet, it gave off the image that specific features would not be in newer versions anymore, since they got listed as unsupported. In passing, fix the style of the links in case they only exist in old versions, which would put an extra | character in the version list. --- pgweb/docs/views.py | 8 ++++++-- templates/docs/docspage.html | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py index eea782af..c0bb86a4 100644 --- a/pgweb/docs/views.py +++ b/pgweb/docs/views.py @@ -43,7 +43,10 @@ def docpage(request, version, typ, filename): fullname = "%s.%s" % (filename, extension) page = get_object_or_404(DocPage, version=ver, file=fullname) - versions = DocPage.objects.filter(file=fullname).extra(select={'supported':"COALESCE((SELECT supported FROM core_version v WHERE v.tree=version), 'f')"}).order_by('-supported', '-version').only('version', 'file') + versions = DocPage.objects.filter(file=fullname).extra(select={ + 'supported':"COALESCE((SELECT supported FROM core_version v WHERE v.tree=version), 'f')", + 'beta':"CASE WHEN (SELECT beta FROM core_version v WHERE v.tree=version)='t' THEN true WHEN version=0 THEN true ELSE false END", + }).order_by('-supported', '-version').only('version', 'file') if typ=="interactive": comments = DocComment.objects.filter(version=ver, file=fullname, approved=True).order_by('posted_at') @@ -53,7 +56,8 @@ def docpage(request, version, typ, filename): return render_to_response('docs/docspage.html', { 'page': page, 'supported_versions': [v for v in versions if v.supported], - 'unsupported_versions': [v for v in versions if not v.supported], + 'devel_versions': [v for v in versions if not v.supported and v.beta], + 'unsupported_versions': [v for v in versions if not v.supported and not v.beta], 'title': page.title, 'doc_type': typ, 'comments': comments, diff --git a/templates/docs/docspage.html b/templates/docs/docspage.html index 0dcef107..df534d95 100644 --- a/templates/docs/docspage.html +++ b/templates/docs/docspage.html @@ -40,8 +40,8 @@ HomeDocumentationManualsPostgreSQL {{page.display_version}}{%if loaddate%} ({{loaddate|date:"Y-m-d H:i:s"}}){%endif%}
-{%if supported_versions%} This page in other versions: +{%if supported_versions%} {%for ver in supported_versions %} {%if not forloop.first %}/{%endif%} {%if ver.version == page.version %} @@ -51,8 +51,21 @@ This page in other versions: {%endif%} {%endfor%} {%endif%} + +{%if devel_versions%} +{%if supported_versions%} |  {%endif%}Development versions: +{%for ver in devel_versions %} + {%if not forloop.first %}/{%endif%} + {%if ver.version == page.version %} + {{ver.display_version}} + {% else %} + {{ver.display_version}} + {%endif%} +{%endfor%} +{%endif%} + {%if unsupported_versions%} - |  Unsupported versions: +{%if supported_versions or devel_versions%} |  {%endif%}Unsupported versions: {%for ver in unsupported_versions %} {%if not forloop.first %}/{%endif%} {%if ver.version == page.version %}