mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
Create basic toggle tag component
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
@import 'relaunchButton/_index';
|
@import 'relaunchButton/_index';
|
||||||
@import 'tabs/_index';
|
@import 'tabs/_index';
|
||||||
@import 'tag/_index';
|
@import 'tag/_index';
|
||||||
|
@import 'toggle/_index';
|
||||||
@import 'truncate/_index';
|
@import 'truncate/_index';
|
||||||
@import 'utility/_index';
|
@import 'utility/_index';
|
||||||
@import 'code-mirror/_index';
|
@import 'code-mirror/_index';
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import sideNavItem from '~components/layout/side-nav-item.directive';
|
|||||||
import tab from '~components/tabs/tab.directive';
|
import tab from '~components/tabs/tab.directive';
|
||||||
import tabGroup from '~components/tabs/group.directive';
|
import tabGroup from '~components/tabs/group.directive';
|
||||||
import tag from '~components/tag/tag.directive';
|
import tag from '~components/tag/tag.directive';
|
||||||
|
import toggleTag from '~components/toggle/toggle-tag.directive';
|
||||||
import topNavItem from '~components/layout/top-nav-item.directive';
|
import topNavItem from '~components/layout/top-nav-item.directive';
|
||||||
import truncate from '~components/truncate/truncate.directive';
|
import truncate from '~components/truncate/truncate.directive';
|
||||||
import atCodeMirror from '~components/code-mirror';
|
import atCodeMirror from '~components/code-mirror';
|
||||||
@@ -80,6 +81,7 @@ angular
|
|||||||
.directive('atTab', tab)
|
.directive('atTab', tab)
|
||||||
.directive('atTabGroup', tabGroup)
|
.directive('atTabGroup', tabGroup)
|
||||||
.directive('atTag', tag)
|
.directive('atTag', tag)
|
||||||
|
.directive('atToggleTag', toggleTag)
|
||||||
.directive('atTopNavItem', topNavItem)
|
.directive('atTopNavItem', topNavItem)
|
||||||
.directive('atTruncate', truncate)
|
.directive('atTruncate', truncate)
|
||||||
.service('BaseInputController', BaseInputController)
|
.service('BaseInputController', BaseInputController)
|
||||||
|
|||||||
@@ -167,6 +167,7 @@
|
|||||||
.at-RowItem-tagContainer {
|
.at-RowItem-tagContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: @at-margin-left-list-row-item-tag-container;
|
margin-left: @at-margin-left-list-row-item-tag-container;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.at-RowItem-tag {
|
.at-RowItem-tag {
|
||||||
@@ -175,8 +176,7 @@
|
|||||||
border-radius: @at-border-radius;
|
border-radius: @at-border-radius;
|
||||||
color: @at-color-list-row-item-tag;
|
color: @at-color-list-row-item-tag;
|
||||||
font-size: @at-font-size-list-row-item-tag;
|
font-size: @at-font-size-list-row-item-tag;
|
||||||
margin-left: @at-margin-left-list-row-item-tag;
|
margin: @at-space;
|
||||||
margin-top: @at-margin-top-list-row-item-tag;
|
|
||||||
padding: @at-padding-list-row-item-tag;
|
padding: @at-padding-list-row-item-tag;
|
||||||
line-height: @at-line-height-list-row-item-tag;
|
line-height: @at-line-height-list-row-item-tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
template-type="smartStatus.type" ng-if="smartStatus">
|
template-type="smartStatus.type" ng-if="smartStatus">
|
||||||
</aw-smart-status>
|
</aw-smart-status>
|
||||||
<div class="at-RowItem-tagContainer" ng-if="tagValues && tagValues.length">
|
<div class="at-RowItem-tagContainer" ng-if="tagValues && tagValues.length">
|
||||||
<div ng-repeat="tag in tagValues" class="at-RowItem-tag at-RowItem-tag--primary">
|
<!-- <div ng-repeat="tag in tagValues" class="at-RowItem-tag at-RowItem-tag--primary">
|
||||||
<span ng-switch="tag.kind" class="at-RowItem-tagIcon"
|
<span ng-switch="tag.kind" class="at-RowItem-tagIcon"
|
||||||
ng-if="tagsAreCreds">
|
ng-if="tagsAreCreds">
|
||||||
<span class="fa fa-cloud" ng-switch-when="cloud"></span>
|
<span class="fa fa-cloud" ng-switch-when="cloud"></span>
|
||||||
@@ -53,6 +53,10 @@
|
|||||||
<span class="fa fa-archive" ng-switch-when="vault"></span>
|
<span class="fa fa-archive" ng-switch-when="vault"></span>
|
||||||
</span>
|
</span>
|
||||||
{{ tag.name }}
|
{{ tag.name }}
|
||||||
|
</div> -->
|
||||||
|
<div ng-if="tagValues.length <= 5">
|
||||||
|
<at-tag tag="tagValues"></at-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<at-toggle-tag tags="tagValues" ng-if="tagValues.length > 5"></at-toggle-tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
4
awx/ui/client/lib/components/toggle/_index.less
Normal file
4
awx/ui/client/lib/components/toggle/_index.less
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.ToggleComponent-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
2
awx/ui/client/lib/components/toggle/constants.js
Normal file
2
awx/ui/client/lib/components/toggle/constants.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export const TRUNCATE_LENGTH = 5;
|
||||||
|
export const TRUNCATED = true;
|
||||||
29
awx/ui/client/lib/components/toggle/toggle-tag.directive.js
Normal file
29
awx/ui/client/lib/components/toggle/toggle-tag.directive.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { TRUNCATED, TRUNCATE_LENGTH } from './constants';
|
||||||
|
|
||||||
|
const templateUrl = require('~components/toggle/toggle-tag.partial.html');
|
||||||
|
|
||||||
|
function controller () {
|
||||||
|
const vm = this;
|
||||||
|
vm.truncatedLength = TRUNCATE_LENGTH;
|
||||||
|
vm.truncated = TRUNCATED;
|
||||||
|
|
||||||
|
vm.toggle = () => {
|
||||||
|
vm.truncated = !vm.truncated;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function atToggleTag () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
|
controller,
|
||||||
|
controllerAs: 'vm',
|
||||||
|
templateUrl,
|
||||||
|
scope: {
|
||||||
|
tags: '=',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default atToggleTag;
|
||||||
14
awx/ui/client/lib/components/toggle/toggle-tag.partial.html
Normal file
14
awx/ui/client/lib/components/toggle/toggle-tag.partial.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<div class="ToggleComponent-wrapper">
|
||||||
|
<div ng-show="vm.truncated" class="ToggleComponent-container">
|
||||||
|
<div ng-repeat="tag in tags | limitTo: vm.truncatedLength">
|
||||||
|
<at-tag tag="tag.name"></at-tag>
|
||||||
|
</div>
|
||||||
|
<button ng-click="vm.toggle()">VIEW MORE</button>
|
||||||
|
</div>
|
||||||
|
<div ng-show="!vm.truncated" class="ToggleComponent-container">
|
||||||
|
<div ng-repeat="tag in tags">
|
||||||
|
<at-tag tag="tag.name"></at-tag>
|
||||||
|
</div>
|
||||||
|
<button ng-click="vm.toggle()">VIEW LESS</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user