Class: AppView

Drupal.quickedit. AppView

new Drupal.quickedit.AppView(options)

Name Type Description
options object

An object with the following keys:

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

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.

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.

Returns:
Type Description
bool Whether the editor change was accepted or rejected.

appStateChange(entityModel, state)

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

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.

confirmEntityDeactivation(entityModel)

Asks the user to confirm whether he wants to stop editing via a modal.

Name Type Description
entityModel Drupal.quickedit.EntityModel

An instance of the EntityModel class.

See:

editorStateChange(fieldModel, state)

Reacts to field state changes; tracks global state.

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.

enforceSingleActiveEntity(changedEntityModel)

EntityModel Collection change handler.

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

Name Type Description
changedEntityModel Drupal.quickedit.EntityModel

The entityModel instance whose active state has changed.

propagateUpdatedField(updatedField, html, options)

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

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:

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.

See:

renderUpdatedField(fieldModel, html, options)

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

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:

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.

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.

Name Type Description
fieldModel Drupal.quickedit.FieldModel

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

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

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

Name Type Description
fieldModel Drupal.quickedit.FieldModel

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

teardownEditor(fieldModel)

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

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

Name Type Description
fieldModel Drupal.quickedit.FieldModel

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