Begun integration of Notifications framework with Charles' code
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
<div class="l-message-banner s-message-banner">
|
||||
<span class="banner-elem label">
|
||||
Objects not saved
|
||||
</span><mct-include key="'progress-bar'"
|
||||
class="banner-elem"
|
||||
ng-model="ngModel"
|
||||
ng-hide-x="ngModel.dialog.progress === undefined"></mct-include><a class="banner-elem l-action s-action">
|
||||
Try Again
|
||||
</a><a class="banner-elem ui-symbol close">
|
||||
x
|
||||
</a>
|
||||
<div ng-controller="BannerController">
|
||||
<div ng-show="active.notification"
|
||||
class="l-message-banner s-message-banner">
|
||||
<span class="banner-elem label">
|
||||
{{active.notification.title}}
|
||||
</span><mct-include key="'progress-bar'"
|
||||
class="banner-elem"
|
||||
ng-model="ngModel"
|
||||
ng-hide-x="ngModel.dialog.progress === undefined">
|
||||
|
||||
</mct-include>
|
||||
<a ng-hide="active.notification.progress === undefined"
|
||||
class="banner-elem l-action s-action">
|
||||
Try Again
|
||||
</a>
|
||||
<a class="banner-elem ui-symbol close">x</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,7 +26,7 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
function BannerController($scope, notificationService){
|
||||
$scope.activeNotification = notificationService.active.Notification;
|
||||
$scope.active = notificationService.active;
|
||||
}
|
||||
return BannerController;
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_AUTO_DISMISS",
|
||||
"value": 2000
|
||||
"value": 3000
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
|
||||
@@ -93,8 +93,7 @@ define(
|
||||
* A context in which to hold the active notification and a
|
||||
* handle to its timeout.
|
||||
*/
|
||||
this.active = {
|
||||
};
|
||||
this.active = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +112,7 @@ define(
|
||||
*/
|
||||
NotificationService.prototype.success = function (notification) {
|
||||
notification.autoDismiss = notification.autoDismiss || true;
|
||||
NotificationService.prototype.notify(notification);
|
||||
this.notify(notification);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -126,7 +125,12 @@ define(
|
||||
NotificationService.prototype.notify = function (notification) {
|
||||
/*var notification = new Notification(model),
|
||||
that=this; */
|
||||
var that = this;
|
||||
var that = this,
|
||||
timeout;
|
||||
|
||||
if (notification.autoDismiss === true){
|
||||
notification.autoDismiss = this.DEFAULT_AUTO_DISMISS;
|
||||
}
|
||||
|
||||
this.notifications.push(notification);
|
||||
/*
|
||||
@@ -145,9 +149,12 @@ define(
|
||||
This notifcation has been added to queue and will be
|
||||
serviced as soon as possible.
|
||||
*/
|
||||
timeout = notification.autoDismiss ?
|
||||
notification.autoDismiss :
|
||||
this.DEFAULT_AUTO_DISMISS;
|
||||
this.active.timeout = this.$timeout(function () {
|
||||
that.dismissOrMinimize(that.active.notification);
|
||||
});
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -171,9 +178,9 @@ define(
|
||||
*/
|
||||
if (notification && (notification.autoDismiss
|
||||
|| this.selectNextNotification())) {
|
||||
timeout = isNaN(notification.autoDismiss) ?
|
||||
this.DEFAULT_AUTO_DISMISS :
|
||||
notification.autoDismiss;
|
||||
timeout = notification.autoDismiss ?
|
||||
notification.autoDismiss :
|
||||
this.DEFAULT_AUTO_DISMISS;
|
||||
|
||||
this.active.timeout = this.$timeout(function () {
|
||||
that.dismissOrMinimize(notification);
|
||||
@@ -258,5 +265,7 @@ define(
|
||||
this.dismiss(notification);
|
||||
}
|
||||
};
|
||||
|
||||
return NotificationService;
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user