From 4e3e2ec707ff409ec8a2fb4a332cfc19a744a28e Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 13 Feb 2013 11:20:08 -0500 Subject: [PATCH 1/3] If user was trying to get to a specific page but had to log in, let them get to that page once they've logged in. --- cms/templates/login.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cms/templates/login.html b/cms/templates/login.html index 7a32b735cb..94fd0f4d95 100644 --- a/cms/templates/login.html +++ b/cms/templates/login.html @@ -77,7 +77,11 @@ submit_data, function(json) { if(json.success) { - location.href = "${reverse('homepage')}"; + var next = /next=([^&]*)/g.exec(decodeURIComponent(window.location.search)); + if (next.length > 1) { + location.href = next[1]; + } + else location.href = "${reverse('homepage')}"; } else if($('#login_error').length == 0) { $('#login_form').prepend('
' + json.value + '
'); $('#login_error').addClass('is-shown'); From f7e635a7cd786b3a5f0e738cba52f17a27d441ff Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 13 Feb 2013 11:22:35 -0500 Subject: [PATCH 2/3] fix npe w/ prev commit --- cms/templates/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/templates/login.html b/cms/templates/login.html index 94fd0f4d95..072e6b9e9b 100644 --- a/cms/templates/login.html +++ b/cms/templates/login.html @@ -78,7 +78,7 @@ function(json) { if(json.success) { var next = /next=([^&]*)/g.exec(decodeURIComponent(window.location.search)); - if (next.length > 1) { + if (next && next.length > 1) { location.href = next[1]; } else location.href = "${reverse('homepage')}"; From 6e5968e2cd1f2225379700fe88a81cf98a3764c6 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 13 Feb 2013 11:53:26 -0500 Subject: [PATCH 3/3] html changed; so, removed mostly meaningless comparison and fixed one. --- cms/djangoapps/contentstore/tests/test_contentstore.py | 2 +- cms/djangoapps/contentstore/tests/test_course_settings.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index dcd1f408cd..b3bdf4554d 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -367,7 +367,7 @@ class ContentStoreTest(ModuleStoreTestCase): resp = self.client.get(reverse('course_index', kwargs=data)) self.assertContains(resp, - 'Robot Super Course', + '
', status_code=200, html=True) diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index 84e79b9670..05a86bf46b 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -143,10 +143,6 @@ class CourseDetailsViewTest(CourseTestCase): def test_update_and_fetch(self): details = CourseDetails.fetch(self.course_location) - resp = self.client.get(reverse('course_settings', kwargs={'org': self.course_location.org, 'course': self.course_location.course, - 'name': self.course_location.name})) - self.assertContains(resp, '
  • Course Details
  • ', status_code=200, html=True) - # resp s/b json from here on url = reverse('course_settings', kwargs={'org': self.course_location.org, 'course': self.course_location.course, 'name': self.course_location.name, 'section': 'details'})