Adds id's to all form groups and new forms

This commit is contained in:
mabashian
2018-08-02 12:28:02 -04:00
parent 45c067b599
commit 8523b56707
5 changed files with 21 additions and 16 deletions

View File

@@ -8,14 +8,14 @@
</at-tab-group> </at-tab-group>
<at-panel-body ng-if="!$state.current.name.includes('users')"> <at-panel-body ng-if="!$state.current.name.includes('users')">
<at-form state="vm.form" autocomplete="off"> <at-form state="vm.form" autocomplete="off" id="application_form">
<at-input-text col="4" tab="1" state="vm.form.name"></at-input-text> <at-input-text col="4" tab="1" state="vm.form.name" id="application_name_group"></at-input-text>
<at-input-text col="4" tab="2" state="vm.form.description"></at-input-text> <at-input-text col="4" tab="2" state="vm.form.description" id="application_description_group"></at-input-text>
<at-input-lookup col="4" tab="3" state="vm.form.organization"></at-input-lookup> <at-input-lookup col="4" tab="3" state="vm.form.organization" id="application_organization_group"></at-input-lookup>
<at-divider></at-divider> <at-divider></at-divider>
<at-input-select col="4" tab="4" state="vm.form.authorization_grant_type"></at-input-select> <at-input-select col="4" tab="4" state="vm.form.authorization_grant_type" id="application_authorization_grant_type_group"></at-input-select>
<at-input-text col="4" tab="5" state="vm.form.redirect_uris"></at-input-text> <at-input-text col="4" tab="5" state="vm.form.redirect_uris" id="application_redirect_uris_group"></at-input-text>
<at-input-select col="4" tab="6" state="vm.form.client_type"></at-input-select> <at-input-select col="4" tab="6" state="vm.form.client_type" id="application_client_type_group"></at-input-select>
<at-action-group col="12" pos="right"> <at-action-group col="12" pos="right">
<at-form-action type="cancel" to="applications"></at-form-action> <at-form-action type="cancel" to="applications"></at-form-action>

View File

@@ -16,6 +16,8 @@ function AddCredentialsController (models, $state, $scope, strings, componentsSt
omit: ['user', 'team', 'inputs'] omit: ['user', 'team', 'inputs']
}); });
vm.form._formName = 'credential';
vm.form.disabled = !credential.isCreatable(); vm.form.disabled = !credential.isCreatable();
vm.form.organization._resource = 'organization'; vm.form.organization._resource = 'organization';

View File

@@ -9,16 +9,16 @@
</at-tab-group> </at-tab-group>
<at-panel-body> <at-panel-body>
<at-form state="vm.form" autocomplete="off"> <at-form state="vm.form" autocomplete="off" id="credential_form">
<at-input-text col="4" tab="1" state="vm.form.name"></at-input-text> <at-input-text col="4" tab="1" state="vm.form.name" id="credential_name_group"></at-input-text>
<at-input-text col="4" tab="2" state="vm.form.description"></at-input-text> <at-input-text col="4" tab="2" state="vm.form.description" id="credential_description_group"></at-input-text>
<at-input-lookup col="4" tab="3" state="vm.form.organization"></at-input-lookup> <at-input-lookup col="4" tab="3" state="vm.form.organization" id="credential_organization_group"></at-input-lookup>
<at-divider></at-divider> <at-divider></at-divider>
<at-input-lookup col="4" tab="5" state="vm.form.credential_type"></at-input-lookup> <at-input-lookup col="4" tab="5" state="vm.form.credential_type" id="credential_credential_type_group"></at-input-lookup>
<at-input-group col="4" tab="6" state="vm.form.inputs"> <at-input-group col="4" tab="6" state="vm.form.inputs" form-id="credential">
{{:: vm.strings.get('inputs.GROUP_TITLE') }} {{:: vm.strings.get('inputs.GROUP_TITLE') }}
</at-input-group> </at-input-group>

View File

@@ -16,6 +16,7 @@ function AtInputGroupController ($scope, $compile) {
let state; let state;
let source; let source;
let element; let element;
let formId;
vm.init = (_scope_, _form_, _element_) => { vm.init = (_scope_, _form_, _element_) => {
form = _form_; form = _form_;
@@ -23,6 +24,7 @@ function AtInputGroupController ($scope, $compile) {
element = _element_; element = _element_;
state = scope.state || {}; state = scope.state || {};
source = state._source; source = state._source;
formId = scope.formId;
$scope.$watch('state._source._value', vm.update); $scope.$watch('state._source._value', vm.update);
}; };
@@ -145,7 +147,7 @@ function AtInputGroupController ($scope, $compile) {
const tabindex = Number(scope.tab) + index; const tabindex = Number(scope.tab) + index;
const col = input._expand ? 12 : scope.col; const col = input._expand ? 12 : scope.col;
const component = angular.element(`<${input._component} col="${col}" tab="${tabindex}" const component = angular.element(`<${input._component} col="${col}" tab="${tabindex}"
state="${state._reference}._group[${index}]"> state="${state._reference}._group[${index}]" id="${formId}_${input.id}_group">
</${input._component}>`); </${input._component}>`);
$compile(component)(scope.$parent); $compile(component)(scope.$parent);
@@ -183,7 +185,8 @@ function atInputGroup () {
scope: { scope: {
state: '=', state: '=',
col: '@', col: '@',
tab: '@' tab: '@',
formId: '@'
} }
}; };
} }

View File

@@ -740,7 +740,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
if((field.excludeMode === undefined || field.excludeMode !== options.mode) && field.type !== 'alertblock' && field.type !== 'workflow-chart') { if((field.excludeMode === undefined || field.excludeMode !== options.mode) && field.type !== 'alertblock' && field.type !== 'workflow-chart') {
html += "<div class='form-group Form-formGroup "; html += `<div id='${form.name}_${fld}_group' class='form-group Form-formGroup `;
html += (field.disabled) ? `Form-formGroup--disabled ` : ``; html += (field.disabled) ? `Form-formGroup--disabled ` : ``;
html += (field.type === "checkbox") ? "Form-formGroup--checkbox" : ""; html += (field.type === "checkbox") ? "Form-formGroup--checkbox" : "";
html += (field['class']) ? (field['class']) : ""; html += (field['class']) ? (field['class']) : "";