Constructor
new NotificationModalView()
- Since:
- Source:
Extends
Members
checkboxes :Object.<string, HTMLInputElement>
Checkbox elements keyed by resource type.
Type:
-
Object.<string, HTMLInputElement>
- Source:
className :string
Classes to add to the modal.
Type:
- Source:
Methods
attributes() → {object}
DOM attributes for the modal root element.
- Source:
Returns:
Modal attributes.
-
Type
-
object
cancelChanges(event)
Cancel changes, restore the last saved state, and close the modal.
Parameters:
| Name |
Type |
Description |
event |
Event
|
The click event. |
- Source:
events() → {object}
The events this view listens for.
- Source:
Returns:
Backbone events hash.
-
Type
-
object
getErrorCode(error, fallbackCodeopt) → {string}
Get an error code from an Error, string, or fallback.
Parameters:
| Name |
Type |
Attributes |
Description |
error |
Error
|
string
|
|
Error or code. |
fallbackCode |
string
|
<optional>
|
Fallback code. |
- Source:
Returns:
Error code.
-
Type
-
string
getErrorMessage(code) → {string}
Get a display message for an error code.
Parameters:
| Name |
Type |
Description |
code |
string
|
Error code. |
- Source:
Returns:
Display message.
-
Type
-
string
getModalTitle() → {string}
Get the modal title.
- Source:
Returns:
Modal title.
-
Type
-
string
getModalTitleOptions() → {Object}
Build template data for the modal title.
- Source:
Returns:
Modal title template data.
-
Type
-
Object
getSelectedResourceTypes() → {Array.<string>}
Get selected resource type names in configured display order.
- Source:
Returns:
Selected resource types.
-
Type
-
Array.<string>
handleHidden()
Reset unsaved form edits after the modal closes
- Source:
handleModelReset()
Re-render after model configuration or auth changes
- Source:
handleSubscriptionsSaved(payload)
Re-emit the model saved event for parent views.
Parameters:
| Name |
Type |
Description |
payload |
object
|
Saved subscription payload. |
- Source:
hide()
Hide the modal
- Source:
initialize(optionsopt)
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
View options.
Properties
| Name |
Type |
Attributes |
Description |
model |
ObjectNotification
|
<optional>
|
Model for this modal. |
prefixUrl |
string
|
<optional>
|
Override for the Notification
Service URL. |
apiVersion |
string
|
false
|
<optional>
|
Override for the API
version. |
resourceTypes |
Array.<object>
|
<optional>
|
Override for available
resource types. |
pid |
string
|
<optional>
|
PID to subscribe or unsubscribe from. |
title |
string
|
<optional>
|
Dataset title to display in the modal. |
metadataModel |
Backbone.Model
|
<optional>
|
Metadata model used to
get a dataset title. |
buttonEl |
HTMLElement
|
<optional>
|
Button that opens the modal. |
|
- Source:
initializeModal()
Initialize Bootstrap modal behavior and modal lifecycle events
- Source:
isVisible() → {boolean}
Check whether the modal is visible.
- Source:
Returns:
True when visible.
-
Type
-
boolean
loadSubscriptions() → {Promise.<void>}
Fetch the current subscriptions for this PID and update the checkboxes.
- Source:
Returns:
Resolves when subscriptions have loaded.
-
Type
-
Promise.<void>
Cleanup listeners when the view is removed.
- Source:
Returns:
View instance.
-
Type
-
NotificationModalView
removeError()
Remove the active status/error message
- Source:
Render the notification subscription modal.
- Source:
Returns:
The view instance.
-
Type
-
NotificationModalView
renderModalTitle(titleEl, options)
Render the modal title as a prefix plus emphasized dataset title.
Parameters:
| Name |
Type |
Description |
titleEl |
HTMLElement
|
Title element. |
options |
object
|
Title options.
Properties
| Name |
Type |
Attributes |
Description |
title |
string
|
|
Full fallback title. |
datasetTitle |
string
|
<optional>
|
Full dataset title. |
displayDatasetTitle |
string
|
<optional>
|
Truncated dataset title. |
|
- Source:
renderNotificationTypes()
Render all configured resource type checkboxes
- Source:
renderType(options) → {HTMLElement}
Renders a checkbox, label, and description for a notification type.
Parameters:
| Name |
Type |
Description |
options |
object
|
Notification type options.
Properties
| Name |
Type |
Description |
type |
string
|
The notification type identifier. |
label |
string
|
A user-friendly label for the type. |
description |
string
|
A description of the notification
type. |
|
- Source:
Returns:
The rendered notification type row.
-
Type
-
HTMLElement
Reset checkboxes to the last loaded or saved subscription state
- Source:
saveChanges(event) → {Promise.<void>}
Save the selected notification settings.
Parameters:
| Name |
Type |
Description |
event |
Event
|
The click event. |
- Source:
Returns:
Resolves when save completes.
-
Type
-
Promise.<void>
setCheckboxes(resourceTypes)
Set checkbox values from resource type names.
Parameters:
| Name |
Type |
Description |
resourceTypes |
Array.<string>
|
Resource type names to check. |
- Source:
Make the modal visible and fetch the user's current subscriptions.
- Source:
Returns:
The view instance.
-
Type
-
NotificationModalView
showError(error, fallbackCodeopt)
Display an error message in the view.
Parameters:
| Name |
Type |
Attributes |
Description |
error |
Error
|
string
|
|
Error or error code. |
fallbackCode |
string
|
<optional>
|
Fallback message code. |
- Source:
showMissingEmailPrompt()
Prompt users without an email address to update account settings
- Source:
showStatus(message, classesopt)
Display a status message inside the modal.
Parameters:
| Name |
Type |
Attributes |
Description |
message |
string
|
HTMLElement
|
|
Status message. |
classes |
string
|
<optional>
|
Alert classes. |
- Source:
template(options) → {HTMLElement}
Render the modal shell.
Parameters:
| Name |
Type |
Description |
options |
object
|
Template options.
Properties
| Name |
Type |
Attributes |
Description |
title |
string
|
|
Modal title. |
datasetTitle |
string
|
<optional>
|
Full dataset title for tooltip
display. |
displayDatasetTitle |
string
|
<optional>
|
Dataset title for display
in the modal header. |
|
- Source:
Returns:
Modal element.
-
Type
-
HTMLElement
toggleNotificationType(event)
Toggle a notification type when its row is clicked.
Parameters:
| Name |
Type |
Description |
event |
Event
|
Click event. |
- Source:
truncateDatasetTitle(title) → {string}
Truncate long dataset titles in the modal header.
Parameters:
| Name |
Type |
Description |
title |
string
|
Dataset title. |
- Source:
Returns:
Display title.
-
Type
-
string
updateControlState()
Enable or disable controls based on loading and setup state
- Source:
updateEmailMessage()
Show the notification email address in the modal footer
- Source:
Update the opener button title with the current error when possible.
Parameters:
| Name |
Type |
Description |
message |
string
|
Tooltip text. |
- Source: