Webform module and config export
This commit is contained in:
parent
3e6a5cbed2
commit
0e15467384
1040 changed files with 117682 additions and 0 deletions
39
web/modules/contrib/webform/js/webform.element.rating.js
Normal file
39
web/modules/contrib/webform/js/webform.element.rating.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* @file
|
||||
* Javascript behaviors for RateIt integration.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Initialize rating element using RateIt.
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*/
|
||||
Drupal.behaviors.webformRating = {
|
||||
attach: function (context) {
|
||||
$(context)
|
||||
.find('[data-rateit-backingfld]')
|
||||
.once('webform-rating')
|
||||
.each(function () {
|
||||
var $rateit = $(this);
|
||||
var $input = $($rateit.attr('data-rateit-backingfld'));
|
||||
|
||||
// Update the RateIt widget when the input's value has changed.
|
||||
// @see webform.states.js
|
||||
$input.on('change', function () {
|
||||
$rateit.rateit('value', $input.val());
|
||||
});
|
||||
|
||||
// Set RateIt widget to be readonly when the input is disabled.
|
||||
// @see webform.states.js
|
||||
$input.on('webform:disabled', function () {
|
||||
$rateit.rateit('readonly', $input.is(':disabled'));
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, Drupal);
|
Reference in a new issue