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
01f8c4c8
Commit
01f8c4c8
authored
Apr 30, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding iframe view
example:
http://localhost:8000/courses/HarvardX/CB22x/2013_Spring/mktg-about
parent
01e15c1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
1 deletions
+123
-1
lms/djangoapps/courseware/views.py
+20
-0
lms/templates/courseware/mktg_course_about.html
+98
-0
lms/urls.py
+5
-1
No files found.
lms/djangoapps/courseware/views.py
View file @
01f8c4c8
...
...
@@ -518,6 +518,26 @@ def course_about(request, course_id):
'registered'
:
registered
,
'course_target'
:
course_target
,
'show_courseware_link'
:
show_courseware_link
})
@ensure_csrf_cookie
@cache_if_anonymous
def
mktg_course_about
(
request
,
course_id
):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'see_exists'
)
registered
=
registered_for_course
(
course
,
request
.
user
)
if
has_access
(
request
.
user
,
course
,
'load'
):
course_target
=
reverse
(
'info'
,
args
=
[
course
.
id
])
else
:
course_target
=
reverse
(
'about_course'
,
args
=
[
course
.
id
])
show_courseware_link
=
(
has_access
(
request
.
user
,
course
,
'load'
)
or
settings
.
MITX_FEATURES
.
get
(
'ENABLE_LMS_MIGRATION'
))
return
render_to_response
(
'courseware/mktg_course_about.html'
,
{
'course'
:
course
,
'registered'
:
registered
,
'course_target'
:
course_target
,
'show_courseware_link'
:
show_courseware_link
})
@ensure_csrf_cookie
...
...
lms/templates/courseware/mktg_course_about.html
0 → 100644
View file @
01f8c4c8
<
%!
from
django
.
core
.
urlresolvers
import
reverse
from
courseware
.
courses
import
course_image_url
,
get_course_about_section
from
courseware
.
access
import
has_access
%
>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
inherit
file=
"../mktg_iframe.html"
/>
<
%
block
name=
"headextra"
>
<
%
include
file=
"../google_analytics.html"
/>
</
%
block>
<
%
block
name=
"js_extra"
>
% if not registered:
%if user.is_authenticated():
## If the user is authenticated, clicking the enroll button just submits a form
<script
type=
"text/javascript"
>
(
function
()
{
$
(
".register"
).
click
(
function
()
{
$
(
"#class_enroll_form"
).
submit
();
});
$
(
document
).
delegate
(
'#class_enroll_form'
,
'ajax:success'
,
function
(
data
,
json
,
xhr
)
{
if
(
json
.
success
)
{
location
.
href
=
"${reverse('dashboard')}"
;
}
else
{
$
(
'#register_message'
).
html
(
'<p class="inline-error">'
+
json
.
error
+
"</p>"
);
}
});
})(
this
)
</script>
%else:
## If the user is not authenticated, clicking the enroll button pops up the register
## field. We also slip in the registration fields into the login/register fields so
## the user is automatically registered after logging in / registering
<script
type=
"text/javascript"
>
(
function
()
{
$
(
".register"
).
click
(
function
()
{
if
(
$
(
".login_form .enroll_fieldset"
).
length
===
0
)
{
$
(
".login_form"
).
append
(
$
(
".enroll_fieldset"
).
first
().
clone
()
);
}
if
(
$
(
".register_form .enroll_fieldset"
).
length
===
0
)
{
$
(
".register_form"
).
append
(
$
(
".enroll_fieldset"
).
first
().
clone
()
);
}
});
})(
this
)
</script>
%endif
%endif
<script
src=
"${static.url('js/course_info.js')}"
></script>
</
%
block>
<
%
block
name=
"title"
><title>
About ${course.number}
</title></
%
block>
<section
class=
"course-info"
>
<header
class=
"course-profile"
>
<div
class=
"intro-inner-wrapper"
>
<div
class=
"main-cta"
>
%if user.is_authenticated():
%if registered:
%if show_courseware_link:
<a
href=
"${course_target}"
>
%endif
<span
class=
"register disabled"
>
You are registered for this course (${course.number})
</span>
%if show_courseware_link:
<strong>
View Courseware
</strong>
</a>
%endif
%else:
<a
href=
"#"
class=
"register"
>
Register for ${course.number}
</a>
<div
id=
"register_message"
></div>
%endif
%else:
<a
href=
"/login"
class=
"register"
>
Register for ${course.number}
</a>
%endif
</div>
</header>
</section>
%if not registered:
<div
style=
"display: none;"
>
<form
id=
"class_enroll_form"
method=
"post"
data-remote=
"true"
action=
"${reverse('change_enrollment')}"
>
<fieldset
class=
"enroll_fieldset"
>
<input
name=
"course_id"
type=
"hidden"
value=
"${course.id}"
>
<input
name=
"enrollment_action"
type=
"hidden"
value=
"enroll"
>
</fieldset>
<div
class=
"submit"
>
<input
name=
"submit"
type=
"submit"
value=
"enroll"
>
</div>
</form>
</div>
%endif
lms/urls.py
View file @
01f8c4c8
...
...
@@ -239,7 +239,11 @@ if settings.COURSEWARE_ENABLED:
#About the course
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/about$'
,
'courseware.views.course_about'
,
name
=
"about_course"
),
'courseware.views.mktg_course_about'
,
name
=
"about_course"
),
#View for mktg site
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/mktg-about$'
,
'courseware.views.mktg_course_about'
,
name
=
"mktg_about_course"
),
#Inside the course
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/$'
,
...
...
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