diff --git a/README.rst b/README.rst index ba461e063347a7ae8b9d835d310424ebea49737d..e1343878ac80217772e8aa046fa5f9dadde09706 100644 --- a/README.rst +++ b/README.rst @@ -206,6 +206,7 @@ Template settings templates. Set it to ``False`` to disable it. * ``CAS_FAVICON_URL``: URL to the favicon (shortcut icon) used by the default templates. Default is a key icon. Set it to ``False`` to disable it. +* ``CAS_SHOW_POWERED``: Set it to ``False`` to hide the powered by footer. The default is ``True``. * ``CAS_COMPONENT_URLS``: URLs to css and javascript external components. It is a dictionnary and it must have the five following keys: ``"bootstrap3_css"``, ``"bootstrap3_js"``, ``"html5shiv"``, ``"respond"``, ``"jquery"``. The default is:: diff --git a/cas_server/default_settings.py b/cas_server/default_settings.py index bfa6a54840cc018c44d4095597bdb27ca514fb85..8474d0b181dc430975f6f80b81a4f332597e3e74 100644 --- a/cas_server/default_settings.py +++ b/cas_server/default_settings.py @@ -20,6 +20,8 @@ from importlib import import_module CAS_LOGO_URL = static("cas_server/logo.png") #: URL to the favicon (shortcut icon) used by the default templates. Default is a key icon. CAS_FAVICON_URL = static("cas_server/favicon.ico") +#: Show the powered by footer if set to ``True`` +CAS_SHOW_POWERED = True #: URLs to css and javascript external components. CAS_COMPONENT_URLS = { "bootstrap3_css": "//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css", diff --git a/cas_server/static/cas_server/alert-version.js b/cas_server/static/cas_server/alert-version.js deleted file mode 100644 index 7b4fef5a9535613c097c6bd6b9971682fe10446f..0000000000000000000000000000000000000000 --- a/cas_server/static/cas_server/alert-version.js +++ /dev/null @@ -1,27 +0,0 @@ -function alert_version(last_version){ - jQuery(function( $ ){ - $("#alert-version").click(function( e ){ - e.preventDefault(); - var date = new Date(); - date.setTime(date.getTime()+(10*365*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - document.cookie = "cas-alert-version=" + last_version + expires + "; path=/"; - }); - - var nameEQ="cas-alert-version="; - var ca = document.cookie.split(";"); - var value; - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while(c.charAt(0) === " "){ - c = c.substring(1,c.length); - } - if(c.indexOf(nameEQ) === 0){ - value = c.substring(nameEQ.length,c.length); - } - } - if(value === last_version){ - $("#alert-version").parent().hide(); - } - }); -} diff --git a/cas_server/static/cas_server/functions.js b/cas_server/static/cas_server/functions.js new file mode 100644 index 0000000000000000000000000000000000000000..560c4fad6d19d3fb2362a5dc2de7dea44f0c74b1 --- /dev/null +++ b/cas_server/static/cas_server/functions.js @@ -0,0 +1,40 @@ +function createCookie(name, value, days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name + "=" + value + expires + "; path=/"; +} + +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(";"); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==" "){ + c = c.substring(1,c.length); + } + if (c.indexOf(nameEQ) == 0){ + return c.substring(nameEQ.length,c.length); + } + } + return null; +} + +function eraseCookie(name) { + createCookie(name,"",-1); +} + +function alert_version(last_version){ + jQuery(function( $ ){ + $("#alert-version").click(function( e ){ + e.preventDefault(); + createCookie("cas-alert-version", last_version, 10*365) + }); + if(readCookie("cas-alert-version") === last_version){ + $("#alert-version").parent().hide(); + } + }); +} diff --git a/cas_server/static/cas_server/styles.css b/cas_server/static/cas_server/styles.css index 6d3524b4b49e3e64988ace576107dd219296c528..9ec8ec684155e434a1059a2b4d732cf33049ae56 100644 --- a/cas_server/static/cas_server/styles.css +++ b/cas_server/static/cas_server/styles.css @@ -1,6 +1,9 @@ +html, body { + height: 100%; +} body { padding-top: 40px; - padding-bottom: 40px; + padding-bottom: 0px; background-color: #eee; } @@ -41,6 +44,22 @@ body { width:110px; } +/* Wrapper for page content to push down footer */ +#wrap { + min-height: 100%; + height: auto !important; + height: 100%; + /* Negative indent footer by it's height */ + margin: 0 auto -40px; +} +#footer { + height: 40px; + text-align: center; +} +#footer p { + padding-top: 10px; +} + @media screen and (max-width: 680px) { #app-name { margin: 0; diff --git a/cas_server/templates/cas_server/base.html b/cas_server/templates/cas_server/base.html index 87b9a6d0bd5fac26933ce0ab16ab9f5ae5a06164..8a491cae55c0adfbfbce444cc1bfb1918d71642c 100644 --- a/cas_server/templates/cas_server/base.html +++ b/cas_server/templates/cas_server/base.html @@ -1,6 +1,4 @@ -{% load i18n %} -{% load staticfiles %} - +{% load i18n %}{% load staticfiles %} @@ -18,12 +16,13 @@ +
{% if auto_submit %}
{% endfor %} {% if auto_submit %}{% endif %} @@ -62,11 +61,25 @@
- - - {% if settings.CAS_NEW_VERSION_HTML_WARNING and upgrade_available %} - - - {% endif %} + +
+ {% if settings.CAS_SHOW_POWERED %} + + {% endif %} + + + + {% if settings.CAS_NEW_VERSION_HTML_WARNING and upgrade_available %} + + {% endif %} + {% block javascript %}{% endblock %} + diff --git a/cas_server/templates/cas_server/form.html b/cas_server/templates/cas_server/form.html index f189f6b17dc4efd2fdd09a796aee008e8fd79bce..5571a7bd241c0a56da6250f1321cdf6a61c99953 100644 --- a/cas_server/templates/cas_server/form.html +++ b/cas_server/templates/cas_server/form.html @@ -14,7 +14,7 @@ {% endif %}" {% endspaceless %}>{% spaceless %} {% if field|is_checkbox %} -
+
{% else %} {{field}} diff --git a/cas_server/templates/cas_server/login.html b/cas_server/templates/cas_server/login.html index d6adc640135daf51d2a865bc16d4eed258d080c8..ff98c0321ec6cbeadc747580ef45bfbd27f7d282 100644 --- a/cas_server/templates/cas_server/login.html +++ b/cas_server/templates/cas_server/login.html @@ -14,10 +14,17 @@ {% if auto_submit %}{% endif %} -{% if auto_submit %} - -{% endif %} {% endblock %} +{% block javascript %}{% endblock %}