/ui/locations/view

The module exports a default method to create a location view to be added to a locations listview.

Dictionary entries:

  • location_zoom
  • location_save
  • location_delete
  • location_remove
  • location_close_without_save
  • location_save_changes

Requires

Methods

(inner) location_remove()

The method checks whether a location.infoj has some unsaved changes. A confirm dialog will be shown to confirm the location.remove() without saving changes.

(inner) onClickEditToggle(e)

The location.editToggle onclick event method toggles location.view edits.

A confirmation is required for entries with newValues.

If cancelled the newValues will removed.

A location.update() will be attempted on confirmation.

An alert will be shown if the location.update() errs.

The location.renderLocationView() will be called on successful update or cancellation.

Parameters:
NameTypeDescription
eEvent

The location.editToggle onclick event.

(inner) renderLocationView()

The renderLocationView method will remove all location.viewEntries and the .disabled class from the location.view before recreating the location.viewEntries and appending these to the location.view element.

(inner) toggleLocationViewEdits(location) → {Boolean}

The toggleLocationViewEdits checks whether the location.layer has the toggleLocationViewEdits flag.

At least one entry of the location must be editable.

New locations must always be editable.

The location.editToggle button element for the location view header is created.

Parameters:
NameTypeDescription
locationlocation

Mapp Location typedef

Returns:

Returns true if toggleLocationViewEdits should be possible.

Type: 
Boolean

(inner) valChange(e)

The valChange method is assigned to the valChange custom event listener of the location.view element.

An infoj-entry must be provided as detail when the valChange custom event is dispatched.

The valChange method will check whether an entry has a newValue which is different from the current value and assign a class to show the change on the input element.

The valChange event controls the display of the location.update button (.btn-save).

The update button will not be displayed if no entry has a newValue or if some entry is invalid.

Parameters:
NameTypeDescription
eEvent

A custom event from the location.view eventlistener.

Properties
NameTypeDescription
e.detailinfoj-entry

The detail passed to the valChange event must be an info-entry typedef.

(inner) view(location) → {HTMLElement}

The view method creates a location view element group.

Parameters:
NameTypeDescription
locationlocation

A mapp location object.

Properties
NameTypeAttributesDescription
location.recordObject

A location is stored in a record object in the mapview.locations object.

location.removeCallbacksArray<optional>

An array of methods which will be executed when a location is removed.

Returns:

The location.view element.

Type: 
HTMLElement