omments on logging out
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 20 Mar 2013 08:37:57 +0000 (09:37 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 20 Mar 2013 08:37:57 +0000 (09:37 +0100)
auth/js/logout.js
views/css/topmenu.css
views/templates/widget-topmenu.html

index 63bc197..1e140a9 100644 (file)
@@ -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); })
index 3d48182..0b9f14f 100644 (file)
@@ -7,5 +7,5 @@ body {
 div.topmenu { padding-top: 10px; }
 button#logout { 
     margin-left: 8px; 
-    margin-bottom: 8px; 
+    margin-bottom: 10px; 
 }
index 8b8ff57..ceb56f2 100644 (file)
@@ -17,7 +17,7 @@
          <li class='other'> <a href="{{ d.href }}"> {{ d.label }} </a> </li>
          {% endif %}
          {% endfor %}
-       </ul>
+       </ul> {# logout.js will attach a click function on that button, which then retrieves the 'username' attribute #}
        <span class="navbar-text pull-right"> {% if username %} Logged in as {{ username }}<button id='logout' class='btn btn-danger' username='{{ username }}'>Logout</a>
 {% else %}Not logged in{% endif %}</span>
       </div><!--nav-collapse-->