Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / quickedit / js / models / EntityModel.es6.js
index 7c36e362bb6f0c65cb39da849d32a35e94ffe373..4ea83713562dd76d78f97095fbb929c13153dad7 100644 (file)
           this.set('isActive', true);
           break;
 
-        case 'committing':
+        case 'committing': {
           // The user indicated they want to save the entity.
-          var fields = this.get('fields');
+          const fields = this.get('fields');
           // For fields that are in an active state, transition them to
           // candidate.
           fields.chain()
               fieldModel.set('state', 'saving');
             });
           break;
+        }
 
-        case 'deactivating':
-          var changedFields = this.get('fields')
+        case 'deactivating': {
+          const changedFields = this.get('fields')
             .filter(fieldModel => _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length);
           // If the entity contains unconfirmed or unsaved changes, return the
           // entity to an opened state and ask the user if they would like to
             });
           }
           break;
+        }
 
         case 'closing':
           // Set all fields to the 'inactive' state.
           }
           break;
 
-        case 'committing':
+        case 'committing': {
           // If the field save returned a validation error, set the state of the
           // entity back to 'opened'.
           if (fieldState === 'invalid') {
 
           // Attempt to save the entity. If the entity's fields are not yet all
           // in a ready state, the save will not be processed.
-          var options = {
+          const options = {
             'accept-field-states': Drupal.quickedit.app.readyFieldStates,
           };
           if (entityModel.set('isCommitting', true, options)) {
             });
           }
           break;
+        }
 
         case 'deactivating':
           // When setting the entity to 'closing', require that all fieldModels