Start on the new build view
This commit is contained in:
parent
5cc1c90021
commit
e227d7e526
30 changed files with 816 additions and 11 deletions
41
static/js/directives/ui/source-ref-link.js
Normal file
41
static/js/directives/ui/source-ref-link.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* An element which displays a link to a branch or tag in source control.
|
||||
*/
|
||||
angular.module('quay').directive('sourceRefLink', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/source-ref-link.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'ref': '=ref',
|
||||
'branchTemplate': '=branchTemplate',
|
||||
'tagTemplate': '=tagTemplate'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
$scope.getKind = function(ref) {
|
||||
var parts = (ref || '').split('/');
|
||||
if (parts.length < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return parts[1];
|
||||
};
|
||||
|
||||
$scope.getTitle = function(ref) {
|
||||
var parts = (ref || '').split('/');
|
||||
if (parts.length < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return parts[2];
|
||||
};
|
||||
|
||||
$scope.getUrl = function(ref, template, kind) {
|
||||
return template.replace('{' + kind + '}', $scope.getTitle(ref));
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
Reference in a new issue