Class: EMLTaxonView

EMLTaxonView()

A Backbone View that renders the taxonomic coverage section of an EML model. This view is used to create, edit, and delete taxonomic classifications in the EML model. It also provides a "quick add" interface for adding common taxa to the taxonomic coverage section. Logic oiginally included in the EML211EditorView.

Constructor

new EMLTaxonView()

Since:
  • 2.33.0
Source:

Extends

  • Backbone.View

Members

events

Source:

taxonomicClassificationRowTemplate :UnderscoreTemplate

The template for the taxonomic classification row
Type:
  • UnderscoreTemplate
Source:

taxonomicClassificationTableTemplate :UnderscoreTemplate

The template for the taxonomic classification table
Type:
  • UnderscoreTemplate
Source:

taxonomicCoverageTemplate :UnderscoreTemplate

The template for the taxonomic coverage section
Type:
  • UnderscoreTemplate
Source:

Methods

addNewTaxon(e)

Adds a new row and/or table to the taxonomic coverage section
Parameters:
Name Type Description
e Event The event that triggered this function
Source:

addTaxa(newClassifications)

Add new taxa to the EML model and re-render the taxa section. The new taxa will be added to the first element in the EML model. If there is no element, one will be created.
Parameters:
Name Type Description
newClassifications Array.<object> An array of objects with any of the following properties: - taxonRankName: (sting) The name of the taxonomic rank, e.g. "Kingdom" - taxonRankValue: (string) The value of the taxonomic rank, e.g. "Animalia" - commonName: (string) The common name of the taxon, e.g. "Animals" - taxonId: (object) The official ID of the taxon, including "provider" and "value". - taxonomicClassification: (array) An array of nested taxonomic classifications
Since:
  • 2.24.0
Source:
Example
this.addTaxon([{
 taxonRankName: "Kingdom",
 taxonRankValue: "Animalia",
 commonName: "Animals",
 taxonId: {
   provider: "https://www.itis.gov/",
   value: "202423"
 }]);

createRemoveButton(submodel, attribute, selector, container) → {jQuery}

Creates "Remove" buttons for removing non-required sectionsof the EML from the DOM
Parameters:
Name Type Description
submodel string The name of the submodel to remove
attribute string The name of the attribute to remove
selector string The selector for the element to remove
container string The selector for the container element
Source:
Returns:
A jQuery object containing the remove button // TODO: duplicate of EML211EditorView#createRemove
Type
jQuery

createTaxonomicClassificationTable(classification) → {jQuery}

Create the HTML for a taxonomic coverage table
Parameters:
Name Type Description
classification EMLTaxonCoverage An EMLTaxonCoverage model
Source:
Returns:
A jQuery object containing the HTML for a taxonomic coverage table
Type
jQuery

createTaxonomicCoverage(coverage) → {jQuery}

Creates a table to hold a single EMLTaxonCoverage element (table) for each root-level taxonomicClassification
Parameters:
Name Type Description
coverage EMLTaxonCoverage An EMLTaxonCoverage model
Source:
Returns:
A jQuery object containing the HTML for the taxonomic coverage section
Type
jQuery

getTaxonArray(options) → {Array.<EMLTaxonCoverage>}

Get the taxon coverage array from the options or the parent model
Parameters:
Name Type Description
options object The options passed to the view
Source:
Returns:
An array of EMLTaxonCoverage models
Type
Array.<EMLTaxonCoverage>

getTaxonQuickAddOptions() → {Array.<object>}

Get the list of options for the taxon quick add interface. Filter out any that have already been added to the taxonomic coverage.
Since:
  • 2.24.0
Source:
Returns:
An array of search select options
Type
Array.<object>

initialize()

Source:

makeNewTaxonomicClassificationRow() → {jQuery}

Create the HTML for a new row in a taxonomicClassification table
Since:
  • 2.24.0
Source:
Returns:
A jQuery object containing the HTML for a new row in a taxonomicClassification table
Type
jQuery

makeTaxonomicClassificationRow(classification) → {jQuery}

Create the HTML for a single row in a taxonomicClassification table
Parameters:
Name Type Description
classification TaxonomicClassification A classification object from an EMLTaxonCoverage model, may include a taxonRank, taxonValue, taxonId, commonName, and nested taxonomicClassification objects
Since:
  • 2.24.0
Source:
Returns:
A jQuery object containing the HTML for a single row in a taxonomicClassification table
Type
jQuery

previewTaxonRemove(e)

Indicate that a taxonomic classification is about to be removed if the button is clicked
Parameters:
Name Type Description
e Event The event that triggered this function
Source:

removeTaxonRank(e)

Remove a taxonomic classification from the EML model
Parameters:
Name Type Description
e Event The event that triggered this function
Source:

render()

Source:

renderTaxaQuickAdd()

Insert the "quick add" interface for adding common taxa to the taxonomic coverage section. Only renders if there is a list of taxa configured in the appModel.
Source:

showTaxonValidation(e)

After the user focuses out, show validation help, if needed
Parameters:
Name Type Description
e Event The event that triggered this function
Source:

taxonOptionToSearchSelectItem(option) → {object}

Reformats a taxon option, as provided in the appModel AppModel#quickAddTaxa, as a search select item.
Parameters:
Name Type Description
option object A single taxon classification with at least a taxonRankValue and taxonRankName. It may also have a taxonId (object with provider and value) and a commonName.
Source:
Returns:
A search select item with label, value, and description properties.
Type
object

updateQuickAddTaxa()

Update the options for the quick add taxon select interface. This ensures that only taxonomic classifications that are not already included in the taxonomic coverage are available for selection.
Since:
  • 2.24.0
Source:

updateTaxaNumbering() → {Array.<HTMLElement>}

Update the numbering of the taxa in the taxonomic coverage section
Since:
  • 2.33.0
Source:
Returns:
An array of the taxon numbering elements
Type
Array.<HTMLElement>

updateTaxonCoverage(options)

Update the underlying model and DOM for an EML TaxonomicCoverage section. This method handles updating the underlying TaxonomicCoverage models when the user changes form fields as well as inserting new form fields automatically when the user needs them. Since a dataset has multiple TaxonomicCoverage elements at the dataset level, each Taxonomic Coverage is represented by a table element and all taxonomicClassifications within are rows in that table. TODO: Finish this function TODO: Link this function into the DOM
Parameters:
Name Type Description
options object An object with the following properties: - target: The target element that was changed - coverage: The taxonomic coverage element that was changed
Source: