mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 17:39:46 +01:00
Fix for issue #2762
This commit is contained in:
parent
1764aa1cf7
commit
06474b83b1
@ -331,6 +331,52 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Behavior to initialize submit buttons.
|
||||
*
|
||||
* @type {{attach: e107.behaviors.buttonSubmit.attach}}
|
||||
*/
|
||||
e107.behaviors.buttonSubmit = {
|
||||
attach: function (context, settings)
|
||||
{
|
||||
$(context).find('button[type=submit]').once('button-submit').each(function ()
|
||||
{
|
||||
$(this).on('click', function ()
|
||||
{
|
||||
var $button = $(this);
|
||||
var $form = $button.closest('form');
|
||||
|
||||
var type = $button.data('loading-icon');
|
||||
|
||||
if(type === undefined || $form.length === 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$form.submit(function ()
|
||||
{
|
||||
if ($form.find('.has-error').length > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var caption = "<i class='fa fa-spin " + type + " fa-fw'></i>";
|
||||
caption += "<span>" + $button.text() + "</span>";
|
||||
|
||||
$button.html(caption);
|
||||
|
||||
if($button.attr('data-disable') == 'true')
|
||||
{
|
||||
$button.addClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the selector is valid.
|
||||
*
|
||||
@ -853,41 +899,6 @@ $(document).ready(function()
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('button[type=submit]').on('click', function()
|
||||
{
|
||||
var caption = $(this).text();
|
||||
var type = $(this).attr('data-loading-icon');
|
||||
var formid = $(this).closest('form').attr('id');
|
||||
var but = $(this);
|
||||
|
||||
if(type === undefined || (formid === undefined))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#'+formid).submit(function(){ // only animate on successful submission.
|
||||
|
||||
caption = "<i class='fa fa-spin " + type + " fa-fw'></i><span>" + caption + "</span>";
|
||||
|
||||
$(but).html(caption);
|
||||
|
||||
if( $(but).attr('data-disable') == 'true')
|
||||
{
|
||||
|
||||
$(but).addClass('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Dates --------------------------------------------------
|
||||
|
||||
// https://github.com/smalot/bootstrap-datetimepicker
|
||||
|
Loading…
x
Reference in New Issue
Block a user