Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed #21944 -- Added a warning for unsupported versions of the documentation. #72

Merged
merged 1 commit into from

3 participants

@timgraham
Owner

unsupported_warning

@aaugustin aaugustin merged commit cdf1275 into django:master
@timgraham timgraham deleted the timgraham:21944 branch
@charettes
Collaborator

What's the purpose of this margin? It looks odd to me.

Owner

It was added by mistake and removed in a subsequent commit which I guess hasn't been deployed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 12 deletions.
  1. +12 −7 docs/templates/docs/doc.html
  2. +3 −0  docs/views.py
  3. +13 −5 static/css/base.css
View
19 docs/templates/docs/doc.html
@@ -19,10 +19,16 @@
});
});
</script>
-{% if version == 'dev' %}
- <div id="dev-warning">
+{% if version_is_dev %}
+ <div id="dev-warning" class="doc-floating-warning">
{% trans "This document is for Django's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page." %}
</div>
+{% elif version_is_unsupported %}
+ <div id="outdated-warning" class="doc-floating-warning">
+ {% trans "This document is for an insecure version of Django that is no longer supported. Please upgrade to a newer release!" %}
+ </div>
+{% endif %}
+{% if version_is_dev or version_is_unsupported %}
<style type="text/css" media="screen">
body {
margin-top: 2em;
@@ -65,9 +71,8 @@
// use a delay that should work on all modern computers. should, not will.
}, 50);
});
-
</script>
- {% endif %}
+{% endif %}
{% endblock extrabody %}
{% block extrahead %}
@@ -97,10 +102,10 @@
</li>
{% endif %}
{% endfor %}
- <li class="current{% if version == 'dev' %} dev{% endif %}"
- title="{% if version == 'dev' %}{% trans "This document is for Django's development version, which can be significantly different from previous releases." %}{% else %}{% blocktrans %}This document describes Django {{ version }}.{% endblocktrans %}{% endif %} {% trans "Click on the links on the left to see other versions." %}">
+ <li class="current{% if version_is_dev %} dev{% endif %}"
+ title="{% if version_is_dev %}{% trans "This document is for Django's development version, which can be significantly different from previous releases." %}{% else %}{% blocktrans %}This document describes Django {{ version }}.{% endblocktrans %}{% endif %} {% trans "Click on the links on the left to see other versions." %}">
<span>{% trans "Documentation version:" %}
- <strong>{% if version == 'dev' %}
+ <strong>{% if version_is_dev %}
development{% else %}{{ version }}
{% endif %}</strong>
</span>
View
3  docs/views.py
@@ -62,6 +62,9 @@ def document(request, lang, version, url):
'env': json.load(open(docroot.child('globalcontext.json'), 'rb')),
'lang': lang,
'version': version,
+ 'version_is_dev': version == 'dev',
+ # TODO: would be nice not to hardcode this.
+ 'version_is_unsupported': version < '1.4',
'rtd_version': rtd_version,
'docurl': url,
'update_date': datetime.datetime.fromtimestamp(docroot.child('last_build').mtime()),
View
18 static/css/base.css
@@ -540,21 +540,29 @@ div.admonition.warning {
padding: 5px;
}
-#dev-warning {
- position:fixed;
+.doc-floating-warning {
+ position: fixed;
top: 0;
width: 100%;
+ margin-left: 5px;
padding: 5px 7px;
- background-size: 50px 50px;
- background-color: #ffe761;
color: #000;
- border-bottom: 2px solid #ae9e49;
font-size: 12px;
background-image: -webkit-linear-gradient(-45deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
background-image: linear-gradient(135deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
+ border-bottom: 2px solid; /* color specified in specific warning type below */
}
+#dev-warning {
+ background-color: #ffe761;
+ border-color: #ae9e49;
+}
+
+#outdated-warning {
+ background-color: #ffbaba;
+ border-color: #d8000c;
+}
#documentation h2,
#documentation h3,
Something went wrong with that request. Please try again.