Class: AppView

Drupal.quickedit.AppView(options)

new AppView(options)

Parameters:
Name Type Description
options object

An object with the following keys:

Properties
Name Type Description
model Drupal.quickedit.AppModel

The application state model.

entitiesCollection Drupal.quickedit.EntityCollection

All on-page entities.

fieldsCollection Drupal.quickedit.FieldCollection

All on-page fields

Source:

Extends

  • Backbone.View

Methods

acceptEditorStateChange(from, to, context, fieldModel) → {bool}

Accepts or reject editor (Editor) state changes.

This is what ensures that the app is in control of what happens.

Parameters:
Name Type Description
from string

The previous state.

to string

The new state.

context null | object

The context that is trying to trigger the state change.

fieldModel Drupal.quickedit.FieldModel

The fieldModel to which this change applies.

Source:
Returns:

Whether the editor change was accepted or rejected.

Type
bool

appStateChange(entityModel, state)

Handles setup/teardown and state changes when the active entity changes.

Parameters:
Name Type Description
entityModel Drupal.quickedit.EntityModel

An instance of the EntityModel class.

state string

The state of the associated field. One of Drupal.quickedit.EntityModel.states.

Source:

confirmEntityDeactivation(entityModel)

Asks the user if they want to stop editing via a modal.

Parameters:
Name Type Description
entityModel Drupal.quickedit.EntityModel

An instance of the EntityModel class.

Source:
See:

editorStateChange(fieldModel, state)

Reacts to field state changes; tracks global state.

Parameters:
Name Type Description
fieldModel Drupal.quickedit.FieldModel

The fieldModel holding the state.

state string

The state of the associated field. One of Drupal.quickedit.FieldModel.states.

Source:

enforceSingleActiveEntity(changedEntityModel)

EntityModel Collection change handler.

Handler is called change:isActive and enforces a single active entity.

Parameters:
Name Type Description
changedEntityModel Drupal.quickedit.EntityModel

The entityModel instance whose active state has changed.

Source:

propagateUpdatedField(updatedField, html, options)

Propagates changes to an updated field to all instances of that field.

Parameters:
Name Type Description
updatedField Drupal.quickedit.FieldModel

The FieldModel whose 'html' attribute changed.

html string

The updated 'html' attribute.

options object

An object with the following keys:

Properties
Name Type Description
propagation bool

Whether this change to the 'html' attribute occurred because of the propagation of changes to another instance of this field.

Source:
See:

renderUpdatedField(fieldModel, html, options)

Render an updated field (a field whose 'html' attribute changed).

Parameters:
Name Type Description
fieldModel Drupal.quickedit.FieldModel

The FieldModel whose 'html' attribute changed.

html string

The updated 'html' attribute.

options object

An object with the following keys:

Properties
Name Type Description
propagation bool

Whether this change to the 'html' attribute occurred because of the propagation of changes to another instance of this field.

Source:

rerenderedFieldToCandidate(fieldModel)

If the new in-place editable field is for the entity that's currently being edited, then transition it to the 'candidate' state.

This happens when a field was modified, saved and hence rerendered.

Parameters:
Name Type Description
fieldModel Drupal.quickedit.FieldModel

A field that was just added to the collection of fields.

Source:

setupEditor(fieldModel)

Sets up the in-place editor for the given field.

Must happen before the fieldModel's state is changed to 'candidate'.

Parameters:
Name Type Description
fieldModel Drupal.quickedit.FieldModel

The field for which an in-place editor must be set up.

Source:

teardownEditor(fieldModel)

Tears down the in-place editor for the given field.

Must happen after the fieldModel's state is changed to 'inactive'.

Parameters:
Name Type Description
fieldModel Drupal.quickedit.FieldModel

The field for which an in-place editor must be torn down.

Source: