Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a45fe4a6
Commit
a45fe4a6
authored
Sep 24, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #759 from MITx/feature/victor/fix-index-js-caching
Fix login-if-?next behavior
parents
93ca4a41
0b40e751
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
9 deletions
+42
-9
common/djangoapps/student/views.py
+4
-2
lms/static/js/query-params.js
+9
-0
lms/templates/index.html
+16
-7
lms/templates/university_profile/base.html
+13
-0
No files found.
common/djangoapps/student/views.py
View file @
a45fe4a6
...
...
@@ -52,6 +52,10 @@ def csrf_token(context):
' 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
):
'''
Render the edX main page.
...
...
@@ -82,8 +86,6 @@ 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
):
...
...
lms/static/js/query-params.js
0 → 100644
View file @
a45fe4a6
// 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
;
}
lms/templates/index.html
View file @
a45fe4a6
...
...
@@ -145,12 +145,22 @@
</div>
</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:
## 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"
>
$
(
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"
);});
$
(
window
).
load
(
function
()
{
$
(
'#signup_action'
).
trigger
(
"click"
);});
</script>
% endif
\ No newline at end of file
% endif
lms/templates/university_profile/base.html
View file @
a45fe4a6
...
...
@@ -14,4 +14,17 @@
<
%
block
name=
"university_description"
/>
</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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment