message_popup/notification_area_control_area

Controls the notification area on the notification page.

Source:
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Methods

(inner) getCacheNotification(id) → {object}

Source:

Retrieve a notification from the cache.

Parameters:
Name Type Description
id int

The id for the notification you wish to retrieve

Returns:

A notification (as returned by a webservice)

Type
object

(inner) getContainer() → {object}

Source:

Get the container element (which the control area is within).

Returns:

jQuery element

Type
object

(inner) getContent() → {object}

Source:

Get the control area content element.

Returns:

jQuery element

Type
object

(inner) getLimit() → {int}

Source:

Get the limit value for the paginated loading of the notifications.

Returns:
Type
int

(inner) getNotificationElement(id) → {object|null}

Source:

Find the notification element in the control area for the given id.

Parameters:
Name Type Description
id int

The notification id

Returns:

jQuery element or null

Type
object | null

(inner) getOffset() → {int}

Source:

Get the offset value for paginated loading of the notifications.

Returns:
Type
int

(inner) getRoot() → {object}

Source:

Get the root element.

Returns:

jQuery element

Type
object

(inner) getUserId() → {int}

Source:

Get the user id.

Returns:
Type
int

(inner) hasDoneInitialLoad() → {bool}

Source:

Check if the first load of notifications has been triggered.

Returns:

true if first notification loaded, false otherwise

Type
bool

(inner) hasLoadedAllContent() → {bool}

Source:

Check if all of the notifications have been loaded.

Returns:
Type
bool

(inner) incrementOffset()

Source:

Increment the offset by the limit amount.

(inner) loadMoreNotifications() → {object}

Source:

Load notifications from the server and render them.

Returns:

jQuery promise

Type
object

(inner) markNotificationAsRead(notificationElement) → {object}

Source:

Send a request to mark the notification as read in the server and remove the unread status from the element.

Parameters:
Name Type Description
notificationElement object

The jQuery notification element

Returns:

jQuery promise

Type
object

(inner) registerEventListeners()

Source:

Create the event listeners for the control area.

(inner) renderNotifications(notifications) → {object}

Source:

Render the notification data with the appropriate template and add it to the DOM.

Parameters:
Name Type Description
notifications array

Array of notification data

Returns:

jQuery promise that is resolved when all notifications have been rendered and added to the DOM

Type
object

(inner) scrollNotificationIntoView(notificationElement)

Source:

Scroll the notification element into view within the control area, if it isn't already visible.

Parameters:
Name Type Description
notificationElement object

The jQuery notification element

(inner) setCacheNotification(notification)

Source:

Save a notification in the cache.

Parameters:
Name Type Description
notification object

A notification returned by a webservice

(inner) setLimit(value)

Source:

Set the limit value for the paginated loading of the notifications.

Parameters:
Name Type Description
value int

The new limit value

(inner) setLoadedAllContent(val)

Source:

Set the state of the loaded all content property.

Parameters:
Name Type Description
val bool

True if all content is loaded, false otherwise

(inner) setOffset(value)

Source:

Set the offset value for the paginated loading of the notifications.

Parameters:
Name Type Description
value int

The new offset value

(inner) showNotification(notificationElement)

Source:

Show the full notification for the given notification element. The notification context is retrieved from the cache and send as data with an event to be rendered in the content area.

Parameters:
Name Type Description
notificationElement int | object

The notification id or jQuery notification element

(inner) startLoading()

Source:

Flag the control area as loading.

(inner) stopLoading()

Source:

Remove the loading flag from the control area.