Disable CLIN fields via a config option

This commit is contained in:
George Drummond 2019-01-03 15:12:51 -05:00
parent 7a7f8914c8
commit 99f34fe45a
No known key found for this signature in database
GPG Key ID: 296DD6077123BF17
7 changed files with 59 additions and 7 deletions

View File

@ -121,6 +121,7 @@ def map_config(config):
**config["default"],
"ENV": config["default"]["ENVIRONMENT"],
"DEBUG": config["default"].getboolean("DEBUG"),
"CLASSIFIED": config["default"].getboolean("CLASSIFIED"),
"PORT": int(config["default"]["PORT"]),
"SQLALCHEMY_DATABASE_URI": config["default"]["DATABASE_URI"],
"SQLALCHEMY_TRACK_MODIFICATIONS": False,

View File

@ -77,6 +77,11 @@ class FundingForm(CacheableForm):
clin_04 = IntegerField("CLIN 04: Classified")
class UnclassifiedFundingForm(FundingForm):
clin_02 = IntegerField("CLIN 02: Classified (available soon)")
clin_04 = IntegerField("CLIN 04: Classified (available soon)")
class OversightForm(CacheableForm):
ko_first_name = StringField("First Name")
ko_last_name = StringField("Last Name")

View File

@ -1,4 +1,11 @@
from flask import request as http_request, render_template, g, redirect, url_for
from flask import (
request as http_request,
render_template,
g,
redirect,
url_for,
current_app as app,
)
from . import task_orders_bp
from atst.domain.task_orders import TaskOrders
@ -18,6 +25,7 @@ TASK_ORDER_SECTIONS = [
"title": "Funding",
"template": "task_orders/new/funding.html",
"form": task_order_form.FundingForm,
"unclassified_form": task_order_form.UnclassifiedFundingForm,
},
{
"section": "oversight",
@ -59,12 +67,18 @@ class ShowTaskOrderWorkflow:
@property
def form(self):
form_type = (
"unclassified_form"
if "unclassified_form" in self._section and not app.config.get("CLASSIFIED")
else "form"
)
if self._form:
pass
elif self.task_order:
self._form = self._section["form"](formdata=self.task_order_formdata)
self._form = self._section[form_type](formdata=self.task_order_formdata)
else:
self._form = self._section["form"]()
self._form = self._section[form_type]()
return self._form

View File

@ -1,6 +1,7 @@
[default]
CAC_URL = http://localhost:8000/login-redirect
CA_CHAIN = ssl/server-certs/ca-chain.pem
CLASSIFIED = false
COOKIE_SECRET = some-secret-please-replace
CRL_DIRECTORY = crl
DEBUG = true

View File

@ -108,6 +108,15 @@
}
}
.usa-input__coming-soon {
@include h5;
font-weight: normal;
@include line-max;
color: $color-gray-medium;
}
input,
textarea,
select,
@ -348,3 +357,17 @@ select {
}
}
}
.input--disabled {
color: $color-gray-lighter;
input[disabled] {
border-color: $color-gray-lighter;
cursor: not-allowed;
&:hover {
border-color: $color-gray-lighter !important;
box-shadow: none;
}
}
}

View File

@ -9,6 +9,7 @@
placeholder='',
validation='anything',
paragraph=False,
disabled=False,
initial_value='',
noMaxWidth=False) -%}
@ -23,10 +24,14 @@
inline-template>
<div
v-bind:class="['usa-input usa-input--validation--' + validation, { 'usa-input--error': showError, 'usa-input--success': showValid, 'usa-input--validation--paragraph': paragraph, 'no-max-width': noMaxWidth }]">
{% if disabled %}class="input--disabled"{% endif %}
v-bind:class="['usa-input usa-input--validation--' + validation, { 'usa-input--error': showError, 'usa-input--success': showValid, 'usa-input--validation--paragraph': paragraph, 'no-max-width': noMaxWidth, 'disabled-available-soon': disabled_available_soon }]">
<label for={{field.name}}>
<div class="usa-input__title">{{ label }} {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}</div>
<div class="usa-input__title">
{{ label }}
{% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}
</div>
{% if field.description %}
<span class='usa-input__help'>{{ description | safe }}</span>
@ -60,6 +65,9 @@
v-bind:aria-invalid='showError'
id='{{ field.name }}'
type='text'
{% if disabled %}
disabled="disabled"
{% endif %}
ref='input'
placeholder='{{ placeholder }}'>
</masked-input>

View File

@ -65,7 +65,7 @@
</p>
{{ TextInput(form.clin_01, validation='dollars') }}
{{ TextInput(form.clin_02, validation='dollars') }}
{{ TextInput(form.clin_02, validation='dollars', disabled=(not config.CLASSIFIED)) }}
<h4>Cloud Support and Assistance</h4>
<p>
@ -74,7 +74,7 @@
other services.
</p>
{{ TextInput(form.clin_03, validation='dollars', tooltip='The cloud support and assistance packages cannot be used as a primary development resource.') }}
{{ TextInput(form.clin_04, validation='dollars', tooltip='The cloud support and assistance packages cannot be used as a primary development resource.') }}
{{ TextInput(form.clin_04, validation='dollars', tooltip='The cloud support and assistance packages cannot be used as a primary development resource.', disabled=(not config.CLASSIFIED)) }}
</div>
</funding>