Skip to content

Commit

Permalink
Merge branch 'MDL-56355-master' of git://github.com/ryanwyllie/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 24, 2016
2 parents 8cf4139 + 65be5b6 commit c071a83
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion message/output/popup/amd/src/notification_area_control_area.js
Expand Up @@ -30,6 +30,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio
CONTAINER: '[data-region="notification-area"]',
CONTENT: '[data-region="content"]',
NOTIFICATION: '[data-region="notification-content-item-container"]',
CAN_RECEIVE_FOCUS: 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',
};

var TEMPLATES = {
Expand Down Expand Up @@ -271,7 +272,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio

if (notificationElement && notificationElement.length) {
this.getRoot().find(SELECTORS.NOTIFICATION).removeClass('selected');
notificationElement.addClass('selected');
notificationElement.addClass('selected').find(SELECTORS.CAN_RECEIVE_FOCUS).focus();
var notificationId = notificationElement.attr('data-id');
var notification = this.getCacheNotification(notificationId);
this.scrollNotificationIntoView(notificationElement);
Expand Down Expand Up @@ -397,6 +398,8 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio
CustomEvents.events.activate,
CustomEvents.events.scrollBottom,
CustomEvents.events.scrollLock,
CustomEvents.events.up,
CustomEvents.events.down,
]);

this.getRoot().on(CustomEvents.events.scrollBottom, function() {
Expand All @@ -408,6 +411,22 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio
this.showNotification(notificationElement);
}.bind(this));

// Show the previous notification in the list.
this.getRoot().on(CustomEvents.events.up, SELECTORS.NOTIFICATION, function(e, data) {
var notificationElement = $(e.target).closest(SELECTORS.NOTIFICATION);
this.showNotification(notificationElement.prev());

data.originalEvent.preventDefault();
}.bind(this));

// Show the next notification in the list.
this.getRoot().on(CustomEvents.events.down, SELECTORS.NOTIFICATION, function(e, data) {
var notificationElement = $(e.target).closest(SELECTORS.NOTIFICATION);
this.showNotification(notificationElement.next());

data.originalEvent.preventDefault();
}.bind(this));

this.getContainer().on(NotificationAreaEvents.notificationShown, function(e, notification) {
if (!notification.read) {
var element = this.getNotificationElement(notification.id);
Expand Down

0 comments on commit c071a83

Please sign in to comment.