From 9606921b662a85bf5d68db06f68deb4045dcdd57 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 20 Mar 2013 09:37:57 +0100 Subject: [PATCH] omments on logging out --- auth/js/logout.js | 4 ++++ views/css/topmenu.css | 2 +- views/templates/widget-topmenu.html | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/auth/js/logout.js b/auth/js/logout.js index 63bc197b..1e140a90 100644 --- a/auth/js/logout.js +++ b/auth/js/logout.js @@ -1,6 +1,10 @@ +/* retrieve username from the button that is clicked, the one named 'logout' + and that is expected to have the 'username' attribute */ function logout () { var username=$(this).attr('username'); var msg="Are you sure you want to logout as " + username + " ?"; + /* redirect to /logout, see urls.py */ if (confirm(msg)) window.location="/logout/"; } +/* attach this function to the logout button */ $(document).ready(function() { $('#logout').click(logout); }) diff --git a/views/css/topmenu.css b/views/css/topmenu.css index 3d481825..0b9f14f6 100644 --- a/views/css/topmenu.css +++ b/views/css/topmenu.css @@ -7,5 +7,5 @@ body { div.topmenu { padding-top: 10px; } button#logout { margin-left: 8px; - margin-bottom: 8px; + margin-bottom: 10px; } diff --git a/views/templates/widget-topmenu.html b/views/templates/widget-topmenu.html index 8b8ff57b..ceb56f2f 100644 --- a/views/templates/widget-topmenu.html +++ b/views/templates/widget-topmenu.html @@ -17,7 +17,7 @@
  • {{ d.label }}
  • {% endif %} {% endfor %} - + {# logout.js will attach a click function on that button, which then retrieves the 'username' attribute #} {% if username %} Logged in as {{ username }}