Move sock JS code into its own file.
This commit is contained in:
@@ -94,9 +94,6 @@ domReady(function() {
|
||||
// tender feedback window scrolling
|
||||
$('a.show-tender').bind('click', smoothScrollTop);
|
||||
|
||||
// toggling footer additional support
|
||||
$('.cta-show-sock').bind('click', toggleSock);
|
||||
|
||||
// toggling overview section details
|
||||
$(function() {
|
||||
if ($('.courseware-section').length > 0) {
|
||||
@@ -423,31 +420,6 @@ function hideModal(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSock(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btnLabel = $(this).find('.copy');
|
||||
var $sock = $('.wrapper-sock');
|
||||
var $sockContent = $sock.find('.wrapper-inner');
|
||||
|
||||
$sock.toggleClass('is-shown');
|
||||
$sockContent.toggle('fast');
|
||||
|
||||
$.smoothScroll({
|
||||
offset: -200,
|
||||
easing: 'swing',
|
||||
speed: 1000,
|
||||
scrollElement: null,
|
||||
scrollTarget: $sock
|
||||
});
|
||||
|
||||
if ($sock.hasClass('is-shown')) {
|
||||
$btnLabel.text(gettext('Hide Studio Help'));
|
||||
} else {
|
||||
$btnLabel.text(gettext('Looking for Help with Studio?'));
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSubmodules(e) {
|
||||
e.preventDefault();
|
||||
$(this).toggleClass('expand').toggleClass('collapse');
|
||||
|
||||
32
cms/static/js/sock.js
Normal file
32
cms/static/js/sock.js
Normal file
@@ -0,0 +1,32 @@
|
||||
require(["domReady", "jquery", "jquery.smoothScroll"],
|
||||
function (domReady, $) {
|
||||
var toggleSock = function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btnLabel = $(this).find('.copy');
|
||||
var $sock = $('.wrapper-sock');
|
||||
var $sockContent = $sock.find('.wrapper-inner');
|
||||
|
||||
$sock.toggleClass('is-shown');
|
||||
$sockContent.toggle('fast');
|
||||
|
||||
$.smoothScroll({
|
||||
offset: -200,
|
||||
easing: 'swing',
|
||||
speed: 1000,
|
||||
scrollElement: null,
|
||||
scrollTarget: $sock
|
||||
});
|
||||
|
||||
if ($sock.hasClass('is-shown')) {
|
||||
$btnLabel.text(gettext('Hide Studio Help'));
|
||||
} else {
|
||||
$btnLabel.text(gettext('Looking for Help with Studio?'));
|
||||
}
|
||||
};
|
||||
|
||||
domReady(function () {
|
||||
// toggling footer additional support
|
||||
$('.cta-show-sock').bind('click', toggleSock);
|
||||
});
|
||||
});
|
||||
@@ -200,6 +200,9 @@ require(['js/models/course'], function(Course) {
|
||||
<%block name="content"></%block>
|
||||
|
||||
% if user.is_authenticated():
|
||||
<script type="text/javascript">
|
||||
require(['js/sock']);
|
||||
</script>
|
||||
<%include file="widgets/sock.html" />
|
||||
% endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user