mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 04:47:44 -02:30
Refactor action/form structure
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
@import 'action/_index';
|
||||||
@import 'badge/_index';
|
@import 'badge/_index';
|
||||||
@import 'form/_index';
|
@import 'form/_index';
|
||||||
@import 'input/_index';
|
@import 'input/_index';
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.at-ActionGroup {
|
||||||
|
margin-top: @at-space-6x;
|
||||||
|
|
||||||
|
button:last-child {
|
||||||
|
margin-left: @at-space-5x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
16
awx/ui/client/components/action/action-group.directive.js
Normal file
16
awx/ui/client/components/action/action-group.directive.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
function atActionGroup (pathService) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
transclude: true,
|
||||||
|
replace: true,
|
||||||
|
templateUrl: pathService.getPartialPath('components/action/action-group'),
|
||||||
|
scope: {
|
||||||
|
col: '@',
|
||||||
|
pos: '@'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
atActionGroup.$inject = ['PathService'];
|
||||||
|
|
||||||
|
export default atActionGroup;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div class="col-xs-{{ col }} at-ActionGroup">
|
||||||
|
<div class="pull-{{ pos }}">
|
||||||
|
<ng-transclude></ng-transclude>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
|
let $state;
|
||||||
|
|
||||||
|
function applyCancelProperties (scope) {
|
||||||
|
scope.text = scope.config.text || 'CANCEL';
|
||||||
|
scope.fill = 'Hollow';
|
||||||
|
scope.color = 'white';
|
||||||
|
scope.disabled = false;
|
||||||
|
scope.action = () => $state.go('^');
|
||||||
|
}
|
||||||
|
|
||||||
|
function applySaveProperties (scope) {
|
||||||
|
scope.text = 'SAVE';
|
||||||
|
scope.fill = '';
|
||||||
|
scope.color = 'green';
|
||||||
|
scope.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
function link (scope, el, attrs, form) {
|
function link (scope, el, attrs, form) {
|
||||||
form.use('action', scope, el);
|
form.use('action', scope, el);
|
||||||
|
|
||||||
@@ -11,27 +28,15 @@ function link (scope, el, attrs, form) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyCancelProperties (scope) {
|
function atFormAction (_$state_, pathService) {
|
||||||
scope.text = 'CANCEL';
|
$state = _$state_;
|
||||||
scope.fill = 'Hollow';
|
|
||||||
scope.color = 'white';
|
|
||||||
scope.disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applySaveProperties (scope) {
|
|
||||||
scope.text = 'SAVE';
|
|
||||||
scope.fill = '';
|
|
||||||
scope.color = 'green';
|
|
||||||
scope.disabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function atFormAction (pathService) {
|
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
transclude: true,
|
transclude: true,
|
||||||
replace: true,
|
replace: true,
|
||||||
require: '^^at-form',
|
require: '^^at-form',
|
||||||
templateUrl: pathService.getPartialPath('components/form/form-action'),
|
templateUrl: pathService.getPartialPath('components/action/action'),
|
||||||
link,
|
link,
|
||||||
scope: {
|
scope: {
|
||||||
config: '='
|
config: '='
|
||||||
@@ -39,6 +44,6 @@ function atFormAction (pathService) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
atFormAction.$inject = ['PathService'];
|
atFormAction.$inject = ['$state', 'PathService'];
|
||||||
|
|
||||||
export default atFormAction;
|
export default atFormAction;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<button class="btn at-Button{{ fill }}--{{ color }}" ng-disabled="disabled"
|
<button class="btn at-Button{{ fill }}--{{ color }}" ng-disabled="disabled"
|
||||||
ng-class="{ 'at-Button--disabled': disabled }" >
|
ng-class="{ 'at-Button--disabled': disabled }" ng-click="action()">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
</button>
|
</button>
|
||||||
@@ -1,7 +1 @@
|
|||||||
.at-FormActionGroup {
|
|
||||||
margin-top: @at-space-6x;
|
|
||||||
|
|
||||||
button:last-child {
|
|
||||||
margin-left: @at-space-5x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
function atFormActionGroup (pathService) {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
transclude: true,
|
|
||||||
replace: true,
|
|
||||||
require: '^^at-form',
|
|
||||||
templateUrl: pathService.getPartialPath('components/form/form-action-group'),
|
|
||||||
scope: {
|
|
||||||
config: '='
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
atFormActionGroup.$inject = ['PathService'];
|
|
||||||
|
|
||||||
export default atFormActionGroup;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<div class="col-xs-12 at-FormActionGroup">
|
|
||||||
<div class="pull-right">
|
|
||||||
<ng-transclude></ng-transclude>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import action from './action/action.directive';
|
||||||
|
import actionGroup from './action/action-group.directive';
|
||||||
import badge from './badge/badge.directive';
|
import badge from './badge/badge.directive';
|
||||||
import form from './form/form.directive';
|
import form from './form/form.directive';
|
||||||
import formAction from './form/form-action.directive';
|
|
||||||
import formActionGroup from './form/form-action-group.directive';
|
|
||||||
import inputLabel from './input/label.directive';
|
import inputLabel from './input/label.directive';
|
||||||
import inputSearch from './input/search.directive';
|
import inputSearch from './input/search.directive';
|
||||||
import inputSelect from './input/select.directive';
|
import inputSelect from './input/select.directive';
|
||||||
@@ -15,10 +15,10 @@ import toggleContent from './toggle/content.directive';
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('at.components', [])
|
.module('at.components', [])
|
||||||
|
.directive('atAction', action)
|
||||||
|
.directive('atActionGroup', actionGroup)
|
||||||
.directive('atBadge', badge)
|
.directive('atBadge', badge)
|
||||||
.directive('atForm', form)
|
.directive('atForm', form)
|
||||||
.directive('atFormAction', formAction)
|
|
||||||
.directive('atFormActionGroup', formActionGroup)
|
|
||||||
.directive('atInputLabel', inputLabel)
|
.directive('atInputLabel', inputLabel)
|
||||||
.directive('atInputSearch', inputSearch)
|
.directive('atInputSearch', inputSearch)
|
||||||
.directive('atInputSelect', inputSelect)
|
.directive('atInputSelect', inputSelect)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
background: @at-white;
|
background: @at-white;
|
||||||
border-radius: @at-border-radius;
|
border-radius: @at-border-radius;
|
||||||
color: @at-gray-dark-3x;
|
color: @at-gray-dark-5x;
|
||||||
|
|
||||||
&, &:active {
|
&, &:active {
|
||||||
border-color: @at-gray-dark-2x;
|
border-color: @at-gray-dark-2x;
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
<at-input-text col="4" config="vm.description"></at-input-text>
|
<at-input-text col="4" config="vm.description"></at-input-text>
|
||||||
<at-input-select col="4" config="vm.kind"></at-input-select>
|
<at-input-select col="4" config="vm.kind"></at-input-select>
|
||||||
|
|
||||||
<at-form-action-group>
|
<at-action-group col="12" pos="right">
|
||||||
<at-form-action config="vm.cancel"></at-form-action>
|
<at-action config="vm.cancel"></at-action>
|
||||||
<at-form-action config="vm.save"></at-form-action>
|
<at-action config="vm.save"></at-action>
|
||||||
</at-form-action-group>
|
</at-action-group>
|
||||||
</at-form>
|
</at-form>
|
||||||
</at-panel-body>
|
</at-panel-body>
|
||||||
</at-panel>
|
</at-panel>
|
||||||
|
|||||||
Reference in New Issue
Block a user