From 6472e0ebe338584dd83959df0c27fd70d73159d8 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Fri, 14 Sep 2012 14:29:31 -0400 Subject: [PATCH 1/2] If there's a ?next param, redirect there instead of dashboard after login --- lms/templates/login_modal.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lms/templates/login_modal.html b/lms/templates/login_modal.html index d7d327178c..0b19399fc0 100644 --- a/lms/templates/login_modal.html +++ b/lms/templates/login_modal.html @@ -46,7 +46,11 @@ (function() { $(document).delegate('#login_form', 'ajax:success', function(data, json, xhr) { if(json.success) { - location.href="${reverse('dashboard')}"; + % if request.REQUEST.get('next', False): + location.href="${request.REQUEST.get('next')}"; + % else: + location.href="${reverse('dashboard')}"; + % endif } else { if($('#login_error').length == 0) { $('#login_form').prepend(''); From a788db53e90de9475dfa889ee883ac4f04a257e0 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Fri, 14 Sep 2012 14:31:04 -0400 Subject: [PATCH 2/2] Show login modal if there's a next param to index, university index * also replace the external-auth-related popping up of the signup form with jquery. Presumably it takes care of the browser specific stuff. --- common/djangoapps/student/views.py | 2 ++ lms/djangoapps/courseware/views.py | 3 +++ lms/templates/index.html | 30 ++++++------------------------ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index cbb12e44cc..a70349bec3 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -82,6 +82,8 @@ def index(request, extra_context={}, user=None): domain=domain) context = {'universities': universities, 'entries': entries} context.update(extra_context) + if request.REQUEST.get('next', False): + context['show_login_immediately'] = True return render_to_response('index.html', context) def course_from_id(course_id): diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index c474da8d8b..7da5d06741 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -404,6 +404,9 @@ def university_profile(request, org_id): context = dict(courses=courses, org_id=org_id) template_file = "university_profile/{0}.html".format(org_id).lower() + if request.REQUEST.get('next', False): + context['show_login_immediately'] = True + return render_to_response(template_file, context) def render_notifications(request, course, notifications): diff --git a/lms/templates/index.html b/lms/templates/index.html index 0ee00b57c0..8cabe62f09 100644 --- a/lms/templates/index.html +++ b/lms/templates/index.html @@ -147,28 +147,10 @@ % if show_signup_immediately is not UNDEFINED: -% endif +% elif show_login_immediately is not UNDEFINED: + +% endif \ No newline at end of file