app/assets/javascripts/jqr-helpers.js in jqr-helpers-1.0.1 vs app/assets/javascripts/jqr-helpers.js in jqr-helpers-1.0.3
- old
+ new
@@ -16,11 +16,12 @@
$('.ui-dialog:visible form').first().submit();
}
// called from dialog button value
function ujsDialogClose() {
- $('.ui-dialog-content:visible').dialog('destroy');
+ $('.ui-dialog-content:visible').dialog('destroy')
+ .addClass('ujs-dialog-hidden');
}
function ujsDialogOpen() {
if ($(this).parent().height() > $(window).height()) {
$(this).height($(window).height() * 0.8);
@@ -48,11 +49,11 @@
}
var dialogOptions = $(this).data('dialog-options');
var open = dialogOptions['open'];
dialogOptions = $.extend(dialogOptions, {
'close': function() {
- $(this).dialog('destroy');
+ $(this).dialog('destroy').addClass('ujs-dialog-hidden');
},
'open': function() {
ujsDialogOpen.call(this);
if (open) {
var openFunc = eval(open);
@@ -188,11 +189,13 @@
});
return false;
}
$(function() {
- $('.ujs-tab-container', this).tabs({
+ $('.ujs-tab-container', this).each(function() {
+ var options = $(this).data('tab-options');
+ options = $.extend(options, {
beforeLoad: function(event, ui) {
if (ui.tab.data('loaded')) {
event.preventDefault();
return;
}
@@ -202,9 +205,11 @@
$(ui.panel).html('Loading...');
ui.jqXHR.fail(function(jqXHR, textStatus, errorThrown) {
ui.panel.html('Error loading the tab: ' + errorThrown);
});
}
+ });
+ $(this).tabs(options);
});
if ($().on) { // newer jQueries
$(document).on('click', '.ujs-dialog', ujsDialogClick);
$(document).on('click', '.ujs-dialog-close, .ujs-dialog-x',