Class: CitationHeaderView

CitationHeaderView()

The CitationHeaderView shows a citation information displayed as a header, with expandable author list (if there are more than a certain number of authors).

Screenshot

Constructor

new CitationHeaderView()

Since:
  • 2.23.0
Source:

Extends

Members

authorListIsOpen :boolean

Tracks whether the list of authors is open or closed. This will be set automatically when the button is clicked. Set to true when initializing the view to initially render the list open.
Type:
  • boolean
Source:

citationMetadataClass :string

The HTML classes to use for the element that will contain the citation metadata. The citation metadata are the citations that cite the main citation. This class will be passed to the template and will be used to identify the container element.
Type:
  • string
Since:
  • 2.23.0
Inherited From:
Source:

className

Overrides:
Source:

classes :Object

IDs used in the template to identify the elements that will be manipulated by this view to make the author list collapsible.
Type:
  • Object
Properties:
Name Type Description
grp1 string The ID of the first group of authors
grp2 string The ID of the second group of authors
btn string The ID of the button that will toggle the visibility of the second group of authors
last string The ID of the last author
ellipsis string The ID of the ellipsis that will be displayed when the second group of authors is hidden
Source:

context

Override the CitationView context to use the full context.
Overrides:
Source:
See:
Never create a link for the citation header. See CitationView#createLink
Overrides:
Source:
Never create a link for the citation header title. See CitationView#createTitleLink
Overrides:
Source:

defaultTitle :string

A default title for when the Citation Model does not have a title.
Type:
  • string
Since:
  • 2.23.0
Inherited From:
Source:

maxAuthors :number

When there are more than this many authors, then this number of authors will always be displayed, and the rest will be viewable with a click. The last author will always be displayed.
Type:
  • number
Default Value:
  • 20
Source:

model :CitationModel

The CitationModel that this view is displaying. The view can be instantiated by passing in a CitationModel, or a SolrResult, DataONEObject, or an extension of those, and the view will create a CitationModel from it. To change the model after the view has been instantiated, use the CitationView#setModel method.
Type:
Inherited From:
Source:

openLinkInNewTab :boolean

When links are created as part of this view, whether to open them in a new tab or not. If the URL begins with "http" then it will always open in a new tab. When this option is true, then relative URLs will also open in a new tab.
Type:
  • boolean
Since:
  • 2.23.0
Inherited From:
Source:

style

Override the CitationView style to use the header style.
Overrides:
Source:
See:

styles :Object

See CitationView#styles. This view only uses the header style.
Type:
  • Object
Overrides:
Source:

tagName :string

The HTML tag name for this view's element
Type:
  • string
Inherited From:
Source:

titleClass :string

The HTML classes to use for the title element. This will be passed to the template and will be used to identify the title element if the createTitleLink option is set to true.
Type:
  • string
Since:
  • 2.23.0
Inherited From:
Source:

type :string

The name of this type of view
Type:
  • string
Overrides:
Source:

Methods

CSLNameToAPA(cslJSON)

Given one name object in CSL-JSON format, return the author's name in the format required for a full APA citation: Last name first, followed by author initials with a period after each initial. See EMLParty#toCSLJSON
Parameters:
Name Type Description
cslJSON object A CSL-JSON name object
Since:
  • 2.23.0
Inherited From:
Source:

CSLNameToFullNameStr(authors) → {string}

Given a list of authors in CSL JSON, merge them all into a single string where authors full names are separated by commas.
Parameters:
Name Type Description
authors Array.<object> An array of CSL JSON name objects
Since:
  • 2.23.0
Inherited From:
Source:
Returns:
The formatted author string or an empty string if there are no authors
Type
string

CSLNamesToAPA(authors, maxAuthorsopt) → {string}

Given a list of authors in CSL JSON, merge them all into a single string for display in an APA citation.
Parameters:
Name Type Attributes Default Description
authors Array.<object> An array of CSL JSON name objects
maxAuthors number <optional>
20 The maximum number of authors to display. If there are more than this number of authors, then the remaining authors will be replaced with an ellipsis. The default is 20 since that is the maximum that APA allows. Set to a falsy value to display all authors.
Since:
  • 2.23.0
Inherited From:
Source:
Returns:
The formatted author string or an empty string if there are no authors
Type
string

CSLNamesToAPAInText(authors) → {string}

Given a list of authors in CSL JSON, merge them all into a single string for display in an In-Text APA citation.
Parameters:
Name Type Description
authors Array.<object> An array of CSL JSON name objects
Since:
  • 2.23.0
Inherited From:
Source:
Returns:
The formatted author string or an empty string if there are no authors
Type
string

addCitationMetadata(citationMetadata)

Render the list of in-text citations that cite the main citation. This function will find the element in the template that is designated as the container for the in-text citations and will render any citations from the model's citationMetadata attribute.
Parameters:
Name Type Description
citationMetadata Array.<Object> The citationMetadata to render. See CitationModel#defaults.
Since:
  • 2.23.0
Inherited From:
Source:
Make the entire citation a link to the view page or the source URL.
Since:
  • 2.23.0
Inherited From:
Source:
Make the title a link to the view page or the source URL.
Since:
  • 2.23.0
Inherited From:
Source:

clear() → {CitationView}

Remove all HTML from the view.
Since:
  • 2.23.0
Inherited From:
Source:
Returns:
Returns the view.
Type
CitationView

closeList()

Close the list of authors, showing only the first group of authors. The last author will always be shown.
Source:

initialize(options)

Executed when a new CitationView is created. Options that are available but which are not defined as properties of this view are defined below.
Parameters:
Name Type Description
options Object A literal object with options to pass to the view.
Properties
Name Type Attributes Description
metadata Backbone.Model <optional>
This option is allowed for backwards compatibility, but it is recommended to use the model option instead. This will be ignored if a model is set. A model passed in this option will be used to populate a CitationModel.
title string <optional>
Allowed for backwards compatibility. Setting this option will set the default title for this view, on the CitationView#defaultTitle property.
id string <optional>
When no model and no metadata are provided, this option can be used to query for an object to cite. If a model or metadata model is provided, then the ID will be ignored.
Inherited From:
Source:

openList()

Open the list of authors, showing all authors.
Source:

render() → {CitationView}

Renders the view.
Inherited From:
Source:
Returns:
Returns the view.
Type
CitationView

renderAPA(options, template, maxAuthorsopt)

Render a complete APA style citation.
Parameters:
Name Type Attributes Default Description
options Object The options to pass to the template.
template function The template associated with this style, or it's archive template if the object is archived and not indexed.
maxAuthors number <optional>
20 The maximum number of authors to display. If there are more than this number of authors, then the remaining authors will be replaced with an ellipsis. The default is 20 since that is the maximum that APA allows. Set to a falsy value to display all authors.
Since:
  • 2.23.0
Inherited From:
Source:

renderAPAAllAuthors(options, template)

Render a complete APA style citation with all authors listed.
Parameters:
Name Type Description
options Object The options to pass to the template.
template function The template associated with this style, or it's archive template if the object is archived and not indexed.
Since:
  • 2.26.0
Inherited From:
Source:

renderAPAInText(options, template)

Render an in-text APA style citation.
Parameters:
Name Type Description
options Object The options to pass to the template.
template function The template associated with this style, or it's archive template if the object is archived and not indexed.
Since:
  • 2.23.0
Inherited From:
Source:

renderHeader(options)

Render the citation header. Called by CitationView#render.
Parameters:
Name Type Description
options Object Options to pass to the render method
Properties
Name Type Description
style string The style to use for rendering
Source:

setModel(newModelopt, metadataopt, idopt, renderopt)

Use this method to set or change the model for this view, and re-render. If a CitationModel is provided, then it will be used. If a SolrResult, DataONEObject, or an extension of those is provided as either the first or second argument, then a CitationModel will be created from it. Otherwise, if there is an ID provided, then a CitationModel will be created from a SolrResult with that ID. If none of those are provided, then a new, empty CitationModel will be created.
Parameters:
Name Type Attributes Default Description
newModel CitationModel <optional>
The new model to set on this view.
metadata Backbone.Model <optional>
This option is allowed for backwards compatibility, but it is recommended to use the model option instead. This will be ignored if a model is set. A model passed in this option will be used to populate a CitationModel.
id string <optional>
When no model and no metadata are provided, this option can be used to query for an object to cite.
render boolean <optional>
true Whether to re-render the view after setting the model.
Since:
  • 2.23.0
Inherited From:
Source:

toggleList()

Toggle the visibility of the second group of authors. If the second group is visible, then it will be hidden. If the second group is hidden, then it will be shown.
Source: