STUD-1856 Display "IS VISIBLE TO" when released and published Reword staff lock prompt and notifications Change "View Published Version" to "View Live Version" Change "Unit Tree Location" to "Unit Location in Course" Switch live content warning based on unpublished changes Reword discard changes confirmation prompt Reword unit location tip Add "Edit the name" popup text for sections and subsections Fix popup text for section and subsection titles Add popup text for new section, subsection, and unit buttons Reword popup for View Live button and add tests Reword notification when removing staff lock Update MessageView when has_changes changed Change "Published" to "Published (not yet released)" Change "Unpublished (Staff only)" to "Visible to Staff Only"
113 lines
3.4 KiB
JavaScript
113 lines
3.4 KiB
JavaScript
require(["domReady", "jquery", "underscore", "gettext", "js/views/feedback_notification", "js/views/feedback_prompt",
|
|
"js/utils/date_utils", "js/utils/module", "js/utils/handle_iframe_binding",
|
|
"jquery.ui", "jquery.leanModal", "jquery.form", "jquery.smoothScroll"],
|
|
function(domReady, $, _, gettext, NotificationView, PromptView, DateUtils, ModuleUtils, IframeUtils)
|
|
{
|
|
|
|
var $body;
|
|
|
|
domReady(function() {
|
|
$body = $('body');
|
|
|
|
$body.on('click', '.embeddable-xml-input', function() {
|
|
$(this).select();
|
|
});
|
|
|
|
$body.addClass('js');
|
|
|
|
// lean/simple modal
|
|
$('a[rel*=modal]').leanModal({
|
|
overlay: 0.80,
|
|
closeButton: '.action-modal-close'
|
|
});
|
|
$('a.action-modal-close').click(function(e) {
|
|
(e).preventDefault();
|
|
});
|
|
|
|
// alerts/notifications - manual close
|
|
$('.action-alert-close, .alert.has-actions .nav-actions a').bind('click', hideAlert);
|
|
$('.action-notification-close').bind('click', hideNotification);
|
|
|
|
// nav - dropdown related
|
|
$body.click(function(e) {
|
|
$('.nav-dd .nav-item .wrapper-nav-sub').removeClass('is-shown');
|
|
$('.nav-dd .nav-item .title').removeClass('is-selected');
|
|
});
|
|
|
|
$('.nav-dd .nav-item').click(function(e) {
|
|
|
|
$subnav = $(this).find('.wrapper-nav-sub');
|
|
$title = $(this).find('.title');
|
|
|
|
if ($subnav.hasClass('is-shown')) {
|
|
$subnav.removeClass('is-shown');
|
|
$title.removeClass('is-selected');
|
|
} else {
|
|
$('.nav-dd .nav-item .title').removeClass('is-selected');
|
|
$('.nav-dd .nav-item .wrapper-nav-sub').removeClass('is-shown');
|
|
$title.addClass('is-selected');
|
|
$subnav.addClass('is-shown');
|
|
// if propagation is not stopped, the event will bubble up to the
|
|
// body element, which will close the dropdown.
|
|
e.stopPropagation();
|
|
}
|
|
});
|
|
|
|
// general link management - new window/tab
|
|
$('a[rel="external"]:not([title])').attr('title', gettext('This link will open in a new browser window/tab'));
|
|
$('a[rel="external"]').attr('target', '_blank');
|
|
|
|
// general link management - lean modal window
|
|
$('a[rel="modal"]').attr('title', gettext('This link will open in a modal window')).leanModal({
|
|
overlay: 0.50,
|
|
closeButton: '.action-modal-close'
|
|
});
|
|
$('.action-modal-close').click(function(e) {
|
|
(e).preventDefault();
|
|
});
|
|
|
|
// general link management - smooth scrolling page links
|
|
$('a[rel*="view"][href^="#"]').bind('click', smoothScrollLink);
|
|
|
|
// tender feedback window scrolling
|
|
$('a.show-tender').bind('click', smoothScrollTop);
|
|
|
|
IframeUtils.iframeBinding();
|
|
});
|
|
|
|
function smoothScrollLink(e) {
|
|
(e).preventDefault();
|
|
|
|
$.smoothScroll({
|
|
offset: -200,
|
|
easing: 'swing',
|
|
speed: 1000,
|
|
scrollElement: null,
|
|
scrollTarget: $(this).attr('href')
|
|
});
|
|
}
|
|
|
|
function smoothScrollTop(e) {
|
|
(e).preventDefault();
|
|
|
|
$.smoothScroll({
|
|
offset: -200,
|
|
easing: 'swing',
|
|
speed: 1000,
|
|
scrollElement: null,
|
|
scrollTarget: $('#view-top')
|
|
});
|
|
}
|
|
|
|
function hideNotification(e) {
|
|
(e).preventDefault();
|
|
$(this).closest('.wrapper-notification').removeClass('is-shown').addClass('is-hiding').attr('aria-hidden', 'true');
|
|
}
|
|
|
|
function hideAlert(e) {
|
|
(e).preventDefault();
|
|
$(this).closest('.wrapper-alert').removeClass('is-shown');
|
|
}
|
|
|
|
}); // end require()
|