parent
d9bafa478b
commit
dcf8922799
5 changed files with 100 additions and 0 deletions
35
static/js/directives/ui/feedback-bar.js
Normal file
35
static/js/directives/ui/feedback-bar.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* 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) {
|
||||
$scope.viewCounter = 0;
|
||||
|
||||
$scope.$watch('feedback', function(feedback) {
|
||||
if (feedback) {
|
||||
$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;
|
||||
});
|
Reference in a new issue