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/source-commit-link.js

25 lines
717 B
JavaScript
Raw Normal View History

2015-02-26 22:45:28 +00:00
/**
* An element which displays a link to a commit in Git or Mercurial or another source control.
*/
angular.module('quay').directive('sourceCommitLink', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/source-commit-link.html',
replace: false,
2015-04-30 19:33:19 +00:00
transclude: true,
2015-02-26 22:45:28 +00:00
restrict: 'C',
scope: {
'commitSha': '=commitSha',
2015-04-30 19:33:19 +00:00
'urlTemplate': '=urlTemplate',
'showTransclude': '=showTransclude'
2015-02-26 22:45:28 +00:00
},
controller: function($scope, $element) {
$scope.getUrl = function(sha, template) {
2015-05-04 16:17:58 +00:00
if (!template) { return ''; }
2015-02-26 22:45:28 +00:00
return template.replace('{sha}', sha);
};
}
};
return directiveDefinitionObject;
});