dc9bd97eb4
* Latest JQuery 2.x * Latest angular * Last 2.x bootstrap * Last 3.x font-awesome * Last compatible angular-bootstrap UI (0.8) This fixes some nasty display issues, such as items starting out at uncollapsed, to be immediately collapsed after the load. Also it seems to improve performance a bit in certain areas, while performance regressions in other areas are neglectable.
25 lines
613 B
JavaScript
25 lines
613 B
JavaScript
angular.module('webui.ctrls.alert', [
|
|
'webui.services.alerts'
|
|
])
|
|
.controller('AlertCtrl', ['$scope', '$alerts', '$sce',
|
|
function(scope, alerts, sce) {
|
|
scope.pendingAlerts = [];
|
|
|
|
scope.removeAlert = function(ind) {
|
|
this.pendingAlerts.splice(ind, 1);
|
|
};
|
|
|
|
alerts.addAlerter(function(msg, type) {
|
|
type = type || 'warning';
|
|
var obj = { msg: sce.trustAsHtml(msg), type: type };
|
|
scope.pendingAlerts.push(obj);
|
|
|
|
setTimeout(function() {
|
|
var ind = scope.pendingAlerts.indexOf(obj);
|
|
if (ind != -1) scope.removeAlert(ind);
|
|
}, 10000);
|
|
|
|
scope.$digest();
|
|
});
|
|
}]);
|