Update TO form and nested components to emit directly to parent components instead of emitting from the root component

This commit is contained in:
leigh-mil
2019-11-07 15:02:20 -05:00
parent 92ce3420b6
commit c94570f83e
14 changed files with 131 additions and 79 deletions

View File

@@ -37,7 +37,6 @@
:name-tag="'clins-' + clinIndex + '-start_date'"
{% endif %}
:optional='{{ optional | string | lower }}'
v-on:date-change='handleDateChange'
inline-template>
<fieldset :name="name" class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid && isDateComplete, 'usa-input--error': !isDateValid && isDateComplete }">
@@ -136,7 +135,6 @@
:name-tag="'clins-' + clinIndex + '-end_date'"
{% endif %}
:optional='{{ optional | string | lower }}'
v-on:date-change='handleDateChange'
inline-template>
<fieldset :name="name" class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid && isDateComplete, 'usa-input--error': !isDateValid && isDateComplete }">

View File

@@ -1,6 +1,6 @@
{% from "components/icon.html" import Icon %}
{% macro UploadInput(field, portfolio_id, show_label=False, watch=False) -%}
{% macro UploadInput(field, portfolio_id, show_label=False) -%}
<uploadinput
inline-template
{% if not field.errors %}
@@ -9,18 +9,16 @@
{% else %}
v-bind:initial-errors='true'
{% endif %}
v-bind:watch='{{ watch | string | lower }}'
v-bind:portfolio-id="'{{ portfolio_id }}'"
name='{{ field.name }}'
:optional='false'
>
<div>
<div v-show="hasAttachment" class="uploaded-file">
<div v-show="valid" class="uploaded-file">
{{ Icon("ok") }}
<a class="uploaded-file__name" v-html="baseName" v-bind:href="downloadLink"></a>
<a href="#" class="uploaded-file__remove" v-on:click="removeAttachment">Remove</a>
</div>
<div v-show="hasAttachment === false" v-bind:class='{ "usa-input": true, "usa-input--error": showErrors }'>
<div v-show="valid === false" v-bind:class='{ "usa-input": true, "usa-input--error": showErrors }'>
{% if show_label %}
{{ field.label }}
{% endif %}
@@ -28,7 +26,7 @@
{{ field.description }}
</p>
<div v-if="!hideInput" class="upload-widget">
<label class="upload-label" for="{{ field.name }}">
<label class="upload-label" :for="name">
<span class="upload-button">
Browse
</span>
@@ -37,8 +35,8 @@
v-on:change="addAttachment"
ref="attachmentInput"
accept="{{ field.accept }}"
id="{{ field.name }}"
name="{{ field.name }}"
:id="name"
:name="name"
aria-label="Task Order Upload"
v-bind:value="attachment"
type="file">

View File

@@ -4,7 +4,7 @@
{% from "components/modal.html" import Modal %}
{% block portfolio_content %}
<to-form inline-template {% if form.clins %}v-bind:initial-clin-count="{{ form.clins.data | length }}"{% endif %}>
<to-form inline-template {% if form.clins %}v-bind:initial-clin-count="{{ form.clins.data | length }}"{% endif %} :enable-save="true">
<form id="to_form" action='{{ action }}' method="POST" autocomplete="off" enctype="multipart/form-data">
{{ form.csrf_token }}

View File

@@ -16,5 +16,5 @@
{% block to_builder_form_field %}
{{ TOFormStepHeader('task_orders.form.supporting_docs_header' | translate, 'task_orders.form.supporting_docs_text' | translate) }}
{{ UploadInput(form.pdf, portfolio.id, watch=True) }}
{{ UploadInput(form.pdf, portfolio.id) }}
{% endblock %}