Class: AppModel

AppModel()

A utility model that contains top-level configuration and storage for the application

Constructor

new AppModel()

Source:

Extends

  • Backbone.Model

Methods

DOItoURL(str) → {string}

Get the URL for the online location of the object being cited when it has a DOI. If the DOI is not passed to the function, or if the string is not a DOI, then an empty string is returned.
Parameters:
Name Type Description
str string The DOI string, handles both DOI and DOI URL, with or without prefixes
Since:
  • 2.23.0
Source:
Returns:
- The DOI URL
Type
string

URLtoDOI(url) → {string}

Get the DOI from a DOI URL. The URL can be http or https, can include the "doi:" prefix or not, and can use "dx.doi.org" or "doi.org" as the domain. If a string is not passed to the function, or if the string is not for a DOI URL, then an empty string is returned.
Parameters:
Name Type Description
url string The DOI URL
Since:
  • 2.26.0
Source:
Returns:
- The DOI string, including the "doi:" prefix
Type
string

addCSS(css, id)

Given a string of CSS and an associated unique ID, check whether that CSS file was already added to the document head, and add it if not. Prevents adding the CSS file multiple times if the view is loaded more than once. The first time each CSS path is added, we need to save a record of the event. It doesn't work to just search the document head for the style element to determine if the CSS has already been added, because views may be initialized too quickly, before the previous instance has had a chance to add the stylesheet element.
Parameters:
Name Type Description
css string A string containing CSS styles
id string A unique ID for the CSS styles which has not been used anywhere else in the app.
Source:

getActiveAltRepo() → {object}

Gets the currently-active alternative repository that is configured in this AppModel.
Source:
Returns:
Type
object

getDataONEMNAPIs(baseUrlopt) → {object}

Constructs the DataONE API URLs for the given baseUrl
Parameters:
Name Type Attributes Description
baseUrl string <optional>
The baseUrl to use in the URLs. If not specified, it uses the AppModel attributes.
Source:
Returns:
Type
object

getQuickAddTaxa()

Get the config options for the Taxa Quick Add feature. IF a SID is configured, this will fetch the taxa from the repository. Otherwise, it will return the object set on the quickAddTaxa attribute.
Source:

isDOI(doi) → {boolean}

Check if a string is a valid DOI.
Parameters:
Name Type Description
doi string The string to check.
Since:
  • 2.26.0
Source:
Returns:
- True if the string is a valid DOI, false otherwise.
Type
boolean

removeAllDOIPrefixes(str) → {string}

Remove all DOI prefixes from a DOI string, including https, http, doi.org, dx.doi.org, and doi:.
Parameters:
Name Type Description
str string The DOI string to remove prefixes from.
Since:
  • 2.26.0
Source:
Returns:
- The DOI string without any prefixes.
Type
string

removeCSS(id)

Remove CSS from the app that was added using the AppModel#addCSS function.
Parameters:
Name Type Description
id string A unique ID for the CSS styles which has not been used anywhere else in the app. The same ID used to add the CSS with AppModel#addCSS
Source:

resetDescription()

Reset the web document's description to the default
Since:
  • 2.25.0
Source:

resetTitle()

Reset the web document's title to the default
Since:
  • 2.25.0
Source:

setActiveAltRepo()

Gets the default alternate repository and sets it as the active alternate repository. If a default alt repo (AppConfig#defaultAlternateRepositoryId) isn't configured, the first alt repo in the AppConfig#alternateRepositories list is used.
Source:
Fires:
  • AppModel#change:activeAlternateRepositoryId