diff --git a/atst/forms/poc.py b/atst/forms/poc.py index b036cdc2..31bb4c02 100644 --- a/atst/forms/poc.py +++ b/atst/forms/poc.py @@ -8,7 +8,7 @@ from .validators import IsNumber class POCForm(ValidatedForm): def validate(self, *args, **kwargs): - if self.am_poc.data == "yes": + if self.am_poc.data: # Prepend Optional validators so that the validation chain # halts if no data exists. self.fname_poc.validators.insert(0, Optional()) diff --git a/atst/routes/requests/jedi_request_flow.py b/atst/routes/requests/jedi_request_flow.py index c0802a76..63910fa4 100644 --- a/atst/routes/requests/jedi_request_flow.py +++ b/atst/routes/requests/jedi_request_flow.py @@ -132,7 +132,7 @@ class JEDIRequestFlow(object): else self.current_user ) if section == "primary_poc": - if data.get("am_poc") == "yes": + if data.get("am_poc"): data = { **data, "dodid_poc": user.dod_id, diff --git a/js/components/checkbox_input.js b/js/components/checkbox_input.js new file mode 100644 index 00000000..73c52d4f --- /dev/null +++ b/js/components/checkbox_input.js @@ -0,0 +1,17 @@ +export default { + name: 'checkboxinput', + + props: { + name: String, + }, + + methods: { + onInput: function (e) { + console.log(e) + this.$root.$emit('field-change', { + value: e.target.checked, + name: this.name + }) + } + } +} diff --git a/js/components/forms/poc.js b/js/components/forms/poc.js index da9b9c59..255c1b04 100644 --- a/js/components/forms/poc.js +++ b/js/components/forms/poc.js @@ -1,5 +1,6 @@ import optionsinput from '../options_input' import textinput from '../text_input' +import checkboxinput from '../checkbox_input' export default { name: 'poc', @@ -7,6 +8,7 @@ export default { components: { optionsinput, textinput, + checkboxinput, }, props: { @@ -18,7 +20,7 @@ export default { data: function () { const { - am_poc = 'no' + am_poc = false } = this.initialData return { @@ -30,12 +32,6 @@ export default { this.$root.$on('field-change', this.handleFieldChange) }, - computed: { - amPOC: function () { - return this.am_poc === 'yes' - }, - }, - methods: { handleFieldChange: function (event) { const { value, name } = event diff --git a/js/index.js b/js/index.js index 84b90c96..afe6961d 100644 --- a/js/index.js +++ b/js/index.js @@ -4,6 +4,7 @@ import VTooltip from 'v-tooltip' import optionsinput from './components/options_input' import textinput from './components/text_input' +import checkboxinput from './components/checkbox_input' import DetailsOfUse from './components/forms/details_of_use' import poc from './components/forms/poc' @@ -15,6 +16,7 @@ const app = new Vue({ components: { optionsinput, textinput, + checkboxinput, DetailsOfUse, poc, }, diff --git a/templates/components/checkbox_input.html b/templates/components/checkbox_input.html index 34c9a0da..92538843 100644 --- a/templates/components/checkbox_input.html +++ b/templates/components/checkbox_input.html @@ -1,37 +1,18 @@ -{% from "components/icon.html" import Icon %} -{% from "components/tooltip.html" import Tooltip %} -{% macro OptionsInput(field, tooltip, inline=False) -%} - +{% macro CheckboxInput(field, inline=False) -%} +
-
- {{ field.label | striptags}} - {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %} -
+ {{ field() }} + {{ field.label }} {% if field.description %} {{ field.description | safe }} {% endif %} - - {% if field.errors %} - {{ Icon('alert',classes="icon-validation") }} - {% endif %} -
- - {{ field() }} - - {% if field.errors %} - {% for error in field.errors %} - {{ error }} - {% endfor %} - {% endif %} -
- -
+ {%- endmacro %} diff --git a/templates/requests/screen-3.html b/templates/requests/screen-3.html index 1a469df6..0c86183c 100644 --- a/templates/requests/screen-3.html +++ b/templates/requests/screen-3.html @@ -2,7 +2,7 @@ {% from "components/alert.html" import Alert %} {% from "components/text_input.html" import TextInput %} -{% from "components/options_input.html" import OptionsInput %} +{% from "components/checkbox_input.html" import CheckboxInput %} {% block subtitle %}

Designate a Workspace Owner

@@ -31,10 +31,9 @@ This POC may be you.

- {{ f.am_poc() }} - {{ f.am_poc.label }} + {{ CheckboxInput(f.am_poc) }} -