Constructor
new PortalEditorView()
- Source:
Extends
Members
accessPolicyControlContainer :string
The selector for the HTML element that will contain a button/link/control for
opening the AccessPolicyView modal window. If this element doesn't exist on the page,
then the AccessPolicyView will be inserted into the `accessPolicyViewContainer` directly, rather than a modal window.
Type:
- Inherited From:
- Source:
accessPolicyModalID :string
The text to use in the editor submit button
Type:
- Inherited From:
- Source:
accessPolicyViewContainer :string
The selector for the HTML element that will contain the AccessPolicyView.
If this element doesn't exist on the page, then the AccessPolicyView will not be inserted into the page.
If a `accessPolicyControlContainer` element is on the page, then this element will
contain the modal window element.
Type:
- Inherited From:
- Source:
activeSectionLabel :string
The currently active editor section. e.g. Data, Metrics, Settings, etc.
Type:
- Source:
editorSubmitMessageTemplate
References to templates for this view. HTML files are converted to Underscore.js templates
- Overrides:
- Source:
el :string|DOMElement
The element this view is contained in. A jQuery selector or the element itself.
Type:
- Inherited From:
- Source:
events :Object
The events this view will listen to and the associated function to call.
This view will inherit events from the parent class, EditorView.
Type:
- Overrides:
- Source:
model :Portal
The PortalModel that is being edited
Type:
- Source:
newPortalActiveSectionLabel :string
When a new portal is being created, this is the label of the section that will be active when the editor first renders
Type:
- Source:
newPortalTempName :string
A temporary name to use for portals when they are first created but don't have a label yet.
This name should only be used in views, and never set on the model so it doesn't risk getting
serialized and saved.
Type:
- Source:
portEditLogoContainer :string
A jQuery selector for the element that the portal logo image uploader
should be inserted into
Type:
- Source:
portEditSectionsContainer :string
A jQuery selector for the element that the PortEditorSectionsView should be inserted into
Type:
- Source:
portalIdentifier :string
The short name OR pid for the portal
Type:
- Source:
A reference to the PortEditorSectionsView for this instance of the PortEditorView
Type:
- Source:
submitButtonText :string
The text to use in the editor submit button
Type:
- Overrides:
- Source:
subviews :Array.<Backbone.View>
An array of Backbone Views that are contained in this view.
Type:
- 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:
- Source:
viewPortalLinks :string
A jQuery selector for links to view this portal
Type:
- Source:
Methods
authorizeUser()
The authorizeUser function checks if the current user is authorized
to edit the given PortalModel. If not, a message is displayed and
the view doesn't render anything else.
If the user isn't logged in at all, don't check for authorization and
display a message and login button.
- Source:
canClose() → {boolean}
Checks if there are unsaved changes in this Editor that should prevent closing of this view.
This function is also executed by the AppView, which controls the top-level navigation.
- Inherited From:
- Source:
Returns:
Returns true if this view should be closed. False if it should remain opened and active.
-
Type
-
boolean
cancel()
Cancel all edits in the editor by simply re-rendering the view
- Inherited From:
- Source:
checkValidity()
Check the validity of this view's model
- Inherited From:
- Source:
createModel()
Create a PortalModel object
- Source:
disableControls(messageopt, tooltipMessage)
Disable the Save button and display a message to explain why
Parameters:
| Name |
Type |
Attributes |
Description |
message |
string
|
<optional>
|
A short text message to display in the Save button |
tooltipMessage |
string
|
|
- A message that is the reason for buttons being disabled. This message will be displayed in a tooltip. |
- Since:
- Inherited From:
- Source:
enableControls()
- Since:
- Inherited From:
- Source:
getConfirmCloseMessage() → {string}
This function is called whenever the user is about to leave this view.
- Inherited From:
- Source:
Returns:
The message that asks the user if they are sure they want to close this view
-
Type
-
string
getErrorListItem(error) → {string}
Creates an HTML string to display this error message on the page. Errors can be
strings, arrays of strings, arrays of literal objects with string values, or a literal object with strings as the values.
Parameters:
| Name |
Type |
Description |
error |
string
|
Array.<string>
|
object
|
A single error message in string format or a collection of error strings as an array or object |
- Since:
- Inherited From:
- Source:
Returns:
The error message HTML
-
Type
-
string
getRequiredFields() → {object}
Gets a list of required fields for this editor, or an empty object if there are none.
- Since:
- Inherited From:
- Source:
Returns:
Required fields keyed by model attribute
-
Type
-
object
handleSaveCancel()
Trigger a save error with a message that the save was cancelled
- Inherited From:
- Source:
This function is called whenever the window is scrolled.
- Source:
hasUnsavedChanges() → {boolean}
Returns true if there are unsaved changes in this Editor
This function should be extended by each subclass of EditorView to check for unsaved changes for that model type
- Inherited From:
- Source:
Returns:
Whether this editor has unsaved changes
-
Type
-
boolean
hideControls()
Hide the editor footer controls (Save bar)
- Inherited From:
- Source:
hideLoading()
Hides the loading
- Overrides:
- Source:
hideSaving()
Remove the styles set in showSaving()
- Inherited From:
- Source:
initialize(options)
Is executed when a new PortalEditorView is created
Parameters:
| Name |
Type |
Description |
options |
Object
|
A literal object with options to pass to the view |
- Source:
isAccessPolicyEditEnabled() → {boolean}
Returns false in the base editor. Subclasses override this method to
enable access policy editing for supported model types.
- Since:
- Overrides:
- Source:
Returns:
Whether access policy editing is enabled
-
Type
-
boolean
onClose()
Perform clean-up functions when this view is about to be removed from the page or navigated away from.
- Overrides:
- Source:
removeAccessPolicyView()
Remove the current AccessPolicyView and its editor listener.
- Since:
- Inherited From:
- Source:
removeValidation()
Removes all the validation error styling and messaging from this view
- Overrides:
- Source:
render()
Renders the PortalEditorView
- Overrides:
- Source:
renderAccessPolicy(modelopt, optionsopt)
Renders the AccessPolicyView
Parameters:
| Name |
Type |
Attributes |
Description |
model |
Backbone.Model
|
<optional>
|
Model to render |
options |
object
|
<optional>
|
Access policy view options
Properties
| Name |
Type |
Attributes |
Description |
policy |
Array.<object>
|
<optional>
|
System Metadata access policy |
policyContext |
object
|
<optional>
|
Policy display/editor context |
onApply |
function
|
<optional>
|
Async apply callback |
packageLevel |
boolean
|
<optional>
|
Whether this edits package
level sharing |
|
- Inherited From:
- Source:
renderAccessPolicyControl()
Adds a Share button for editing the access policy
- Inherited From:
- Source:
renderEditorControls()
Adds top-level control elements to this editor.
- Inherited From:
- Source:
renderLogoEditor()
renderLogoEditor - Creates a new PortalImage model for the portal logo if
one doesn't exist already, then inserts an ImageEdit view into the
portEditLogoContainer.
- Source:
renderPortalEditor()
Renders the portal editor view once the portal view is created
- Source:
renderRequiredIcons(requiredFields)
Shows the required icons for the sections and fields that must be completed in this editor.
Parameters:
| Name |
Type |
Description |
requiredFields |
object
|
A literal object that specified which fields should be required.
The keys on the object map to model attributes, and the value is true if required, false if optional. |
- Inherited From:
- Source:
save()
Saves the model
- Inherited From:
- Source:
saveError(errorMsg)
When the object fails to save, tell the user
Parameters:
| Name |
Type |
Description |
errorMsg |
string
|
The error message resulting from a failed attempt to save |
- Inherited From:
- Source:
saveSuccess(savedObject)
When the object is saved successfully, tell the user.
Parameters:
| Name |
Type |
Description |
savedObject |
object
|
the object that was successfully saved |
- Overrides:
- Source:
setListeners()
Set listeners on the view's model.
This function centralizes all the listeners so that when/if the view's
model is replaced, the listeners can be reset.
- Inherited From:
- Source:
showAccessPolicyLoadError(message)
Shows an error in the AccessPolicy modal body.
Parameters:
| Name |
Type |
Description |
message |
string
|
Error message |
- Since:
- Inherited From:
- Source:
showAccessPolicyLoadingModal(e, messageopt) → {boolean}
Shows a loading state in the AccessPolicy modal.
Parameters:
| Name |
Type |
Attributes |
Description |
e |
Event
|
|
Click event |
message |
string
|
<optional>
|
Loading message |
- Since:
- Inherited From:
- Source:
Returns:
Whether the loading modal was shown
-
Type
-
boolean
showAccessPolicyModal(e, modelopt, optionsopt)
Shows the AccessPolicyView for the object being edited.
Parameters:
| Name |
Type |
Attributes |
Description |
e |
Event
|
|
Click event |
model |
Backbone.Model
|
null
|
<optional>
|
Model to show the view for |
options |
object
|
<optional>
|
Access policy view options
Properties
| Name |
Type |
Attributes |
Description |
packageLevel |
boolean
|
<optional>
|
Whether this edits package
level sharing |
|
- Inherited From:
- Source:
showControls()
Show the editor footer controls (Save bar)
- Inherited From:
- Source:
showFullPageAlert(message, type, emailBodyopt, emailSubjectopt)
Empty the body of this view and show a full-page alert message. The
message will not be dissmissable, and the user will not be able to
interact with the page until they refresh or navigate away. All
listeners will be removed.
Parameters:
| Name |
Type |
Attributes |
Description |
message |
string
|
|
The message to display in the alert |
type |
"warning"
|
"error"
|
"success"
|
"info"
|
|
The type of alert to
show. Defaults to "warning". |
emailBody |
string
|
<optional>
|
Optional. The body of the email to send
when the user clicks the "Email Support" button. |
emailSubject |
string
|
<optional>
|
Optional. The subject of the email to send
when the user clicks the "Email Support" button. |
- Since:
- Inherited From:
- Source:
showLoading(container, message)
Style the view to show that it is loading
Parameters:
| Name |
Type |
Description |
container |
string
|
DOMElement
|
The element to put the loading styling in. Either a jQuery selector or the element itself. |
message |
string
|
DOMElement
|
The message to display next to the loading icon. Either a jQuery selector or the element itself. |
- Inherited From:
- Source:
showNotFound()
If the given portal doesn't exist, display a Not Found message.
- Overrides:
- Source:
showSaving()
Change the styling of this view to show that the object is in the process of saving
- Inherited From:
- Source:
showSignIn()
Show Sign In buttons
- Overrides:
- Source:
showValidation()
When the Portal model has been flagged as invalid, show the validation error messages
- Overrides:
- Source:
showValidationMessage(elements, errorMsg)
Shows a validation error message and adds error styling to the given elements
Parameters:
| Name |
Type |
Description |
elements |
jQuery
|
The elements to add error styling and messaging to |
errorMsg |
string
|
The error message to display |
- Source:
toggleSectionLinks()
toggleSectionLinks - show or hide the section links. Used for the
mobile/small screen view of the portal.
- Source:
updateAlertOffset()
Keep fixed alerts below the visible part of the theme navigation.
- Source:
updateBasicText(eopt)
When a simple text input field loses focus, the corresponding model
attribute is updated with the value from the input field
Parameters:
| Name |
Type |
Attributes |
Description |
e |
Event
|
<optional>
|
The focusout event |
- Source: