Skip to content
Snippets Groups Projects
Commit dbb011a1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #818 from greezybacon/issue/more-pjax-stuff


pjax: Fix a few more small issues

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 17cbb7d5 660e1621
Branches
Tags
No related merge requests found
...@@ -280,8 +280,13 @@ $(function() { ...@@ -280,8 +280,13 @@ $(function() {
// Make a rich text editor immediately // Make a rich text editor immediately
redact(el); redact(el);
}); });
},
cleanupRedactorElements = function() {
// Drop the added redactor_air bars
$('.redactor_air').remove();
}; };
findRichtextBoxes(); findRichtextBoxes();
$(document).ajaxStop(findRichtextBoxes); $(document).ajaxStop(findRichtextBoxes);
$(document).on('pjax:success', findRichtextBoxes); $(document).on('pjax:success', findRichtextBoxes);
$(document).on('pjax:start', cleanupRedactorElements);
}); });
...@@ -140,7 +140,10 @@ var scp_prep = function() { ...@@ -140,7 +140,10 @@ var scp_prep = function() {
$('input[type=submit]', fObj).css('color', 'red'); $('input[type=submit]', fObj).css('color', 'red');
$(window).bind('beforeunload', function(e) { $(window).bind('beforeunload', function(e) {
return 'Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!'; return 'Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!';
}); });
$(document).on('pjax:beforeSend.changed', function(e) {
return confirm('Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!');
});
} }
}; };
...@@ -639,10 +642,6 @@ $(document).on('pjax:start', function() { ...@@ -639,10 +642,6 @@ $(document).on('pjax:start', function() {
window.clearTimeout(id); window.clearTimeout(id);
} }
// Close popups
// Close tooltips
$('.dialog, .tip_box').empty().hide();
if ($("#loadingbar").length === 0) { if ($("#loadingbar").length === 0) {
$("body").append("<div id='loadingbar'></div>"); $("body").append("<div id='loadingbar'></div>");
$("#loadingbar").addClass("waiting").append($("<dt/><dd/>")); $("#loadingbar").addClass("waiting").append($("<dt/><dd/>"));
...@@ -651,6 +650,10 @@ $(document).on('pjax:start', function() { ...@@ -651,6 +650,10 @@ $(document).on('pjax:start', function() {
$("#loadingbar").width((50 + Math.random() * 30) + "%"); $("#loadingbar").width((50 + Math.random() * 30) + "%");
$('#overlay').css('background-color','white').fadeIn(); $('#overlay').css('background-color','white').fadeIn();
} }
// Cancel save-changes warning banner
$(document).unbind('pjax:beforeSend.changed');
$(window).unbind('beforeunload');
}); });
$(document).on('pjax:end', function() { $(document).on('pjax:end', function() {
// right // right
...@@ -658,13 +661,11 @@ $(document).on('pjax:end', function() { ...@@ -658,13 +661,11 @@ $(document).on('pjax:end', function() {
$(this).remove(); $(this).remove();
}); });
$('#overlay').hide().removeAttr('style'); $('#overlay').hide().removeAttr('style');
});
$(document).on('click', 'a', function() { // Close popups
var ul = $(this).closest('ul'); // Close tooltips
if (ul.is('#sub_nav')) { $('.tip_box').empty().hide();
$('a.active', ul).removeClass('active'); $('.dialog .body').empty().parent().hide();
$(this).addClass('active');
}
}); });
// Quick note interface // Quick note interface
......
...@@ -622,7 +622,7 @@ if($ticket) { ...@@ -622,7 +622,7 @@ if($ticket) {
} }
$ost->addExtraHeader('<script type="text/javascript" src="js/ticket.js"></script>'); $ost->addExtraHeader('<script type="text/javascript" src="js/ticket.js"></script>');
$ost->addExtraHeader('<meta name="tip-namespace" content="tickets.open" />', $ost->addExtraHeader('<meta name="tip-namespace" content="tickets.queue" />',
"$('#content').data('tipNamespace', 'tickets.queue');"); "$('#content').data('tipNamespace', 'tickets.queue');");
require_once(STAFFINC_DIR.'header.inc.php'); require_once(STAFFINC_DIR.'header.inc.php');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment