Constructor
new PortEditorImageView()
Members
className :string
The HTML classes to use for this view's element
Type:
- string
editorView :PortalEditorView
A reference to the PortalEditorView
Type:
events :Object
The events this view will listen to and the associated function to call.
Type:
- Object
imageHeight :number
The maximum height of the image preview. If set to false,
no css width property is set.
Type:
- number
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
imageUploaderContainer :string
A jQuery selector for the element that the ImageUploaderView should be inserted into
Type:
- string
imageUploadInstructions :Array.<string>
Text to instruct the user how to upload an image
Type:
- Array.<string>
imageWidth :number|boolean
The display width of the image preview. If set to false,
no css width property is set.
Type:
- number | boolean
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
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
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
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
model :Image
The PortalImage model that is being edited
Type:
- Image
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
parentModel :Portal
The Portal model that contains the PortalImage
Type:
- Portal
removeButton :boolean
Whether or not a remove button should be shown.
Type:
- boolean
tagName :string
The HTML tag name to use for this view's element
Type:
- string
template
References to templates for this view. HTML files are converted to Underscore.js templates
type :string
The type of View this is
Type:
- string
uploader :ImageUploader
The ImageUploaderView created and used by this ImageEdit view.
Type:
- ImageUploader
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
Methods
hideRemovePreview()
Removes the "remove-preview" class which will hide the preview for removing this image, via CSS
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 |
onClose()
This function is called whenever this view is about to be removed from the page.
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.
removeSelf()
removeSelf - Removes this ImageEdit view and the associated PortalImage
model from the parent Portal model.
removeValidation()
removeValidation - Remove displayed validation errors, if any
render()
Renders this view
showRemovePreview()
Add the "remove-preview" class which will show a preview for removing this image, via CSS
showValidation()
showValidation - show validation errors for this ImageEdit view