Class: PortEditorImageView

PortEditorImageView()

A view that allows the user to upload an image as a DataONEObject

Constructor

new PortEditorImageView()

Source:

Members

className :string

The HTML classes to use for this view's element
Type:
  • string
Source:

editorView :PortalEditorView

A reference to the PortalEditorView
Type:
Source:

events :Object

The events this view will listen to and the associated function to call.
Type:
  • Object
Source:

imageHeight :number

The maximum height of the image preview. If set to false, no css width property is set.
Type:
  • number
Source:

imageTagName :string

The HTML tag name to insert the uploaded image into. Options are "img", in which case the image is inserted as an HTML , or "div", in which case the image is inserted as the background of a "div".
Type:
  • string
Source:

imageUploadInstructions :Array.<string>

Text to instruct the user how to upload an image
Type:
  • Array.<string>
Source:

imageUploaderContainer :string

A jQuery selector for the element that the ImageUploaderView should be inserted into
Type:
  • string
Source:

imageWidth :number|boolean

The display width of the image preview. If set to false, no css width property is set.
Type:
  • number | boolean
Source:

maxHeight :number

The maximum height for uploaded files. If a file is taller than this, it will be resized without warning before being uploaded. If set to null, the image won't be resized based on height (but might be depending on maxWidth).
Type:
  • number
Source:

maxWidth :number

The maximum width for uploaded files. If a file is wider than this, it will be resized without warning before being uploaded. If set to null, the image won't be resized based on width (but might be depending on maxHeight).
Type:
  • number
Source:

minHeight :number

The minimum required height of the image file. If set, the uploader will reject images that are shorter than this. If null, any image height is accepted.
Type:
  • number
Source:

minWidth :number

The minimum required height of the image file. If set, the uploader will reject images that are shorter than this. If null, any image height is accepted.
Type:
  • number
Source:

model :Image

The PortalImage model that is being edited
Type:
  • Image
Source:

nameLabel :string|boolean

Label for the first text input where the user enters the ImageModel label. If this is set to false, the label input will not be shown.
Type:
  • string | boolean
Source:

parentModel :Portal

The Portal model that contains the PortalImage
Type:
  • Portal
Source:

removeButton :boolean

Whether or not a remove button should be shown.
Type:
  • boolean
Source:

tagName :string

The HTML tag name to use for this view's element
Type:
  • string
Source:

template

References to templates for this view. HTML files are converted to Underscore.js templates
Source:

type :string

The type of View this is
Type:
  • string
Source:

uploader :ImageUploader

The ImageUploaderView created and used by this ImageEdit view.
Type:
  • ImageUploader
Source:

urlLabel :string|boolean

Label for the second text input where the user enters the ImageModel associated URL. If this is set to false, the URL input will not be shown.
Type:
  • string | boolean
Source:

Methods

hideRemovePreview()

Removes the "remove-preview" class which will hide the preview for removing this image, via CSS
Source:

initialize(options)

Creates a new PortEditorImageView
Parameters:
Name Type Description
options Object A literal object with options to pass to the view
Properties:
Name Type Description
options.parentModel Portal Gets set as PortEditorImageView.parentModel
options.editorView PortalEditorView Gets set as PortEditorImageView.editorView
options.model PortalImage Gets set as PortEditorImageView.model
options.imageUploadInstructions Array.<string> Gets set as ImageUploaderView.imageUploadInstructions
options.nameLabel string Gets set as PortEditorImageView.nameLabel
options.urlLabel string Gets set as PortEditorImageView.urlLabel
options.imageTagName string Gets set as ImageUploaderView.imageTagName
options.removeButton string Gets set as ImageUploaderView.removeButton
options.imageWidth number Gets set as ImageUploaderView.width
options.imageHeight number Gets set as ImageUploaderView.height
options.minWidth number Gets set as ImageUploaderView.minWidth
options.minHeight number Gets set as ImageUploaderView.minHeight
options.maxWidth number Gets set as ImageUploaderView.maxWidth
options.maxHeight number Gets set as ImageUploaderView.maxHeight
Source:

onClose()

This function is called whenever this view is about to be removed from the page.
Source:

redoValidation()

redoValidation - Called when a user focuses out of input fields with the .basic-text class (organization name and associated URL), or when an image is successfully uploaded or removed. This function validates the PortalImage model again and shows errors if there are any.
Source:

removeSelf()

removeSelf - Removes this ImageEdit view and the associated PortalImage model from the parent Portal model.
Source:

removeValidation()

removeValidation - Remove displayed validation errors, if any
Source:

render()

Renders this view
Source:

showRemovePreview()

Add the "remove-preview" class which will show a preview for removing this image, via CSS
Source:

showValidation()

showValidation - show validation errors for this ImageEdit view
Source: