Merge pull request #1950 from edx/jarv/drupal-new/iframe
Jarv/drupal new/iframe
This commit is contained in:
@@ -531,6 +531,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
|
||||
|
||||
85
lms/static/sass/_shame.scss
Normal file
85
lms/static/sass/_shame.scss
Normal file
@@ -0,0 +1,85 @@
|
||||
// edX LMS - shame
|
||||
// shame file - used for any bad-form/orphaned scss that knowingly violate edX FED architecture/standards (see - http://csswizardry.com/2013/04/shame-css/)
|
||||
// ====================
|
||||
|
||||
// marketing site - registration iframe band-aid (poor form enough to isolate out)
|
||||
.view-partial-mktgregister {
|
||||
background: transparent;
|
||||
|
||||
// dimensions needed for course about page on marketing site
|
||||
.wrapper-view {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// button elements - not a better place to put these, sadly
|
||||
.btn {
|
||||
display: block;
|
||||
padding: $baseline/2 $baseline*2.5;
|
||||
text-transform: lowercase;
|
||||
color: $white !important;
|
||||
letter-spacing: 0.1rem;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
border: none !important;
|
||||
text-shadow: none;
|
||||
letter-spacing: 0.1rem;
|
||||
font-size: 17px;
|
||||
font-weight: 300;
|
||||
box-shadow: 0 !important;
|
||||
|
||||
strong {
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@extend .btn;
|
||||
@include linear-gradient($m-blue-s1 5%, $m-blue-d1 95%);
|
||||
|
||||
// no hover state conventions to follow from marketing :/
|
||||
&:hover, &:active {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
@extend .btn;
|
||||
@include linear-gradient($m-gray 5%, $m-gray-d1 95%);
|
||||
|
||||
// no hover state conventions to follow from marketing :/
|
||||
&:hover, &:active {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// nav list
|
||||
.list-actions {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.item {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// register actions
|
||||
.action {
|
||||
|
||||
}
|
||||
|
||||
// not registered (default)
|
||||
.action-register {
|
||||
@extend .btn-primary;
|
||||
}
|
||||
|
||||
// not signed in
|
||||
.is-not-signedin {
|
||||
@extend .btn-primary;
|
||||
}
|
||||
|
||||
// already registered
|
||||
.is-registered {
|
||||
@extend .btn-secondary;
|
||||
}
|
||||
}
|
||||
@@ -34,3 +34,5 @@
|
||||
|
||||
@import 'discussion';
|
||||
@import 'news';
|
||||
|
||||
@import 'shame';
|
||||
|
||||
@@ -204,5 +204,4 @@
|
||||
</div>
|
||||
%endif
|
||||
|
||||
|
||||
<%include file="../video_modal.html" />
|
||||
|
||||
98
lms/templates/courseware/mktg_course_about.html
Normal file
98
lms/templates/courseware/mktg_course_about.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<%!
|
||||
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="title"><title>About ${course.number}</title></%block>
|
||||
|
||||
<%block name="bodyclass">view-partial-mktgregister</%block>
|
||||
|
||||
|
||||
<%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(e) {
|
||||
(e).preventDefault();
|
||||
$('#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
|
||||
</%block>
|
||||
|
||||
<%block name="content">
|
||||
|
||||
<script src="${static.url('js/course_info.js')}"></script>
|
||||
|
||||
|
||||
<ul class="list-actions register">
|
||||
<li class="item">
|
||||
%if user.is_authenticated():
|
||||
%if registered:
|
||||
<!-- signed in, registered -->
|
||||
<a class="action action-register is-registered" href="${course_target}">Registered for <strong>${course.number}</strong></a>
|
||||
%else:
|
||||
<!-- signed in, not registered -->
|
||||
<a href="" class="action action-register register">Register for ${course.number}</a> <div id="register_message"></div>
|
||||
%endif
|
||||
%else:
|
||||
<!-- not signed in -->
|
||||
<a class="action action-register is-not-signedin" href="${reverse('register_user')}">Register for <strong>${course.number}</strong></a>
|
||||
%endif
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
%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">
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
|
||||
</fieldset>
|
||||
<div class="submit">
|
||||
|
||||
<button type="submit" name="class_enroll_form_submit" id="class_enroll_form-submit" value="enroll">Enroll</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
%endif
|
||||
</%block>
|
||||
@@ -3,6 +3,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<%block name="title"><title>edX</title></%block>
|
||||
<script type="text/javascript">
|
||||
/* immediately break out of an iframe if coming
|
||||
from the marketing website */
|
||||
(function(window) {
|
||||
if (window.location !== window.top.location) {
|
||||
window.top.location = window.location;
|
||||
}
|
||||
})(this);
|
||||
</script>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="${static.url('images/favicon.ico')}" />
|
||||
|
||||
|
||||
39
lms/templates/mktg_iframe.html
Normal file
39
lms/templates/mktg_iframe.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<%namespace name='static' file='static_content.html'/>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%block name="title"></%block>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="${static.url('images/favicon.ico')}" />
|
||||
<meta name="path_prefix" content="${MITX_ROOT_URL}" />
|
||||
<meta name="google-site-verification" content="_mipQ4AtZQDNmbtOkwehQDOgCxUUV2fb_C0b6wbiRHY" />
|
||||
|
||||
<%static:css group='application'/>
|
||||
<%static:js group='main_vendor'/>
|
||||
|
||||
<!--[if IE]>
|
||||
<script src="${static.url('js/html5shiv.js')}"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!--[if lte IE 9]>
|
||||
<%static:css group='ie-fixes'/>
|
||||
<![endif]-->
|
||||
|
||||
<%block name="headextra"/>
|
||||
|
||||
% if not course:
|
||||
<%include file="google_analytics.html" />
|
||||
% endif
|
||||
</head>
|
||||
|
||||
<body class="<%block name='bodyclass'></%block>">
|
||||
|
||||
<!-- view -->
|
||||
<div class="wrapper wrapper-view">
|
||||
|
||||
<%block name="content"></%block>
|
||||
</div>
|
||||
|
||||
<%block name="js_extra"></%block>
|
||||
</body>
|
||||
</html>
|
||||
@@ -185,6 +185,10 @@ if settings.COURSEWARE_ENABLED:
|
||||
#About the course
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/about$',
|
||||
'courseware.views.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>[^/]+/[^/]+/[^/]+)/$',
|
||||
|
||||
Reference in New Issue
Block a user