Merge pull request #691 from MITx/feature/victor/anon-deep-links
Feature/victor/anon deep links
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -147,28 +147,10 @@
|
||||
|
||||
% if show_signup_immediately is not UNDEFINED:
|
||||
<script type="text/javascript">
|
||||
function dosignup(){
|
||||
comp = document.getElementById('signup_action');
|
||||
try { //in firefox
|
||||
comp.click();
|
||||
return;
|
||||
} catch(ex) {}
|
||||
try { // in old chrome
|
||||
if(document.createEvent) {
|
||||
var e = document.createEvent('MouseEvents');
|
||||
e.initEvent( 'click', true, true );
|
||||
comp.dispatchEvent(e);
|
||||
return;
|
||||
}
|
||||
} catch(ex) {}
|
||||
try { // in IE, safari
|
||||
if(document.createEventObject) {
|
||||
var evObj = document.createEventObject();
|
||||
comp.fireEvent("onclick", evObj);
|
||||
return;
|
||||
}
|
||||
} catch(ex) {}
|
||||
}
|
||||
$(window).load(dosignup);
|
||||
$(window).load(function() {$('#signup_action').trigger("click");});
|
||||
</script>
|
||||
% endif
|
||||
% elif show_login_immediately is not UNDEFINED:
|
||||
<script type="text/javascript">
|
||||
$(window).load(function() {$('#login').trigger("click");});
|
||||
</script>
|
||||
% endif
|
||||
@@ -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('<div id="login_error" class="modal-form-error"></div>');
|
||||
|
||||
Reference in New Issue
Block a user