|
|
@ -27,34 +27,30 @@ |
|
|
|
//++
|
|
|
|
//++
|
|
|
|
|
|
|
|
|
|
|
|
// TODO move to UI components
|
|
|
|
// TODO move to UI components
|
|
|
|
module.exports = function($rootScope, $timeout, ConfigurationService) { |
|
|
|
module.exports = function($rootScope, $timeout, ConfigurationService, NotificationsService) { |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
restrict: 'E', |
|
|
|
restrict: 'E', |
|
|
|
replace: true, |
|
|
|
replace: true, |
|
|
|
scope: {}, |
|
|
|
scope: {}, |
|
|
|
templateUrl: '/templates/components/flash_message.html', |
|
|
|
templateUrl: '/templates/components/flash_message.html', |
|
|
|
link: function(scope, element, attrs) { |
|
|
|
link: function() { |
|
|
|
$rootScope.$on('flashMessage', function(event, message) { |
|
|
|
$rootScope.$on('flashMessage', function(event, message) { |
|
|
|
scope.message = message; |
|
|
|
|
|
|
|
scope.flashType = 'notice'; |
|
|
|
|
|
|
|
scope.flashId = 'flash-notice'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fadeOutTime = attrs.fadeOutTime || 3000; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (message.isError) { |
|
|
|
if (message.isError) { |
|
|
|
scope.flashType = "errorExplanation"; |
|
|
|
if (message.text.length > 1) { |
|
|
|
scope.flashId = "errorExplanation"; |
|
|
|
NotificationsService.addError(message.text, []); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
NotificationsService.addError('', message.text); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
// not using $timeout to allow capybara to not wait until timeout is done with
|
|
|
|
if (message.text.length > 1) { |
|
|
|
// scope apply
|
|
|
|
NotificationsService.addSuccess(message.text, []); |
|
|
|
if (!ConfigurationService.accessibilityModeEnabled() && !message.isPermanent) { |
|
|
|
} |
|
|
|
setTimeout(function() { |
|
|
|
else { |
|
|
|
scope.$apply(function() { |
|
|
|
NotificationsService.addSuccess('', message.text); |
|
|
|
scope.message = undefined; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}, fadeOutTime); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|