mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Add Inputfields.startSpinner() and Inputfields.stopSpinner() methods to inputfields.js Inputfields class
This commit is contained in:
@@ -32,6 +32,8 @@
|
|||||||
* - Inputfields.input(f): Get the input element(s) within the given Inputfield
|
* - Inputfields.input(f): Get the input element(s) within the given Inputfield
|
||||||
* - Inputfields.insertBefore(f, ff): Insert Inputfield 'f' before Inputfield 'ff'.
|
* - Inputfields.insertBefore(f, ff): Insert Inputfield 'f' before Inputfield 'ff'.
|
||||||
* - Inputfields.insertAfter(f, ff): Insert Inputfield 'f' after Inputfield 'ff'.
|
* - Inputfields.insertAfter(f, ff): Insert Inputfield 'f' after Inputfield 'ff'.
|
||||||
|
* - Inputfields.startSpinner(f): Start spinner for Inputfield.
|
||||||
|
* - Inputfields.stopSpinner(f): Stop spinner for Inputfield.
|
||||||
* - Inputfields.init(target): Manually initialize all .Inputfield elements within target.
|
* - Inputfields.init(target): Manually initialize all .Inputfield elements within target.
|
||||||
* Calling init() is only necessary for Inputfields not present during page load.
|
* Calling init() is only necessary for Inputfields not present during page load.
|
||||||
* - This file also contains lots of other functions, but they are not part of the public API.
|
* - This file also contains lots of other functions, but they are not part of the public API.
|
||||||
@@ -621,6 +623,49 @@ var Inputfields = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a spinner for Inputfield
|
||||||
|
*
|
||||||
|
* @param $inputfield
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
startSpinner: function($inputfield) {
|
||||||
|
|
||||||
|
$inputfield = this.inputfield($inputfield);
|
||||||
|
if(!$inputfield.length) return;
|
||||||
|
|
||||||
|
var id = $inputfield.attr('id') + '-spinner';
|
||||||
|
var $spinner = $('#' + id);
|
||||||
|
var $header = $inputfield.children('.InputfieldHeader');
|
||||||
|
|
||||||
|
if(!$spinner.length) {
|
||||||
|
$spinner = $("<i class='InputfieldSpinner fa fa-spin fa-spinner'></i>");
|
||||||
|
$spinner.attr('id', id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$spinner.css({
|
||||||
|
float: 'right',
|
||||||
|
marginRight: '30px',
|
||||||
|
marginTop: '3px'
|
||||||
|
});
|
||||||
|
|
||||||
|
$header.append($spinner.hide());
|
||||||
|
$spinner.fadeIn();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop a spinner for Inputfield
|
||||||
|
*
|
||||||
|
* @param $inputfield
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
stopSpinner: function($inputfield) {
|
||||||
|
$inputfield = this.inputfield($inputfield);
|
||||||
|
if(!$inputfield.length) return;
|
||||||
|
var $spinner = $('#' + $inputfield.attr('id') + '-spinner');
|
||||||
|
if($spinner.length) $spinner.fadeOut('fast', function() { $spinner.remove(); });
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the given Inputfield have a hidden state?
|
* Does the given Inputfield have a hidden state?
|
||||||
*
|
*
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user