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/ui/feedback-bar.js
Joseph Schorr 3d6c92901c Switch to using an aggregated logs query and infinite scrolling
This should allow users to work with large logs set.

Fixes #294
2015-07-31 16:38:02 -04:00

37 lines
No EOL
1.1 KiB
JavaScript

/**
* An element which displays a feedback bar when an action has been taken.
*/
angular.module('quay').directive('feedbackBar', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/feedback-bar.html',
replace: false,
transclude: true,
restrict: 'C',
scope: {
'feedback': '=feedback'
},
controller: function($scope, $element, AvatarService, Config, UIService, $timeout, StringBuilderService) {
$scope.viewCounter = 0;
$scope.formattedMessage = '';
$scope.$watch('feedback', function(feedback) {
if (feedback) {
$scope.formattedMessage = StringBuilderService.buildTrustedString(feedback.message, feedback.data || {}, 'span');
$scope.viewCounter++;
} else {
$scope.viewCounter = 0;
}
});
$($element).find('.feedback-bar-element')
.on('webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationend',
function(e) {
$scope.$apply(function() {
$scope.viewCounter = 0;
});
});
}
};
return directiveDefinitionObject;
});