diff --git a/lms/templates/courseware.html b/lms/templates/courseware.html index 29178374fe5a41d1b042a156512113347c9b77b8..f6133860f45d403004b7e60540dc0585b192125f 100644 --- a/lms/templates/courseware.html +++ b/lms/templates/courseware.html @@ -3,7 +3,7 @@ <%block name="bodyclass">courseware</%block> <%block name="title"><title>Courseware – MITx 6.002x</title></%block> -<%block name="headextra"> +<%block name="js_extra"> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script> <link rel="stylesheet" href="${static.url('css/vendor/jquery.treeview.css')}" type="text/css" media="all" /> @@ -27,9 +27,7 @@ <%static:js group='courseware'/> <%include file="mathjax_include.html" /> -</%block> -<%block name="js_extra"> <!-- TODO: http://docs.jquery.com/Plugins/Validation --> <script type="text/javascript"> document.write('\x3Cscript type="text/javascript" src="' + diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 676b9587c616008a61836e19e2ce67fcf548a295..c0273ef70961977d23e9b64c041b2e28c16ba5ff 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -8,6 +8,30 @@ <%block name="title"><title>Dashboard</title></%block> +<%block name="js_extra"> + <script type="text/javascript"> + (function() { + + $(".unenroll").click(function(event) { + $("#unenroll_course_id").val( $(event.target).data("course-id") ); + $("#unenroll_course_number").text( $(event.target).data("course-number") ); + + }); + + $(document).delegate('#unenroll_form', 'ajax:success', function(data, json, xhr) { + if(json.success) { + location.href="${reverse('dashboard')}"; + } else { + if($('#unenroll_error').length == 0) { + $('#unenroll_form').prepend('<div id="unenroll_error" class="modal-form-error"></div>'); + } + $('#unenroll_error').text(json.error).stop().css("display", "block"); + } + }); + })(this) + </script> +</%block> + <section class="container dashboard"> <section class="dashboard-banner"> @@ -110,25 +134,3 @@ </section> -<script type="text/javascript"> -(function() { - - $(".unenroll").click(function(event) { - $("#unenroll_course_id").val( $(event.target).data("course-id") ); - $("#unenroll_course_number").text( $(event.target).data("course-number") ); - - }); - - $(document).delegate('#unenroll_form', 'ajax:success', function(data, json, xhr) { - if(json.success) { - location.href="${reverse('dashboard')}"; - } else { - if($('#unenroll_error').length == 0) { - $('#unenroll_form').prepend('<div id="unenroll_error" class="modal-form-error"></div>'); - } - $('#unenroll_error').text(json.error).stop().css("display", "block"); - } - }); -})(this) -</script> - diff --git a/lms/templates/gradebook.html b/lms/templates/gradebook.html index 12f820c8c90062574c33f3e8a639046ae5fe07a2..7c2908dc777cc00ba33012388933e3f41ab746bd 100644 --- a/lms/templates/gradebook.html +++ b/lms/templates/gradebook.html @@ -1,10 +1,13 @@ <%inherit file="main.html" /> <%namespace name='static' file='static_content.html'/> -<%block name="headextra"> +<%block name="js_extra"> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.stack.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.symbol.js')}"></script> +</%block> + +<%block name="headextra"> <style type="text/css"> .grade_a {color:green;} diff --git a/lms/templates/gradebook_profilegraphs.html b/lms/templates/gradebook_profilegraphs.html index 137c994bad51cdc4621ec613f1a0ba789f5bd51c..18995cbb4c46623c1498d32620916f4ab099bf13 100644 --- a/lms/templates/gradebook_profilegraphs.html +++ b/lms/templates/gradebook_profilegraphs.html @@ -2,7 +2,7 @@ <%namespace name='static' file='static_content.html'/> <%namespace name="profile_graphs" file="profile_graphs.js"/> -<%block name="headextra"> +<%block name="js_extra"> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.stack.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.symbol.js')}"></script> diff --git a/lms/templates/main.html b/lms/templates/main.html index b8bac37dd24cd40206f25ee201071c613b5b4702..5f7677003235ff0f503e195e6dc416e24e4b3c70 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -8,19 +8,12 @@ <link href='http://fonts.googleapis.com/css?family=Open+Sans:800italic,400,800' rel='stylesheet' type='text/css'> - <%static:css group='application'/> + <%static:css group='application'/> <!--[if lt IE 9]> <%static:css group='ie-fixes'/> <![endif]--> - - <%static:js group='main_vendor'/> - <%static:js group='application'/> - - <!--[if lt IE 9]> - <script src="${static.url('js/html5shiv.js')}"></script> - <![endif]--> - - <%block name="headextra"/> + <%static:js group='main_vendor'/> + <%block name="headextra"/> <meta name="path_prefix" content="${MITX_ROOT_URL}"> </head> @@ -33,6 +26,13 @@ <%block name="bodyextra"/> <%include file="footer.html" /> + + <%static:js group='application'/> + + <!--[if lt IE 9]> + <script src="${static.url('js/html5shiv.js')}"></script> + <![endif]--> + <%block name="js_extra"/> <script src="${static.url('js/my_courses_dropdown.js')}"></script> <script src="${static.url('js/toggle_login_modal.js')}"></script> diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 3a33723949e190adf6e6c37534237fafbeaa4c58..0c6958c16ce0f4239d5a3d629823603e2d0010ca 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -3,12 +3,48 @@ from courseware.courses import course_image_url, get_course_about_section %> <%namespace name='static' file='../static_content.html'/> + +<%inherit file="../main.html" /> + <%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')}"; + } + }); + })(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> -<%inherit file="../main.html" /> - <%block name="title"><title>About ${course.number}</title></%block> @@ -119,38 +155,6 @@ </div> </form> </div> - %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')}"; - } - }); - })(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 diff --git a/lms/templates/profile.html b/lms/templates/profile.html index c45961fc6dee95774c2b3367803bf36f1d12e070..2d54cddb1334a4f56d89f625e023b7b2428a4293 100644 --- a/lms/templates/profile.html +++ b/lms/templates/profile.html @@ -8,7 +8,7 @@ from django.core.urlresolvers import reverse %> -<%block name="headextra"> +<%block name="js_extra"> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.stack.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.symbol.js')}"></script> diff --git a/lms/templates/simplewiki/simplewiki_base.html b/lms/templates/simplewiki/simplewiki_base.html index b70dab9f40622efbc4d6ca6bbfc369ce8adf4ad0..37f6afc75ac184b14c913d341902f91e36bdfa1a 100644 --- a/lms/templates/simplewiki/simplewiki_base.html +++ b/lms/templates/simplewiki/simplewiki_base.html @@ -8,7 +8,7 @@ from simplewiki.views import wiki_reverse %> -<%block name="headextra"> +<%block name="js_extra"> <script type="text/javascript" src="${static.url('js/simplewiki-AutoSuggest_c_2.0.js')}"></script> ## TODO (cpennington): Remove this when we have a good way for modules to specify js to load on the page