Class: PortalImage

PortalImage()

A Portal Image model represents a single image used in a Portal

Constructor

new PortalImage()

Source:

Extends

  • Backbone.Model

Members

type

Source:

Methods

getBaseURL() → {string}

getBaseURL - Get the base URL to use with an image identifier
Source:
Returns:
The image base URL, or an empty string if not found
Type
string

imageExists(imageURL) → {boolean}

imageExists - Check if an image exists with the given url, or if no url provided, with the baseURL + identifier
Parameters:
Name Type Description
imageURL string The image URL to check
Source:
Returns:
Returns true if an HTTP request returns anything but 404
Type
boolean

isEmpty() → {boolean}

isEmpty - Returns true if the PortalImage model has no label, no associatedURL, and no identifier
Source:
Returns:
true if the model is empty, false if it has at least a label, url, or id
Type
boolean

isNew() → {boolean}

Returns true if this PortalImage hasn't been saved to a Portal yet, so it is a new object. For now, all PortalImages will be considered new objects since we will not be performing updates on them.
Source:
Returns:
Type
boolean

parse(objectDOM) → {JSON}

Parses an ImageType XML element from a portal document
Parameters:
Name Type Description
objectDOM XMLElement An ImageType XML element from a portal document
Source:
Returns:
The result of the parsed XML, in JSON. To be set directly on the model.
Type
JSON

updateDOM() → {XMLElement}

Makes a copy of the original XML DOM and updates it with the new values from the model
Source:
Returns:
An updated ImageType XML element from a portal document
Type
XMLElement

validate() → {Object}

Overrides the default Backbone.Model.validate.function() to check if this PortalImage model has all the required values necessary to save to the server.
Source:
Returns:
If there are errors, an object comprising error messages. If no errors, returns nothing.
Type
Object