This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/quay-message-bar.js
2019-11-12 11:09:47 -05:00

28 lines
820 B
JavaScript

/**
* An element which displays a message for users to read.
*/
angular.module('quay').directive('quayMessageBar', function () {
return {
priority: 0,
templateUrl: '/static/directives/quay-message-bar.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {},
controller: function ($scope, $element, $rootScope, ApiService, NotificationService,
StateService) {
$scope.messages = [];
$scope.NotificationService = NotificationService;
StateService.updateStateIn($scope, function(state) {
$scope.inReadOnlyMode = state.inReadOnlyMode;
});
ApiService.getGlobalMessages().then(function (data) {
$scope.messages = data['messages'] || [];
}, function (resp) {
return true;
});
}
};
});