Added jsdoc and moved MessageController to dialogs from notifications

This commit is contained in:
Henry 2015-10-22 15:10:53 -07:00
parent 0053989de8
commit 109ae3323d
5 changed files with 55 additions and 16 deletions

View File

@ -43,6 +43,13 @@
"key": "overlay",
"templateUrl": "templates/overlay.html"
}
],
"controllers": [
{
"key": "MessageController",
"implementation": "MessageController.js",
"depends": ["$scope"]
}
]
}
}

View File

@ -22,10 +22,23 @@
/*global define*/
define(
['./MessageSeverity'],
['../../notification/src/MessageSeverity'],
function (MessageSeverity) {
"use strict";
/**
* A controller for the message view which used to represent a
* message to the user in the dialogs and notifications systems. The
* message view (../res/templates/message.html) is included
* from the blocking message dialog
* (../res/templates/overlay-blocking-message.html),
* and the message list (../res/templates/overlay-message-list.html)
* shown from the notifications indicator
* @param $scope
* @constructor
* @see DialogService#showBlockingMessage
* @see NotificationService
*/
function MessageController($scope) {
$scope.MessageSeverity = MessageSeverity;
}

View File

@ -25,10 +25,29 @@ define(
['../../../notification/src/MessageSeverity'],
function (MessageSeverity) {
"use strict";
/**
* A controller for banner notifications. Banner notifications are a
* non-blocking way of drawing the user's attention to an event such
* as system errors, or the progress or successful completion of an
* ongoing task. This controller provides scoped functions for
* dismissing and 'maximizing' notifications. See {@link NotificationService}
* for more details on Notifications.
*
* @param $scope
* @param notificationService
* @param dialogService
* @constructor
*/
function BannerController($scope, notificationService, dialogService) {
$scope.active = notificationService.active;
$scope.MessageSeverity = MessageSeverity;
$scope.action = function (action, $event){
/*
Prevents default 'maximize' behaviour when clicking on
notification button
*/
$event.stopPropagation();
return action();
};

View File

@ -21,11 +21,6 @@
}
],
"controllers": [
{
"key": "MessageController",
"implementation": "MessageController.js",
"depends": ["$scope"]
},
{
"key": "NotificationIndicatorController",
"implementation": "NotificationIndicatorController.js",

View File

@ -26,25 +26,30 @@ define(
function (MessageSeverity) {
"use strict";
/**
* Provides an indicator that is visible when there are
* banner notifications that have been minimized. Will also indicate
* the number of notifications. Notifications can be viewed by
* clicking on the indicator to launch a dialog showing a list of
* notifications.
* @param $scope
* @param notificationService
* @param dialogService
* @constructor
*/
function NotificationIndicatorController($scope, notificationService, dialogService) {
$scope.notifications = notificationService.notifications;
$scope.highest = notificationService.highest;
$scope.MessageSeverity = MessageSeverity;
/**
* Launch a dialog showing a list of current notifications.
*/
$scope.showNotificationsList = function(){
var model = {
title: "Messages",
severity: MessageSeverity.INFO,
actions: [
{
label: "Done",
action: function () {
dialogService.dismiss();
}
}
],
messages: []
severity: MessageSeverity.INFO
};
model.messages = notificationService.notifications;