Commit 0b40e751 by Victor Shnayder
parent d9946cc3
...@@ -52,6 +52,10 @@ def csrf_token(context): ...@@ -52,6 +52,10 @@ def csrf_token(context):
' name="csrfmiddlewaretoken" value="%s" /></div>' % (csrf_token)) ' name="csrfmiddlewaretoken" value="%s" /></div>' % (csrf_token))
# NOTE: This view is not linked to directly--it is called from
# branding/views.py:index(), which is cached for anonymous users.
# This means that it should always return the same thing for anon
# users. (in particular, no switching based on query params allowed)
def index(request, extra_context={}, user=None): def index(request, extra_context={}, user=None):
''' '''
Render the edX main page. Render the edX main page.
...@@ -82,8 +86,6 @@ def index(request, extra_context={}, user=None): ...@@ -82,8 +86,6 @@ def index(request, extra_context={}, user=None):
domain=domain) domain=domain)
context = {'universities': universities, 'entries': entries} context = {'universities': universities, 'entries': entries}
context.update(extra_context) context.update(extra_context)
if request.REQUEST.get('next', False):
context['show_login_immediately'] = True
return render_to_response('index.html', context) return render_to_response('index.html', context)
def course_from_id(course_id): def course_from_id(course_id):
......
// http://james.padolsey.com/javascript/bujs-1-getparameterbyname/
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)')
.exec(window.location.search);
return match ?
decodeURIComponent(match[1].replace(/\+/g, ' '))
: null;
}
...@@ -145,12 +145,22 @@ ...@@ -145,12 +145,22 @@
</div> </div>
</section> </section>
<%block name="js_extra">
<script type="text/javascript" src="${static.url('js/query-params.js')}"></script>
<script type="text/javascript"">
$(window).load(function() {
if(getParameterByName('next')) {
$('#login').trigger("click");
}
})
</script>
</%block>
% if show_signup_immediately is not UNDEFINED: % if show_signup_immediately is not UNDEFINED:
## NOTE: This won't work in production, because anonymous views are cached, so it will
## show either with or without this extra js for 3 minutes at a time.
<script type="text/javascript"> <script type="text/javascript">
$(window).load(function() {$('#signup_action').trigger("click");}); $(window).load(function() {$('#signup_action').trigger("click");});
</script>
% elif show_login_immediately is not UNDEFINED:
<script type="text/javascript">
$(window).load(function() {$('#login').trigger("click");});
</script> </script>
% endif % endif
\ No newline at end of file
...@@ -14,4 +14,17 @@ ...@@ -14,4 +14,17 @@
<%block name="university_description" /> <%block name="university_description" />
</section> </section>
</section> </section>
<%block name="js_extra">
<script type="text/javascript" src="${static.url('js/query-params.js')}"></script>
<script type="text/javascript"">
$(window).load(function() {
if(getParameterByName('next')) {
$('#login').trigger("click");
}
})
</script>
</%block>
</section> </section>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment