From 96a59721af48d73df6e504807378c52fa1750743 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 20 Mar 2013 09:33:50 +0100 Subject: [PATCH] nicer and simpler logout --- auth/js/logout.js | 6 ++++++ auth/templates/widget-logout.html | 3 --- auth/views.py | 7 ------- myslice/urls.py | 1 - trash/templates/view-tab.html | 6 ++++++ unfold/js/unfold-helper.js | 2 +- views/css/topmenu.css | 6 ++++-- views/templates/view-logout.html | 6 ------ views/templates/widget-topmenu.html | 11 ++++------- 9 files changed, 21 insertions(+), 27 deletions(-) create mode 100644 auth/js/logout.js delete mode 100644 auth/templates/widget-logout.html delete mode 100644 views/templates/view-logout.html diff --git a/auth/js/logout.js b/auth/js/logout.js new file mode 100644 index 00000000..63bc197b --- /dev/null +++ b/auth/js/logout.js @@ -0,0 +1,6 @@ +function logout () { + var username=$(this).attr('username'); + var msg="Are you sure you want to logout as " + username + " ?"; + if (confirm(msg)) window.location="/logout/"; +} +$(document).ready(function() { $('#logout').click(logout); }) diff --git a/auth/templates/widget-logout.html b/auth/templates/widget-logout.html deleted file mode 100644 index 28e91bc2..00000000 --- a/auth/templates/widget-logout.html +++ /dev/null @@ -1,3 +0,0 @@ -{% insert_str prelude "css/logout.css" %} -

xxx This needs a bit of ironing out

-Confirm logout diff --git a/auth/views.py b/auth/views.py index 6490ef59..c26bc1d0 100644 --- a/auth/views.py +++ b/auth/views.py @@ -44,13 +44,6 @@ def login_user(request): # hard question : where should we redirect requests to logout if user is not logged in ? def logout_user (request): - # xxx check that we're indeed logged in - if not request.user.is_authenticated(): - return HttpResponseRedirect ('/') - return render_to_response('view-logout.html',{'username':the_user(request)}, - context_instance=RequestContext(request)) - -def do_logout_user (request): # xxx check that we're indeed logged in if not request.user.is_authenticated(): return HttpResponseRedirect ('/') diff --git a/myslice/urls.py b/myslice/urls.py index 669961fd..5c185290 100644 --- a/myslice/urls.py +++ b/myslice/urls.py @@ -34,7 +34,6 @@ urlpatterns = patterns( (r'^accounts/login/$', 'auth.views.login_user'), (r'^login/?$', 'auth.views.login_user'), (r'^logout/?$', 'auth.views.logout_user'), - (r'^logout/confirm/?$', 'auth.views.do_logout_user'), # # the manifold proxy # diff --git a/trash/templates/view-tab.html b/trash/templates/view-tab.html index 94a541aa..1e48e5c1 100644 --- a/trash/templates/view-tab.html +++ b/trash/templates/view-tab.html @@ -30,6 +30,12 @@ $(function(){console.log('hey!');$('#tooltipid').tooltip({'selector':'','placeme a first attempt with tooltips +Let us now try to attach + +
{{ lorem }} Lorem ipsum dolor counter += 1 sit amet, consectetuer diff --git a/unfold/js/unfold-helper.js b/unfold/js/unfold-helper.js index 6d8e01c8..71c5111d 100644 --- a/unfold/js/unfold-helper.js +++ b/unfold/js/unfold-helper.js @@ -3,6 +3,6 @@ var unfold = { return ""; }, error : function(text){ - return ""; + return ""; }, } // global unfold diff --git a/views/css/topmenu.css b/views/css/topmenu.css index 79163862..3d481825 100644 --- a/views/css/topmenu.css +++ b/views/css/topmenu.css @@ -4,6 +4,8 @@ body { padding-bottom: 20px; } -div.topmenu { - padding-top: 10px; +div.topmenu { padding-top: 10px; } +button#logout { + margin-left: 8px; + margin-bottom: 8px; } diff --git a/views/templates/view-logout.html b/views/templates/view-logout.html deleted file mode 100644 index 16b3cf45..00000000 --- a/views/templates/view-logout.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends 'layout-unfold1.html' %} - -{% block unfold1_main %} -{% include 'widget-logout.html' %} -{% endblock %} - diff --git a/views/templates/widget-topmenu.html b/views/templates/widget-topmenu.html index 97249f07..8b8ff57b 100644 --- a/views/templates/widget-topmenu.html +++ b/views/templates/widget-topmenu.html @@ -2,8 +2,9 @@ {% insert_str prelude "js/bootstrap.js" %} {% insert_str prelude "css/bootstrap.css" %} {% insert_str prelude "css/topmenu.css" %} +{% insert_str prelude "js/logout.js" %} -