Resources/public/js/editor/dist/step-editor.js
/**
 * Add some colors on empty required inputs
 *
 * @param elementId - the if of the element wrapping the inputs
 * @param parentClass - the class of the parent of the required input, in case we don't want to select every inputs
 */
Add some colors on empty required inputs
@param elementId - the if of the element wrapping the inputs
@param parentClass - the class of the parent of the required input, in case we don't want to select every inputs
Add some colors on empty required inputs @param elementId - the if of the element wrapping the inputs @param parentClass - the class of the parent of the required input in case we don ' t want to select every inputs
function colorEmptyRequiredInputs (elementId, parentClass) {
  var inputSelector = '.' + parentClass + ' input[required="required"]';
  function color($input) {
    if ($input.val()) {
      $input.css({
        'border-color': '#cccccc',
        'background-color': '#ffffff'
      });
    } else {
      $input.css({
        'border-color': '#c9302c',
        'background-color': '#f3d9d9'
      });
    }
  }
  __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document).on('change', inputSelector, function () {
    color(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this));
  });
  var target = document.getElementById(elementId);
  var config = {
    childList: true,
    characterData: true,
    subtree: true
  };
  var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      var $inputs = [];
      if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(mutation.target).hasClass(parentClass)) {
        $inputs = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(mutation.target).find('input[required="required"]');
      } else {
        $inputs = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(mutation.target).find(inputSelector);
      }
      $inputs.each(function () {
        color(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this));
      });
    });
  });
  observer.observe(target, config);
}
function colorEmptyRequiredInputs ( elementId , parentClass ) { var inputSelector = '.' + parentClass + ' input[required="required"]' ; function color ( $input ) { if ( $input . val ( ) ) { $input . css ( { 'border-color' : '#cccccc' , 'background-color' : '#ffffff' } ) ; } else { $input . css ( { 'border-color' : '#c9302c' , 'background-color' : '#f3d9d9' } ) ; } } __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( document ) . on ( 'change' , inputSelector , function ( ) { color ( __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( this ) ) ; } ) ; var target = document . getElementById ( elementId ) ; var config = { childList : true , characterData : true , subtree : true } ; var observer = new MutationObserver ( function ( mutations ) { mutations . forEach ( function ( mutation ) { var $inputs = [ ] ; if ( __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( mutation . target ) . hasClass ( parentClass ) ) { $inputs = __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( mutation . target ) . find ( 'input[required="required"]' ) ; } else { $inputs = __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( mutation . target ) . find ( inputSelector ) ; } $inputs . each ( function ( ) { color ( __WEBPACK_IMPORTED_MODULE_0_jquery___default ( ) ( this ) ) ; } ) ; } ) ; } ) ; observer . observe ( target , config ) ; }
Add some colors on empty required inputs
 @param elementId - the if of the element wrapping the inputs
 @param parentClass - the class of the parent of the required input, in case we don't want to select every inputs
Add some colors on empty required inputs @param elementId - the if of the element wrapping the inputs @param parentClass - the class of the parent of the required input in case we don ' t want to select every inputs
/**
   * Color in red when empty, in white when filled
   *
   * @param $input
   */ // Color on change when the input is empty // Color when new children are added to the dom // Sometimes they are added but already filled by vuejs, sometimes they are empty