Page MenuHomePhabricator

Track unsaved changes for depicts and captions
Closed, ResolvedPublic

Description

IMPORTANT: Part of a patch series, do NOT merge yet

The new ParticipationManager needs to be able to keep track of unsaved changes for both depicts and captions.

We do this by storing the data returned from the initial structured data query from Commons, and saving it to initialData = {depicts: [], captions: []} - this is then compared to the current selections in the UI when the depictDataChanged() or captionDataChanged() methods are run. The results are stored to the unsavedChanges object.

The change events must be triggered after any change to their respective section. This is used to enable/disable the "save" and "cancel" buttons.

As unsavedChanges is always up to date, we simply needs to be post it to the server when the user clicks "save"

The following private functions need to be added:

  • saveInitialStructuredData()
  • updateUnsavedDepictChanges()
  • updateUnsavedCaptionChanges()

And public 'event trigger' methods:

  • depictDataChanged()
  • captionDataChanged()

The event triggers can then be used when any changes are made to either depicts or captions. This will launch the private function to get the differences

Event Timeline

NavinoEvans updated the task description. (Show Details)

Change 514007 had a related patch set uploaded (by NavinoEvans; owner: NavinoEvans):
[labs/tools/Isa@master] Track unsaved changes for depicts and captions

https://gerrit.wikimedia.org/r/514007

Change 514007 merged by jenkins-bot:
[labs/tools/Isa@master] Track unsaved changes for depicts and captions

https://gerrit.wikimedia.org/r/514007