diff --git a/awx/ui/client/lib/components/index.js b/awx/ui/client/lib/components/index.js index fa8b5d6d0b..40a0264e28 100644 --- a/awx/ui/client/lib/components/index.js +++ b/awx/ui/client/lib/components/index.js @@ -19,6 +19,7 @@ import panelBody from './panel/body.directive'; import popover from './popover/popover.directive'; import tab from './tabs/tab.directive'; import tabGroup from './tabs/group.directive'; +import truncate from './truncate/truncate.directive'; import BaseInputController from './input/base.controller'; import ComponentsStrings from './components.strings'; @@ -46,7 +47,8 @@ angular .directive('atPopover', popover) .directive('atTab', tab) .directive('atTabGroup', tabGroup) - .service('BaseInputController', BaseInputController) - .service('ComponentsStrings', ComponentsStrings); + .directive('atTruncate', truncate) + .service('ComponentsStrings', ComponentsStrings) + .service('BaseInputController', BaseInputController); diff --git a/awx/ui/client/lib/components/truncate/truncate.directive.js b/awx/ui/client/lib/components/truncate/truncate.directive.js new file mode 100644 index 0000000000..6ce69aed6b --- /dev/null +++ b/awx/ui/client/lib/components/truncate/truncate.directive.js @@ -0,0 +1,43 @@ +function atTruncateLink (scope, el, attr, ctrl) { + let truncateController = ctrl; + let string = attr.atTruncate; + let maxlength = attr.maxlength; + + truncateController.init(scope, string, maxlength); +} + +function AtTruncateController ($filter) { + let vm = this; + + let string, + maxlength; + + vm.init = (scope, _string_, _maxlength_) => { + string = _string_; + maxlength = _maxlength_; + vm.truncatedString = $filter('limitTo')(string, maxlength, 0); + } + +} + + +function atTruncate($filter) { + return { + restrict: 'EA', + replace: true, + transclude: true, + template: '{{vm.truncatedString}}', + controller: AtTruncateController, + controllerAs: 'vm', + link: atTruncateLink, + scope: { + maxLength: '@' + } + } +} + +atTruncate.$inject = [ + '$filter' +]; + +export default atTruncate; \ No newline at end of file diff --git a/awx/ui/client/src/projects/revisions/revisions.block.less b/awx/ui/client/src/projects/revisions/revisions.block.less index 084a8ba553..176a062bc1 100644 --- a/awx/ui/client/src/projects/revisions/revisions.block.less +++ b/awx/ui/client/src/projects/revisions/revisions.block.less @@ -10,13 +10,12 @@ } .RevisionHash-copy { - color: @default-link; - text-transform: uppercase; + color: @b7grey; cursor: pointer; - font-size: 11px; margin-left: 10px; } + .RevisionHash-copy:hover { - color: @default-link-hov; + color: @default-link; } \ No newline at end of file diff --git a/awx/ui/client/src/projects/revisions/revisions.directive.js b/awx/ui/client/src/projects/revisions/revisions.directive.js index 959b1c2232..bcd95b2054 100644 --- a/awx/ui/client/src/projects/revisions/revisions.directive.js +++ b/awx/ui/client/src/projects/revisions/revisions.directive.js @@ -1,20 +1,14 @@ export default - [ 'templateUrl', - 'Rest', - '$q', - '$filter', - function(templateUrl, Rest, $q, $filter) { + [ 'templateUrl', function(templateUrl) { return { restrict: 'E', templateUrl: templateUrl('projects/revisions/revisions'), link: function(scope) { - let full_revision = scope.project.scm_revision; - scope.revisionHash = $filter('limitTo')(full_revision, 7, 0); - scope.count = scope.project.scm_revision.length; - scope.copyRevisionHash = function() { + scope.copy = function() { scope.$emit('copied'); + let full_revision = scope.project.scm_revision; let textArea = document.createElement("textarea"); // Place in top-left corner of screen regardless of scroll position. diff --git a/awx/ui/client/src/projects/revisions/revisions.partial.html b/awx/ui/client/src/projects/revisions/revisions.partial.html index ff391e2ad3..75b2887d58 100644 --- a/awx/ui/client/src/projects/revisions/revisions.partial.html +++ b/awx/ui/client/src/projects/revisions/revisions.partial.html @@ -1,7 +1,7 @@
- {{revisionHash}} +
-
+
\ No newline at end of file