mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 22:18:01 -03:30
Add SeeMore and SeeLess link actions
This commit is contained in:
parent
a27bd045de
commit
cc94d724ec
@ -62,13 +62,6 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
||||
});
|
||||
}
|
||||
|
||||
if (list.fields.scm_revision && $scope.options &&
|
||||
$scope.options.hasOwnProperty('scm_revision')) {
|
||||
console.log(list.fields.scm_revision);
|
||||
itm.scm_revision = $filter('limitTo')(itm.scm_revision, 7, 0);
|
||||
|
||||
}
|
||||
|
||||
buildTooltips(itm);
|
||||
|
||||
});
|
||||
|
||||
@ -13,9 +13,10 @@ import { N_ } from '../i18n';
|
||||
import GetProjectPath from './factories/get-project-path.factory';
|
||||
import GetProjectIcon from './factories/get-project-icon.factory';
|
||||
import GetProjectToolTip from './factories/get-project-tool-tip.factory';
|
||||
import revisions from './revisions/main';
|
||||
|
||||
export default
|
||||
angular.module('Projects', [])
|
||||
angular.module('Projects', [revisions.name])
|
||||
.controller('ProjectsList', ProjectsList)
|
||||
.controller('ProjectsAdd', ProjectsAdd)
|
||||
.controller('ProjectsEdit', ProjectsEdit)
|
||||
|
||||
@ -50,16 +50,7 @@ export default ['i18n', function(i18n) {
|
||||
excludeModal: true,
|
||||
columnClass: 'col-lg-4 col-md-2 col-sm-3 hidden-xs',
|
||||
class: 'List-staticColumnAdjacent--monospace',
|
||||
ngBind: 'project.scm_revision',
|
||||
badgeCustom: true,
|
||||
badgePlacement: 'right',
|
||||
badgeIcon: `<a href=""
|
||||
aw-tool-tip="{{'See More or See Less'|translate}}"
|
||||
ng-if="project.scm_revision.length > 5"
|
||||
data-placement="top">See More</a>
|
||||
<a href=""
|
||||
ng-if="project.scm_revision.length < 5"
|
||||
data-placement="top">See Less</a>`
|
||||
type: 'revision'
|
||||
},
|
||||
last_updated: {
|
||||
label: i18n._('Last Updated'),
|
||||
|
||||
11
awx/ui/client/src/projects/revisions/main.js
Normal file
11
awx/ui/client/src/projects/revisions/main.js
Normal file
@ -0,0 +1,11 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import revisions from './revisions.directive';
|
||||
|
||||
export default
|
||||
angular.module('revisions', [])
|
||||
.directive('revisions', revisions);
|
||||
24
awx/ui/client/src/projects/revisions/revisions.directive.js
Normal file
24
awx/ui/client/src/projects/revisions/revisions.directive.js
Normal file
@ -0,0 +1,24 @@
|
||||
export default
|
||||
[ 'templateUrl',
|
||||
'Rest',
|
||||
'$q',
|
||||
'$filter',
|
||||
function(templateUrl, Rest, $q, $filter) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: false,
|
||||
templateUrl: templateUrl('projects/revisions/revisions'),
|
||||
link: function(scope) {
|
||||
var full_revision = scope.project.scm_revision;
|
||||
console.log(scope.project.scm_revision);
|
||||
scope.seeMoreInactive = true;
|
||||
scope.count = scope.project.scm_revision.length;
|
||||
scope.revisionHash = $filter('limitTo')(full_revision, 7, 0);
|
||||
|
||||
scope.Copy = function() {
|
||||
console.log('copy');
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
];
|
||||
@ -0,0 +1,9 @@
|
||||
<div class="Revision-tag">
|
||||
<span class="Revision-name">{{revisionHash}}</span>
|
||||
</div>
|
||||
<div class="Revision-seeMoreLess" ng-if="count > 7 && seeMoreInactive" ng-click="seeMore()">
|
||||
View More
|
||||
</div>
|
||||
<div class="Revision-seeMoreLess" ng-if="count > 7 && !seeMoreInactive" ng-click="seeLess()">
|
||||
View Less
|
||||
</div>
|
||||
@ -501,7 +501,12 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
<owner-list></owner-list>
|
||||
</td>
|
||||
`;
|
||||
}else if (field.type === 'badgeCount') {
|
||||
} else if (field.type === 'revision') {
|
||||
html += `
|
||||
<td>
|
||||
<revisions></revisions>
|
||||
</td>`;
|
||||
} else if (field.type === 'badgeCount') {
|
||||
html = BadgeCount(params);
|
||||
} else if (field.type === 'badgeOnly') {
|
||||
html = Badge(field);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user