azavea/OTM2 — pull request #292 by RickMohr (2013-09-09 18:10:00+00:00)
Title: Move plot and edit tree fields

There are 4 related features here. It's in one pull request because I kept re-editing and abstracting the same files. I wanted to save people the work of reviewing code that was about to change. However, the end result is a pretty big pull request.

1) Show map with plot location on plot detail page

2) Allow changing plot position from plot detail page

* Hit "Edit" to edit the plot details, then hit "Move Tree" to change plot location

Use new features of inlineEditForm.js:
* Use returned Bacon property "isInEditModeProperty" to update UI as user enters/exits edit mode
* Use "onSaveBefore" callback to augment uploaded data with plot location (plot.geom)
* Use "onSaveSuccess" callback to redraw the map when location is updated

3) Edit tree fields on map page

* Remove existing popup when leaving "browse trees" mode
* Allow changing an inlineEditForm's "updateUrl" after it has been initialized
* When user clicks a tree, set URL for updating that tree on inlineEditForm
* Initialize species typeahead
* Scope "editFields" etc. selectors on inlineEditForm, since to avoid collisions with "add trees" mode

4) Allow moving plot on map page (in "edit tree details" mode)

* "Edit tree details" mode gets buttons "Move Tree" and "Cancel Tree Move"
* Return plot location in plot_accordion.html via data attributes on form element
* Moving the plot handled by plotMover.js
* All modes share an instance of plotMarker
* Show/hide marker when user selects/deselects a tree
* Pass mapManager to modes, simplifying map update after add/move tree
* Show marker differently when it's being moved (will be more beautiful in the future)