A new constructor that is used to create a ParticipationManager object as soon as the user lands on the participate page. This manages all aspects of the participation session without reloading the page at any point.
The ParticipationManager has been linked to the new page structure in T224724: Match Participate page to mock ups.
This commit has the following limitations compared to master branch which will be fixed in the next commits in this patch series:
- Hard coded category, so you're campaign selection is ignored. This this will be populated by list generated from T224467: Client side category image retrieval with depth on Participate page
- Contributions 'save' buttons are not active. These need to be linked to a new Ajax Post request which submits the contribution data (replaces form completely, meaning no page reload)
The ParticipationManager includes:
Properties
- images - complete list of all images in session
- currentImage - index of current loaded image
- initialData - snapshot of initial data retrieved from commons
- unsavedChanges - current unsaved changes for depicts and captions
- countrySubcategory - updated on page load from ?country url parameter
methods and functions
All Bold are public methods
- Next image()
- Previous image()
- imageChanged()
- populateMetaData(filename)
- populateStructuredData(filename, callback)
- getImageFileName() - uses current index to return the filename of the image
- saveInitialStructuredData(depictsData, captionsData)
- updateImage(filename) - updates the src of the main image
- getStatementHtml(item, label, description, isProminent) - returns the HTML for a single depicts statement, using newly designed snippet
Note: We will now switch to using a post request instead of default form behaviour T224505: Setup Ajax post request for sending contribution data to the server