Use translations in edit TO form and update PDF upload size limit

This commit is contained in:
leigh-mil 2019-06-20 10:47:16 -04:00
parent 7814173d72
commit 9278a251cc
4 changed files with 54 additions and 31 deletions

View File

@ -27,10 +27,14 @@ def coerce_enum(enum_inst):
class CLINForm(FlaskForm): class CLINForm(FlaskForm):
jedi_clin_type = SelectField( jedi_clin_type = SelectField(
"CLIN type", choices=JEDI_CLIN_TYPES, coerce=coerce_enum translate("task_orders.form.clin_type_label"),
choices=JEDI_CLIN_TYPES,
coerce=coerce_enum,
) )
number = StringField(label="CLIN", validators=[Optional()]) number = StringField(
label=translate("task_orders.form.clin_number_label"), validators=[Optional()]
)
start_date = DateField( start_date = DateField(
translate("forms.task_order.start_date_label"), translate("forms.task_order.start_date_label"),
format="%m/%d/%Y", format="%m/%d/%Y",
@ -42,7 +46,8 @@ class CLINForm(FlaskForm):
validators=[Optional()], validators=[Optional()],
) )
obligated_amount = DecimalField( obligated_amount = DecimalField(
label="Funds obligated for cloud", validators=[Optional()] label=translate("task_orders.form.obligated_funds_label"),
validators=[Optional()],
) )
loas = FieldList(StringField()) loas = FieldList(StringField())
@ -53,7 +58,7 @@ class TaskOrderForm(BaseForm):
) )
pdf = FileField( pdf = FileField(
None, None,
description="Your file may not exceed 50MB", description=translate("task_orders.form.supporting_docs_size_limit"),
validators=[ validators=[
FileAllowed(["pdf"], translate("forms.task_order.file_format_not_allowed")), FileAllowed(["pdf"], translate("forms.task_order.file_format_not_allowed")),
FileLength(message=translate("forms.validators.file_length")), FileLength(message=translate("forms.validators.file_length")),

View File

@ -35,7 +35,7 @@
<input name="{{ field.name }}" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" /> <input name="{{ field.name }}" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" />
<div class="usa-form-group usa-form-group-month"> <div class="usa-form-group usa-form-group-month">
<label>Month</label> <label>{{ 'components.date_selector.month' | translate }}</label>
<input <input
name="date-month" name="date-month"
max="12" max="12"
@ -48,7 +48,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-day"> <div class="usa-form-group usa-form-group-day">
<label>Day</label> <label>{{ 'components.date_selector.day' | translate }}</label>
<input <input
name="date-day" name="date-day"
maxlength="2" maxlength="2"
@ -62,7 +62,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-year"> <div class="usa-form-group usa-form-group-year">
<label>Year</label> <label>{{ 'components.date_selector.year' | translate }}</label>
<input <input
id="date-year" id="date-year"
maxlength="4" maxlength="4"

View File

@ -40,13 +40,12 @@
</textinput> </textinput>
</div> </div>
<!-- TODO: Update icon to match designs -->
<button <button
class="icon-link" class="icon-link"
v-on:click="addLoa" v-on:click="addLoa"
type="button"> type="button">
{{ Icon('plus') }} {{ Icon('plus') }}
<span>Add another line of accounting</span> <span>{{ 'task_orders.form.add_loa' | translate }}</span>
</button> </button>
{% endmacro %} {% endmacro %}
@ -76,7 +75,7 @@
<fieldset class="usa-input__choices task-order__loa-fieldset"> <fieldset class="usa-input__choices task-order__loa-fieldset">
<legend> <legend>
<div class="usa-input__title"> <div class="usa-input__title">
Line of accounting (43 characters) {{ 'task_orders.form.loa_label' | translate }}
</div> </div>
</legend> </legend>
{% for loa in fields.loas %} {% for loa in fields.loas %}
@ -114,7 +113,7 @@
v-bind:initial-total='{{ total }}' v-bind:initial-total='{{ total }}'
v-bind:initial-clin-count="{{ form.clins.data | length }}"> v-bind:initial-clin-count="{{ form.clins.data | length }}">
<div> <div>
{% call StickyCTA(text="Add Funding") %} {% call StickyCTA(text=('task_orders.form.sticky_header_text' | translate )) %}
<span class="action-group"> <span class="action-group">
<!-- todo: implement the review button --> <!-- todo: implement the review button -->
<input <input
@ -125,7 +124,7 @@
disabled="disabled" disabled="disabled"
{% endif %} {% endif %}
:disabled="invalid" :disabled="invalid"
value="Review task order" value="{{ 'task_orders.form.review_button' | translate }}"
form="new-task-order" form="new-task-order"
class="usa-button usa-button-primary"> class="usa-button usa-button-primary">
<input <input
@ -154,14 +153,14 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="h1">Add your task order</div> <div class="h1">{{ 'task_orders.form.add_to_header' | translate }}</div>
{{ TextInput(form.number, validation='taskOrderNumber', optional=False) }} {{ TextInput(form.number, validation='taskOrderNumber', optional=False) }}
<hr> <hr>
<div class="h3">Add the summary of cloud funding</div> <div class="h3">{{ 'task_orders.form.cloud_funding_header' | translate }}</div>
<div> <div>
Data must match with what is in your uploaded document. {{ 'task_orders.form.cloud_funding_text' | translate }}
</div> </div>
{% for clin in form.clins %} {% for clin in form.clins %}
@ -182,7 +181,7 @@
<fieldset data-ally-disabled="true" class="usa-input__choices" v-on:change="onInput"> <fieldset data-ally-disabled="true" class="usa-input__choices" v-on:change="onInput">
<legend> <legend>
<div class="usa-input__title"> <div class="usa-input__title">
CLIN type {{ 'task_orders.form.clin_type_label' | translate }}
</div> </div>
</legend> </legend>
<select :id='name' :name='name'> <select :id='name' :name='name'>
@ -201,7 +200,7 @@
<label :for="name"> <label :for="name">
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span> <span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span> <span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
<div class="usa-input__title">CLIN</div> <div class="usa-input__title">{{ 'task_orders.form.clin_number_label' | translate }}</div>
</label> </label>
<masked-input <masked-input
@ -236,7 +235,7 @@
<fieldset class="usa-input__choices task-order__loa-fieldset"> <fieldset class="usa-input__choices task-order__loa-fieldset">
<legend> <legend>
<div class="usa-input__title"> <div class="usa-input__title">
Line of accounting (43 characters) {{ 'task_orders.form.loa_label' | translate }}
</div> </div>
</legend> </legend>
{{ LOAInput() }} {{ LOAInput() }}
@ -247,7 +246,7 @@
<fieldset class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid }"> <fieldset class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid }">
<legend> <legend>
<div class="usa-input__title"> <div class="usa-input__title">
Start of period of performance (PoP) {{ 'task_orders.form.pop_start' | translate }}
</div> </div>
</legend> </legend>
@ -255,7 +254,7 @@
<input :name="name" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" /> <input :name="name" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" />
<div class="usa-form-group usa-form-group-month"> <div class="usa-form-group usa-form-group-month">
<label>Month</label> <label>{{ 'components.date_selector.month' | translate }}</label>
<input <input
name="date-month" name="date-month"
max="12" max="12"
@ -269,7 +268,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-day"> <div class="usa-form-group usa-form-group-day">
<label>Day</label> <label>{{ 'components.date_selector.day' | translate }}</label>
<input <input
name="date-day" name="date-day"
maxlength="2" maxlength="2"
@ -283,7 +282,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-year"> <div class="usa-form-group usa-form-group-year">
<label>Year</label> <label>{{ 'components.date_selector.year' | translate }}</label>
<input <input
name="date-year" name="date-year"
maxlength="4" maxlength="4"
@ -305,7 +304,7 @@
<fieldset class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid }"> <fieldset class="usa-input date-picker" v-bind:class="{ 'usa-input--success': isDateValid }">
<legend> <legend>
<div class="usa-input__title"> <div class="usa-input__title">
End of period of performance (PoP) {{ 'task_orders.form.pop_end' | translate }}
</div> </div>
</legend> </legend>
@ -313,7 +312,7 @@
<input :name="name" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" /> <input :name="name" v-bind:value="formattedDate" v-on:change="onInput" type="hidden" />
<div class="usa-form-group usa-form-group-month"> <div class="usa-form-group usa-form-group-month">
<label>Month</label> <label>{{ 'components.date_selector.month' | translate }}</label>
<input <input
name="date-month" name="date-month"
max="12" max="12"
@ -327,7 +326,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-day"> <div class="usa-form-group usa-form-group-day">
<label>Day</label> <label>{{ 'components.date_selector.day' | translate }}</label>
<input <input
name="date-day" name="date-day"
maxlength="2" maxlength="2"
@ -341,7 +340,7 @@
</div> </div>
<div class="usa-form-group usa-form-group-year"> <div class="usa-form-group usa-form-group-year">
<label>Year</label> <label>{{ 'components.date_selector.year' | translate }}</label>
<input <input
name="date-year" name="date-year"
maxlength="4" maxlength="4"
@ -367,7 +366,7 @@
:watch='true'> :watch='true'>
<div class="usa-input usa-input--validation--dollars noMaxWidth"> <div class="usa-input usa-input--validation--dollars noMaxWidth">
<label :for="name"> <label :for="name">
<div class="usa-input__title">Funds obligated for cloud</div> <div class="usa-input__title">{{ 'task_orders.form.obligated_funds_label' | translate }}</div>
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span> <span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span> <span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
</label> </label>
@ -401,19 +400,18 @@
</clin-fields> </clin-fields>
</div> </div>
<!-- TODO: Update icon to match designs -->
<button <button
class="icon-link icon-link__add-another-clin" class="icon-link icon-link__add-another-clin"
v-on:click="addClin" v-on:click="addClin"
type="button"> type="button">
{{ Icon('plus') }} {{ Icon('plus') }}
<span>Add another CLIN or Sub-CLIN</span> <span>{{ 'task_orders.form.add_clin' | translate }}</span>
</button> </button>
<hr> <hr>
<div class="h3">Upload your supporting documentation</div> <div class="h3">{{ 'task_orders.form.supporting_docs_header' | translate }}</div>
<div class="task-order__pdf-help-text"> <div class="task-order__pdf-help-text">
Upload a single PDF containing all relevant information. {{ Icon('question')}} {{ 'task_orders.form.supporting_docs_text' | translate }} {{ Icon('question')}}
</div> </div>
{{ UploadInput(form.pdf, watch=True) }} {{ UploadInput(form.pdf, watch=True) }}
</div> </div>

View File

@ -47,6 +47,10 @@ common:
choose_role: Choose a role choose_role: Choose a role
name: Name name: Name
components: components:
date_selector:
day: Day
month: Month
year: Year
modal: modal:
destructive_message: You will no longer be able to access this {resource} destructive_message: You will no longer be able to access this {resource}
destructive_title: Warning! This action is permanent destructive_title: Warning! This action is permanent
@ -332,8 +336,24 @@ task_orders:
pop_end: PoP End pop_end: PoP End
loa: LOA loa: LOA
form: form:
add_clin: Add another CLIN or Sub-CLIN
add_loa: Add another line of accounting
add_to_header: Add your task order
clin_number_label: CLIN
clin_type_label: CLIN type
cloud_funding_header: Add the summary of cloud funding
cloud_funding_text: Data must match with what is in your uploaded document.
draft_alert_title: Your information has been saved draft_alert_title: Your information has been saved
draft_alert_message: You can return to the Task Order Builder to enter missing information. Once you are finished, youll be ready to submit this request. draft_alert_message: You can return to the Task Order Builder to enter missing information. Once you are finished, youll be ready to submit this request.
loa_label: 'Line of accounting (43 characters)'
obligated_funds_label: Funds obligated for cloud
pop_end: 'End of period of performance (PoP)'
pop_start: 'Start of period of performance (PoP)'
review_button: Review task order
supporting_docs_header: Upload your supporting documentation
supporting_docs_size_limit: Your file may not exceed 1MB
supporting_docs_text: Upload a single PDF containing all relevant information.
sticky_header_text: Add Funding
new: new:
form_help_text: Before you can begin work in the cloud, you'll need to complete the information below and upload your approved task order for reference by the CCPO. form_help_text: Before you can begin work in the cloud, you'll need to complete the information below and upload your approved task order for reference by the CCPO.
app_info: app_info: