Class: ObjectVersionView

ObjectVersionView()

Renders a single object version as an
  • element. An object version displays the identifier, upload date, and a status badge indicating whether this version is the first, latest, newer, or older relative to a reference version. If the version is private or not found, appropriate badges are shown. Clicking the version's identifier link opens the object's view page in a new tab.
  • Screenshot

    Constructor

    new ObjectVersionView()

    Since:
    • 2.37.0
    Source:

    Extends

    • Backbone.View

    Members

    autoAddTooltips

    Add tooltips to the badge elements immediately after rendering. False by default since tooltips must be added only once the view is in the DOM. This view is added to a Document Fragment during rendering of the timeline, which prevents tooltips from being added at that stage.
    Source:

    className

    Source:

    tagName

    Source:

    tooltipSettings :object|boolean

    Settings passed to the Formantic UI popup module to configure a tooltip shown over item titles. The item must have a description set in order for the tooltip to be shown.
    Type:
    • object | boolean
    Source:
    See:

    type :string

    Identifier used when the application inspects view types.
    Type:
    • string
    Source:

    Methods

    addTooltips()

    Add Semantic UI tooltips to badge elements based on their title attributes and the view's tooltipSettings.
    Source:

    applyVisibilityState()

    Show or hide the view based on the model's hiddenByUI attribute
    Source:

    changeModel(newModel)

    Swap the underlying DataONEObject instance and refresh bindings.
    Parameters:
    Name Type Description
    newModel DataONEObject The new DataONEObject model.
    Source:

    createBadge(status) → {string}

    Helper method to create a badge HTML string based on the given status.
    Parameters:
    Name Type Description
    status Object Status object containing label, CSS class name, and description for the badge.
    Source:
    Returns:
    HTML string for the badge.
    Type
    string

    createViewURL(model) → {string}

    Build a MetacatUI view URL for the given model.
    Parameters:
    Name Type Description
    model DataONEObject Model to build the URL for.
    Source:
    Returns:
    View URL for the object.
    Type
    string

    getDOIBadge() → {string}

    Get the DOI badge if this version has a DOI identifier.
    Source:
    Returns:
    HTML string for the DOI badge, or an empty string if this version does not have a DOI.
    Type
    string

    getDateNote() → {string}

    Render an inline note when the obsolescence chain order conflicts with dateUploaded chronology for this row.
    Source:
    Returns:
    HTML string for the note, or an empty string.
    Type
    string

    getErrorBadge() → {string}

    Get the badge that indicates any errors or warnings, like 401s or 404s.
    Source:
    Returns:
    HTML string for the badge.
    Type
    string

    getKeyPointsBadge() → {string}

    Special badge for versions that are first or last in the version history, or the current reference version.
    Source:
    Returns:
    HTML string for the badge.
    Type
    string

    getRelativeDateBadge() → {string}

    Get the badge that indicates how old or new this version is (based on dateUploaded) relative to the reference version. If it's the reference version, return the "current" badge.
    Source:
    Returns:
    HTML string for the badge.
    Type
    string

    getVersionOrderBadge() → {string}

    Get the badge that indicates how many versions ahead or behind this version is relative to the reference version, based on the version history index. If it's the reference version, return the "current" badge.
    Source:
    Returns:
    HTML string for the badge.
    Type
    string

    initialize(options)

    Initializes the ObjectVersionView.
    Parameters:
    Name Type Description
    options object Options to configure the view.
    Properties
    Name Type Attributes Description
    model DataONEObject The DataONEObject model to represent in this view.
    referencePid string <optional>
    The identifier of the reference version to compare against for relative date badges. If not provided, no relative date badges will be shown.
    tooltipSettings object <optional>
    Optional settings to override the default tooltipSettings for this view instance. See tooltipSettings property for details on available settings and defaults.
    autoAddTooltips boolean <optional>
    Set to true to automatically add tooltips after rendering. Defaults to false.
    Source:

    isDOI() → {boolean}

    Determines if the current version is a DOI based on its identifier.
    Source:
    Returns:
    True if the version is a DOI, false otherwise.
    Type
    boolean

    onClose()

    Clean up view resources before removal.
    Source:

    onModelChange()

    Handle model change events and avoid full re-render when only the visibility flag changed.
    Source:

    remove()

    Source:

    removeTooltips()

    Remove all Formantic popup instances from badge elements in this row.
    Source:

    render()

    Source:

    template(model) → {string}

    Generates the markup representing a single version entry.
    Parameters:
    Name Type Description
    model DataONEObject The DataONEObject model to represent.
    Source:
    Returns:
    The HTML string.
    Type
    string