Refactor form header and footer into macro
This commit is contained in:
parent
dd2996f3b8
commit
d33332034a
@ -76,6 +76,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
border: none;
|
||||
border-bottom: 1px solid $color-gray-lighter;
|
||||
}
|
||||
}
|
||||
|
||||
.environment-roles {
|
||||
|
@ -3,90 +3,100 @@
|
||||
{% from "components/checkbox_input.html" import CheckboxInput %}
|
||||
{% from "components/phone_input.html" import PhoneInput %}
|
||||
|
||||
{% macro MemberStepOne(new_member_form) %}
|
||||
{% macro MemberFormTemplate(title, next_button, previous=True) %}
|
||||
<div class="modal__form--header">
|
||||
<h1>{{ Icon('avatar') }} Add Member</h1>
|
||||
<h1>{{ Icon('avatar') }} {{ title }}</h1>
|
||||
<hr>
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.first_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.last_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.email, validation='email', optional=False) }}
|
||||
</div>
|
||||
<div class="form-row">
|
||||
{{ PhoneInput(new_member_form.user_data.phone_number, new_member_form.user_data.phone_ext)}}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.dod_id, validation='dodId', optional=False) }}
|
||||
</div>
|
||||
|
||||
{{ caller() }}
|
||||
|
||||
<div class='action-group'>
|
||||
{{ next_button }}
|
||||
{% if previous %}
|
||||
<input
|
||||
type='button'
|
||||
v-on:click="previous()"
|
||||
class='action-group__action usa-button usa-button-secondary'
|
||||
value='Previous'>
|
||||
{% endif %}
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('{{ new_port_mem }}')">{{ "common.cancel" | translate }}</a>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro MemberStepOne(new_member_form) %}
|
||||
{% set next_button %}
|
||||
<input
|
||||
type='button'
|
||||
v-on:click="next()"
|
||||
v-bind:disabled="invalid"
|
||||
class='action-group__action usa-button'
|
||||
value='Next'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('{{ new_port_mem }}')">{{ "common.cancel" | translate }}</a>
|
||||
</div>
|
||||
{% endset %}
|
||||
|
||||
{% call MemberFormTemplate(title="Add Member", next_button=next_button, previous=False) %}
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.first_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.last_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.email, validation='email', optional=False) }}
|
||||
</div>
|
||||
<div class="form-row">
|
||||
{{ PhoneInput(new_member_form.user_data.phone_number, new_member_form.user_data.phone_ext)}}
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
{{ TextInput(new_member_form.user_data.dod_id, validation='dodId', optional=False) }}
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
||||
{% macro MemberStepTwo(new_member_form, application) %}
|
||||
<div class="modal__form--header">
|
||||
<h1>{{ Icon('avatar') }} Set Permissions and Roles</h1>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h4>Project Permissions</h4>
|
||||
<div class="application-perms">
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_team_mgmt, classes="input__inline-fields") }}
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_env_mgmt, classes="input__inline-fields") }}
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_del_env, classes="input__inline-fields") }}
|
||||
</div>
|
||||
<div class="environment-roles-new">
|
||||
<h4>Environment Access</h4>
|
||||
<hr>
|
||||
{% for environment_data in new_member_form.environment_roles %}
|
||||
<optionsinput inline-template
|
||||
v-bind:initial-value="'{{ environment_data.role.data | string }}'"
|
||||
v-bind:name="'{{ environment_data.name | string }}'"
|
||||
v-bind:optional="true"
|
||||
>
|
||||
<div class="usa-input">
|
||||
<fieldset data-ally-disabled="true" class="usa-input__choices">
|
||||
<div class="form-row">
|
||||
<div class="form-col form-col--two-thirds">
|
||||
<legend>
|
||||
<div v-bind:class='["usa-input__title-inline", {"environment-name--gray": value === "None" }]'>
|
||||
{{ environment_data.environment_name.data }}
|
||||
</div>
|
||||
</legend>
|
||||
</div>
|
||||
<div class="form-col form-col--third">
|
||||
{{ environment_data.role(**{"v-model": "value"}) }}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</optionsinput>
|
||||
{{ environment_data.environment_id() }}
|
||||
<hr>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class='action-group'>
|
||||
{% set next_button %}
|
||||
<input
|
||||
type="submit"
|
||||
class='action-group__action usa-button'
|
||||
form="add-app-mem"
|
||||
value='Add Member'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('{{ new_port_mem }}')">{{ "common.cancel" | translate }}</a>
|
||||
<input
|
||||
type='button'
|
||||
v-on:click="previous()"
|
||||
class='action-group__action usa-button action-group__action--left'
|
||||
value='Previous'>
|
||||
</div>
|
||||
{% endset %}
|
||||
|
||||
{% call MemberFormTemplate(title="Set Permissions and Roles", next_button=next_button) %}
|
||||
<h4>Project Permissions</h4>
|
||||
<div class="application-perms">
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_team_mgmt, classes="input__inline-fields") }}
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_env_mgmt, classes="input__inline-fields") }}
|
||||
{{ CheckboxInput(new_member_form.permission_sets.perms_del_env, classes="input__inline-fields") }}
|
||||
</div>
|
||||
<div class="environment-roles-new">
|
||||
<h4>Environment Access</h4>
|
||||
<hr>
|
||||
{% for environment_data in new_member_form.environment_roles %}
|
||||
<optionsinput inline-template
|
||||
v-bind:initial-value="'{{ environment_data.role.data | string }}'"
|
||||
v-bind:name="'{{ environment_data.name | string }}'"
|
||||
v-bind:optional="true"
|
||||
>
|
||||
<div class="usa-input">
|
||||
<fieldset data-ally-disabled="true" class="usa-input__choices">
|
||||
<div class="form-row">
|
||||
<div class="form-col form-col--two-thirds">
|
||||
<legend>
|
||||
<div v-bind:class='["usa-input__title-inline", {"environment-name--gray": value === "None" }]'>
|
||||
{{ environment_data.environment_name.data }}
|
||||
</div>
|
||||
</legend>
|
||||
</div>
|
||||
<div class="form-col form-col--third">
|
||||
{{ environment_data.role(**{"v-model": "value"}) }}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</optionsinput>
|
||||
{{ environment_data.environment_id() }}
|
||||
<hr>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user