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/copy-box.js
Joseph Schorr 5cde147426 Fix clipboard copy box to not cause reflow
Instead, we now put the "Copied" message inline in the box and have it both fade and slide rightward away
2018-09-18 14:17:33 -04:00

23 lines
660 B
JavaScript

/**
* An element which displays a textfield with a "Copy to Clipboard" icon next to it.
*/
angular.module('quay').directive('copyBox', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/copy-box.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'value': '=value',
},
controller: function($scope, $element, $rootScope) {
$scope.disabled = false;
var number = $rootScope.__copyBoxIdCounter || 0;
$rootScope.__copyBoxIdCounter = number + 1;
$scope.inputId = "copy-box-input-" + number;
}
};
return directiveDefinitionObject;
});