From bad99edd4c682bab9b3902b8b4224effbcb350f2 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Mon, 10 Jun 2019 15:26:00 -0400 Subject: [PATCH 01/12] Add nav bar to TO form --- styles/components/_sticky_cta.scss | 16 ++++++++++++++++ templates/task_orders/edit.html | 26 ++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/styles/components/_sticky_cta.scss b/styles/components/_sticky_cta.scss index 3cc52556..2916018f 100644 --- a/styles/components/_sticky_cta.scss +++ b/styles/components/_sticky_cta.scss @@ -36,4 +36,20 @@ .sticky-cta-buttons { display: flex; + + .action-group { + margin: 0; + + a.action-group__action.icon-link { + width: auto; + + } + + input { + margin: $gap $gap * 1.5 $gap 0; + width: 19rem; + height: 3.2rem; + font-size: $small-font-size; + } + } } diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index a0dc0b04..174287fe 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -2,8 +2,9 @@ {% from 'components/date_picker.html' import DatePicker %} {% from 'components/icon.html' import Icon %} -{% from 'components/save_button.html' import SaveButton %} {% from 'components/options_input.html' import OptionsInput %} +{% from 'components/save_button.html' import SaveButton %} +{% from "components/sticky_cta.html" import StickyCTA %} {% from 'components/text_input.html' import TextInput %} {% from 'components/upload_input.html' import UploadInput %} @@ -71,6 +72,18 @@ {% endmacro %} {% block portfolio_content %} + + {% call StickyCTA(text="Add Funding") %} + + + + + {{ "common.cancel" | translate }} + + + {% endcall %}
{% include "fragments/flash.html" %} @@ -81,15 +94,8 @@ {% endif %}
{{ form.csrf_token }} - - Add Funding - - - {{ "common.cancel" | translate }} - - + +

{{ "task_orders.new.form_help_text" | translate }}

From 1e817c675503fbe89ca9a9404b944c3a613e7dc5 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Mon, 10 Jun 2019 16:44:09 -0400 Subject: [PATCH 02/12] Update copy, add totals box, style buttons --- atst/forms/task_order.py | 9 +- js/components/forms/to_form.js | 2 + templates/components/text_input.html | 35 +- templates/components/totals_box.html | 11 +- templates/task_orders/edit.html | 484 ++++++++++++++------------- translations.yaml | 4 +- 6 files changed, 294 insertions(+), 251 deletions(-) diff --git a/atst/forms/task_order.py b/atst/forms/task_order.py index 1d622458..1e2ce9b4 100644 --- a/atst/forms/task_order.py +++ b/atst/forms/task_order.py @@ -19,8 +19,8 @@ from atst.utils.localization import translate class CLINForm(FlaskForm): - jedi_clin_type = SelectField("Jedi CLIN type", choices=JEDI_CLIN_TYPES) - number = StringField(validators=[Required()]) + jedi_clin_type = SelectField("CLIN type", choices=JEDI_CLIN_TYPES) + number = StringField(label="CLIN", validators=[Required()]) start_date = DateField( translate("forms.task_order.start_date_label"), format="%m/%d/%Y", @@ -31,7 +31,7 @@ class CLINForm(FlaskForm): format="%m/%d/%Y", validators=[Required()], ) - obligated_amount = DecimalField() + obligated_amount = DecimalField(label="Funds obligated for cloud") loas = FieldList(StringField()) @@ -42,8 +42,7 @@ class UnclassifiedCLINForm(CLINForm): class TaskOrderForm(BaseForm): number = StringField( - translate("forms.task_order.number_label"), - description=translate("forms.task_order.number_description"), + label=translate("forms.task_order.number_description"), validators=[Required()], ) pdf = FileField( diff --git a/js/components/forms/to_form.js b/js/components/forms/to_form.js index 55999949..bf77f3c2 100644 --- a/js/components/forms/to_form.js +++ b/js/components/forms/to_form.js @@ -2,6 +2,7 @@ import ClinFields from '../clin_fields' import DateSelector from '../date_selector' import FormMixin from '../../mixins/form' import optionsinput from '../options_input' +import SemiCollapsibleText from '../semi_collapsible_text' import textinput from '../text_input' import uploadinput from '../upload_input' @@ -14,6 +15,7 @@ export default { ClinFields, DateSelector, optionsinput, + SemiCollapsibleText, textinput, uploadinput, }, diff --git a/templates/components/text_input.html b/templates/components/text_input.html index 64ab1a1f..e64ed1c0 100644 --- a/templates/components/text_input.html +++ b/templates/components/text_input.html @@ -14,7 +14,8 @@ initial_value='', classes='', noMaxWidth=False, - optional=False) -%} + optional=False, + showLabel=True) -%} - + + {% endif %} {% if paragraph %} diff --git a/templates/components/totals_box.html b/templates/components/totals_box.html index 18afeedf..3e6875a6 100644 --- a/templates/components/totals_box.html +++ b/templates/components/totals_box.html @@ -1,14 +1,19 @@ -{% macro TotalsBox(task_order) -%} +{% macro TotalsBox(task_order=None, obligated_funds=0, contract_amount=0) -%}
+ {% if task_order %} + {% set obligated_funds = task_order.total_obligated_funds %} + {% set contract_amount = task_order.total_contract_amount %} + {% endif %} +
Total obligated funds
-
{{ task_order.total_obligated_funds | dollars }}
+
{{ obligated_funds | dollars }}
This is the funding allocated to cloud services. It may be 100% or a portion of the total task order budget.

Total contract amount
-
{{ task_order.total_contract_amount | dollars }}
+
{{ contract_amount | dollars }}
This is the value of all funds obligated for this contract, including -- but not limited to -- funds obligated for the cloud.
diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 174287fe..9ccbacb4 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -6,17 +6,13 @@ {% from 'components/save_button.html' import SaveButton %} {% from "components/sticky_cta.html" import StickyCTA %} {% from 'components/text_input.html' import TextInput %} +{% from "components/totals_box.html" import TotalsBox %} {% from 'components/upload_input.html' import UploadInput %} {% macro LOAInput() %}
-
- + {% endmacro %} {% macro CLINFields(fields, index) %} + {% if index != 0 %} +
+ {% endif %} +
-
{{ OptionsInput(fields.jedi_clin_type) }} {{ TextInput(fields.number) }} +
Line of accounting (43 characters)
{% for loa in fields.loas %} - {{ TextInput(loa) }} + {{ TextInput(loa, showLabel=False) }} {% endfor %} {{ LOAInput() }} @@ -84,9 +89,9 @@ {% endcall %} -
- {% include "fragments/flash.html" %} - + +
+ {% include "fragments/flash.html" %} {% if task_order_id %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order_id) %} {% else %} @@ -95,222 +100,251 @@ {{ form.csrf_token }} - -

- {{ "task_orders.new.form_help_text" | translate }} -

-
- {{ TextInput(form.number, validation='taskOrderNumber') }} - {% for clin in form.clins %} - {{ CLINFields(clin, index=loop.index - 1) }} - {% endfor %} -
-
- -
-
-
- -
-
-
- -
-
- - -
- - - - - - - - - -
-
- - {{ LOAInput() }} - - -
- -
- Start of period of performance (PoP) -
-
- -
- - -
- - -
- -
- - -
- -
- - - -
- -
- {{ Icon("ok", classes="icon--green") }} -
-
-
-
- - -
- -
- End of period of performance (PoP) -
-
- -
- - -
- - -
- -
- - -
- -
- - - -
- -
- {{ Icon("ok", classes="icon--green") }} -
-
-
-
- - -
- - - - - - - - - -
-
- -
-
+ +
+
+ {{ "task_orders.new.form_help_text" | translate }} +
+ More{{ Icon('caret_down') }} + Less{{ Icon('caret_up') }}
+
- + +
+
Upload your supporting documentation
+
+ Upload a single PDF containing all relevant information. {{ Icon('help')}} +
{{ UploadInput(form.pdf) }} + - -
+ {{ TotalsBox(task_order=task_order) }} +
+
+ {% endblock %} diff --git a/translations.yaml b/translations.yaml index 9d824bb2..21cb82c5 100644 --- a/translations.yaml +++ b/translations.yaml @@ -302,7 +302,7 @@ forms: military: Military other: Other (E.g. University or other partner) dev_team_other_label: Development Team Other - end_date_label: End Date + end_date_label: End of period of performance (PoP) file_format_not_allowed: Only PDF or PNG files can be uploaded. first_step_title: Overview ko_invite_label: Invite contracting officer to Task Order Builder @@ -330,7 +330,7 @@ forms: skip_invite_description: | An invitation won't actually be sent until you click Done on the Review page. You can skip this for now and invite them later. so_invite_label: Invite Security Officer to Task Order Builder - start_date_label: Start Date + start_date_label: Start of period of performance (PoP) team_experience: built_1: Built, migrated, or consulted on 1-2 applications built_3: Built, migrated, or consulted on 3-5 applications From 4285477f4dc447c989b3f8d61c7c11ebcb38f794 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Mon, 10 Jun 2019 20:02:23 -0400 Subject: [PATCH 03/12] Use rows and columns to position TotalsBox correctly --- templates/task_orders/edit.html | 466 ++++++++++++++++---------------- 1 file changed, 232 insertions(+), 234 deletions(-) diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 9ccbacb4..9a63cb0f 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -4,6 +4,7 @@ {% from 'components/icon.html' import Icon %} {% from 'components/options_input.html' import OptionsInput %} {% from 'components/save_button.html' import SaveButton %} +{% from "components/semi_collapsible_text.html" import SemiCollapsibleText %} {% from "components/sticky_cta.html" import StickyCTA %} {% from 'components/text_input.html' import TextInput %} {% from "components/totals_box.html" import TotalsBox %} @@ -77,7 +78,6 @@ {% endmacro %} {% block portfolio_content %} - {% call StickyCTA(text="Add Funding") %} @@ -89,6 +89,7 @@ {% endcall %} +
{% include "fragments/flash.html" %} @@ -100,250 +101,247 @@
{{ form.csrf_token }} - -
-
- {{ "task_orders.new.form_help_text" | translate }} -
- More{{ Icon('caret_down') }} - Less{{ Icon('caret_up') }} -
-
+ {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }}
Add your task order
- {{ TextInput(form.number, validation='taskOrderNumber') }} +
+
+ {{ TextInput(form.number, validation='taskOrderNumber') }} -
Add the summary of cloud funding
-
- Data must match with what is in your uploaded document. -
+
- {% for clin in form.clins %} - {{ CLINFields(clin, index=loop.index - 1) }} - {% endfor %} - -
-
- +
Add the summary of cloud funding
-
-
- -
- CLIN type -
-
- -
-
- - -
- - - - - - - - - -
-
- -
Line of accounting (43 characters)
- {{ LOAInput() }} - - -
- -
- Start of period of performance (PoP) -
-
- -
- - -
- - -
- -
- - -
- -
- - - -
- -
- {{ Icon("ok", classes="icon--green") }} -
-
-
-
- - -
- -
- End of period of performance (PoP) -
-
- -
- - -
- - -
- -
- - -
- -
- - - -
- -
- {{ Icon("ok", classes="icon--green") }} -
-
-
-
- - -
- - - - - - - - - -
-
+ Data must match with what is in your uploaded document.
-
+ + {% for clin in form.clins %} + {{ CLINFields(clin, index=loop.index - 1) }} + {% endfor %} + +
+
+ +
+
+
+ +
+ CLIN type +
+
+ +
+
+ + +
+ + + + + + + + + +
+
+ +
Line of accounting (43 characters)
+ {{ LOAInput() }} + + +
+ +
+ Start of period of performance (PoP) +
+
+ +
+ + +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ {{ Icon("ok", classes="icon--green") }} +
+
+
+
+ + +
+ +
+ End of period of performance (PoP) +
+
+ +
+ + +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ {{ Icon("ok", classes="icon--green") }} +
+
+
+
+ + +
+ + + + + + + + + +
+
+
+
+
+ + + +
+
Upload your supporting documentation
+
+ Upload a single PDF containing all relevant information. {{ Icon('help')}} +
+ {{ UploadInput(form.pdf) }}
- - - -
-
Upload your supporting documentation
-
- Upload a single PDF containing all relevant information. {{ Icon('help')}} + {{ TotalsBox(task_order=task_order) }}
- {{ UploadInput(form.pdf) }} - - {{ TotalsBox(task_order=task_order) }}
From b8b4b38a0a53dda7d0234b70ef2203ca534e96dd Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Mon, 10 Jun 2019 21:10:46 -0400 Subject: [PATCH 04/12] Update class name because it is used on all TO pages, add column for TotalsBox --- styles/sections/_task_order.scss | 11 +++++++++-- templates/portfolios/task_orders/review.html | 7 ++++--- templates/task_orders/edit.html | 10 ++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index 13d7e27b..dbea21b7 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -86,7 +86,7 @@ min-width: 14rem; } -.task-order-summary { +.task-order { margin-top: $gap * 4; hr { @@ -102,6 +102,7 @@ .col { flex-grow: 1; + max-width: 610px; } .h1, @@ -113,13 +114,19 @@ margin-top: $gap * 2; } + &.task-order__form { + .totals-box { + margin-top: 0; + } + } + .totals-box { padding: $gap * 4; padding-top: $gap * 2; flex-grow: unset; margin-left: $gap * 6; margin-top: $gap * 3; - width: 33.77%; + max-width: 336px; height: fit-content; background-color: $color-gray-lightest; } diff --git a/templates/portfolios/task_orders/review.html b/templates/portfolios/task_orders/review.html index 7f3e95d7..40dec4b3 100644 --- a/templates/portfolios/task_orders/review.html +++ b/templates/portfolios/task_orders/review.html @@ -26,7 +26,7 @@ Submit task order {% endcall %} -
+
{{ SemiCollapsibleText() }} @@ -101,8 +101,9 @@
- - {{ TotalsBox(task_order=task_order) }} +
+ {{ TotalsBox(task_order=task_order) }} +
diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 9a63cb0f..fac96fb9 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -91,23 +91,23 @@ {% endcall %} -
+
{% include "fragments/flash.html" %} {% if task_order_id %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order_id) %} {% else %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} {% endif %} -
+ {{ form.csrf_token }} {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }}
-
Add your task order
+
Add your task order
{{ TextInput(form.number, validation='taskOrderNumber') }}
@@ -339,7 +339,9 @@
{{ UploadInput(form.pdf) }}
- {{ TotalsBox(task_order=task_order) }} +
+ {{ TotalsBox(task_order=task_order) }} +
From 4b0a4628aa228c248ecc98f10fc487e69eebea65 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Tue, 11 Jun 2019 10:14:44 -0400 Subject: [PATCH 05/12] Remove unnecessary column around totals box and fix styling --- styles/sections/_task_order.scss | 14 +++++++------- templates/portfolios/task_orders/review.html | 4 +--- templates/task_orders/edit.html | 8 +++----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index dbea21b7..a7662b64 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -114,23 +114,23 @@ margin-top: $gap * 2; } - &.task-order__form { - .totals-box { - margin-top: 0; - } - } - .totals-box { padding: $gap * 4; padding-top: $gap * 2; flex-grow: unset; margin-left: $gap * 6; margin-top: $gap * 3; - max-width: 336px; + width: 33.77%; height: fit-content; background-color: $color-gray-lightest; } + .task-order__form { + .totals-box { + margin-top: 0; + } + } + .panel { @include shadow-panel; } diff --git a/templates/portfolios/task_orders/review.html b/templates/portfolios/task_orders/review.html index 40dec4b3..e12fe615 100644 --- a/templates/portfolios/task_orders/review.html +++ b/templates/portfolios/task_orders/review.html @@ -101,9 +101,7 @@
-
- {{ TotalsBox(task_order=task_order) }} -
+ {{ TotalsBox(task_order=task_order) }}
diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index fac96fb9..8f497051 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -91,14 +91,14 @@ {% endcall %} -
+
{% include "fragments/flash.html" %} {% if task_order_id %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order_id) %} {% else %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} {% endif %} -
+ {{ form.csrf_token }} {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }} @@ -339,9 +339,7 @@
{{ UploadInput(form.pdf) }}
-
- {{ TotalsBox(task_order=task_order) }} -
+ {{ TotalsBox(task_order=task_order) }}
From 61de7a5adf0d04ddf9a1dd422fa8612220d418e0 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Tue, 11 Jun 2019 11:24:38 -0400 Subject: [PATCH 06/12] Move CLIN type and CLIN number onto same line --- styles/elements/_inputs.scss | 2 +- styles/sections/_task_order.scss | 10 +++ templates/task_orders/edit.html | 109 +++++++++++++++++-------------- 3 files changed, 71 insertions(+), 50 deletions(-) diff --git a/styles/elements/_inputs.scss b/styles/elements/_inputs.scss index 7346d59e..5fb61b78 100644 --- a/styles/elements/_inputs.scss +++ b/styles/elements/_inputs.scss @@ -157,7 +157,7 @@ .usa-input__choices { // checkbox & radio sets legend { - padding: 0 0 $gap 0; + padding: 0 0 ($gap / 2) 0; @include h4; diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index a7662b64..830e591b 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -131,6 +131,16 @@ } } + .row.row__form-fields { + .col { + margin-left: $gap; + } + + .col:first-child { + margin-left: 0; + } + } + .panel { @include shadow-panel; } diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 8f497051..1110643c 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -61,8 +61,14 @@ v-bind:initial-loa-count="{{ fields.loas.data | length }}" inline-template>
- {{ OptionsInput(fields.jedi_clin_type) }} - {{ TextInput(fields.number) }} +
+
+ {{ OptionsInput(fields.jedi_clin_type) }} +
+
+ {{ TextInput(fields.number) }} +
+
Line of accounting (43 characters)
{% for loa in fields.loas %} @@ -125,54 +131,59 @@
-
-
- -
- CLIN type -
-
- -
-
- - -
- - - - - - - - - +
+
+
+
+ +
+ CLIN type +
+
+ +
+
- +
+ +
+ + + + + + + + + +
+
+
+
Line of accounting (43 characters)
{{ LOAInput() }} From 4e468273353e7b4ff480126f12fd754a51d431c0 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 10:14:46 -0400 Subject: [PATCH 07/12] Remove nesting from route when not needed --- atst/forms/task_order.py | 3 +- atst/routes/task_orders/new.py | 22 ++++------- styles/components/_sticky_cta.scss | 1 - templates/portfolios/task_orders/review.html | 2 +- templates/task_orders/edit.html | 2 +- tests/routes/task_orders/test_new.py | 40 +++++--------------- tests/test_access.py | 4 +- 7 files changed, 21 insertions(+), 53 deletions(-) diff --git a/atst/forms/task_order.py b/atst/forms/task_order.py index 1e2ce9b4..ff16f0a7 100644 --- a/atst/forms/task_order.py +++ b/atst/forms/task_order.py @@ -42,8 +42,7 @@ class UnclassifiedCLINForm(CLINForm): class TaskOrderForm(BaseForm): number = StringField( - label=translate("forms.task_order.number_description"), - validators=[Required()], + label=translate("forms.task_order.number_description"), validators=[Required()] ) pdf = FileField( None, diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index bfce2c26..fd3ce160 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -8,11 +8,12 @@ from atst.models.permissions import Permissions from atst.utils.flash import formatted_flash as flash -def render_task_orders_edit(portfolio_id, task_order_id=None, form=None): +def render_task_orders_edit(portfolio_id=None, task_order_id=None, form=None): render_args = {} if task_order_id: task_order = TaskOrders.get(task_order_id) + portfolio_id = task_order.portfolio_id render_args["form"] = form or TaskOrderForm(**task_order.to_dictionary()) render_args["task_order_id"] = task_order_id else: @@ -28,18 +29,16 @@ def render_task_orders_edit(portfolio_id, task_order_id=None, form=None): @task_orders_bp.route("/portfolios//task_orders/new") -@task_orders_bp.route("/portfolios//task_orders//edit") +@task_orders_bp.route("/task_orders//edit") @user_can(Permissions.CREATE_TASK_ORDER, message="view new task order form") -def edit(portfolio_id, task_order_id=None): +def edit(portfolio_id=None, task_order_id=None): return render_task_orders_edit(portfolio_id, task_order_id) @task_orders_bp.route("/portfolios//task_orders/new", methods=["POST"]) -@task_orders_bp.route( - "/portfolios//task_orders/", methods=["POST"] -) +@task_orders_bp.route("/task_orders/", methods=["POST"]) @user_can(Permissions.CREATE_TASK_ORDER, message="create new task order") -def update(portfolio_id, task_order_id=None): +def update(portfolio_id=None, task_order_id=None): form_data = {**http_request.form, **http_request.files} form = None @@ -53,18 +52,13 @@ def update(portfolio_id, task_order_id=None): task_order = None if task_order_id: task_order = TaskOrders.update(task_order_id, **form.data) + portfolio_id = task_order.portfolio_id else: task_order = TaskOrders.create(g.current_user, portfolio_id, **form.data) flash("task_order_draft") - return redirect( - url_for( - "task_orders.edit", - portfolio_id=portfolio_id, - task_order_id=task_order.id, - ) - ) + return redirect(url_for("task_orders.edit", task_order_id=task_order.id)) else: flash("form_errors") return render_task_orders_edit(portfolio_id, task_order_id, form), 400 diff --git a/styles/components/_sticky_cta.scss b/styles/components/_sticky_cta.scss index 2916018f..514383fa 100644 --- a/styles/components/_sticky_cta.scss +++ b/styles/components/_sticky_cta.scss @@ -42,7 +42,6 @@ a.action-group__action.icon-link { width: auto; - } input { diff --git a/templates/portfolios/task_orders/review.html b/templates/portfolios/task_orders/review.html index e12fe615..478fbaed 100644 --- a/templates/portfolios/task_orders/review.html +++ b/templates/portfolios/task_orders/review.html @@ -22,7 +22,7 @@ {% endcall %} {% call StickyCTA(text="Review Funding") %} - Edit + Edit Submit task order {% endcall %} diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 1110643c..bbfdac81 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -100,7 +100,7 @@
{% include "fragments/flash.html" %} {% if task_order_id %} - {% set action = url_for("task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order_id) %} + {% set action = url_for("task_orders.update", task_order_id=task_order_id) %} {% else %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} {% endif %} diff --git a/tests/routes/task_orders/test_new.py b/tests/routes/task_orders/test_new.py index fbda7141..7dbad2c4 100644 --- a/tests/routes/task_orders/test_new.py +++ b/tests/routes/task_orders/test_new.py @@ -68,13 +68,7 @@ def test_task_orders_update(client, user_session, portfolio): def test_task_orders_edit_existing_to(client, user_session, task_order): user_session(task_order.creator) - response = client.get( - url_for( - "task_orders.edit", - portfolio_id=task_order.portfolio_id, - task_order_id=task_order.id, - ) - ) + response = client.get(url_for("task_orders.edit", task_order_id=task_order.id)) assert response.status_code == 200 @@ -90,12 +84,7 @@ def test_task_orders_update_existing_to(client, user_session, task_order): "clins-0-loas-0": "123123123123", } response = client.post( - url_for( - "task_orders.update", - portfolio_id=task_order.portfolio_id, - task_order_id=task_order.id, - ), - data=form_data, + url_for("task_orders.update", task_order_id=task_order.id), data=form_data ) assert response.status_code == 302 assert task_order.number == "0123456789" @@ -115,12 +104,9 @@ def test_task_orders_update_invalid_data(client, user_session, portfolio): def test_task_orders_update(client, user_session, portfolio, pdf_upload): user_session(portfolio.owner) data = {"number": "0123456789", "pdf": pdf_upload} - task_order = TaskOrderFactory.create(number="0987654321") + task_order = TaskOrderFactory.create(number="0987654321", portfolio=portfolio) response = client.post( - url_for( - "task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id - ), - data=data, + url_for("task_orders.update", task_order_id=task_order.id), data=data ) assert response.status_code == 302 assert task_order.number == data["number"] @@ -130,13 +116,10 @@ def test_task_orders_update_pdf( client, user_session, portfolio, pdf_upload, pdf_upload2 ): user_session(portfolio.owner) - task_order = TaskOrderFactory.create(pdf=pdf_upload) + task_order = TaskOrderFactory.create(pdf=pdf_upload, portfolio=portfolio) data = {"number": "0123456789", "pdf": pdf_upload2} response = client.post( - url_for( - "task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id - ), - data=data, + url_for("task_orders.update", task_order_id=task_order.id), data=data ) assert response.status_code == 302 assert task_order.pdf.filename == pdf_upload2.filename @@ -144,13 +127,10 @@ def test_task_orders_update_pdf( def test_task_orders_update_delete_pdf(client, user_session, portfolio, pdf_upload): user_session(portfolio.owner) - task_order = TaskOrderFactory.create(pdf=pdf_upload) + task_order = TaskOrderFactory.create(pdf=pdf_upload, portfolio=portfolio) data = {"number": "0123456789", "pdf": ""} response = client.post( - url_for( - "task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id - ), - data=data, + url_for("task_orders.update", task_order_id=task_order.id), data=data ) assert response.status_code == 302 assert task_order.pdf is None @@ -167,9 +147,7 @@ def test_task_order_form_shows_errors(client, user_session, task_order): funding_data.update({"clin_01": "one milllllion dollars"}) response = client.post( - url_for( - "task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id - ), + url_for("task_orders.update", task_order_id=task_order.id), data=funding_data, follow_redirects=False, ) diff --git a/tests/test_access.py b/tests/test_access.py index 6841a09b..22519c05 100644 --- a/tests/test_access.py +++ b/tests/test_access.py @@ -515,9 +515,7 @@ def test_task_orders_update_access(post_url_assert_status): task_order = TaskOrderFactory.create(portfolio=portfolio) - url = url_for( - "task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id - ) + url = url_for("task_orders.update", task_order_id=task_order.id) post_url_assert_status(owner, url, 302) post_url_assert_status(ccpo, url, 302) post_url_assert_status(rando, url, 404) From db58c64a89c642dcf79a3dc8f46882075b9b0a3f Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 13:37:12 -0400 Subject: [PATCH 08/12] Move submit buttons inside form and add formaction to review button --- atst/routes/task_orders/new.py | 3 ++ templates/task_orders/edit.html | 50 +++++++++++++++++---------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index fd3ce160..d92f2d16 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -56,6 +56,9 @@ def update(portfolio_id=None, task_order_id=None): else: task_order = TaskOrders.create(g.current_user, portfolio_id, **form.data) + if http_request.args.get('review'): + return redirect(url_for("task_orders.review_task_order", task_order_id=task_order.id)) + flash("task_order_draft") return redirect(url_for("task_orders.edit", task_order_id=task_order.id)) diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index bbfdac81..1039a880 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -84,29 +84,31 @@ {% endmacro %} {% block portfolio_content %} - {% call StickyCTA(text="Add Funding") %} - - - - - {{ "common.cancel" | translate }} - - - {% endcall %} + {% if task_order_id %} + {% set action = url_for("task_orders.update", task_order_id=task_order_id) %} + {% set review_action = url_for("task_orders.update", task_order_id=task_order_id, review=True) %} + {% else %} + {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} + {% set review_action = url_for("task_orders.update", portfolio_id=portfolio.id, review=True) %} + {% endif %} +
+ {{ form.csrf_token }} - -
- {% include "fragments/flash.html" %} - {% if task_order_id %} - {% set action = url_for("task_orders.update", task_order_id=task_order_id) %} - {% else %} - {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} - {% endif %} - - {{ form.csrf_token }} + {% call StickyCTA(text="Add Funding") %} + + + + + {{ "common.cancel" | translate }} + + + {% endcall %} + +
+ {% include "fragments/flash.html" %} {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }}
@@ -352,8 +354,8 @@
{{ TotalsBox(task_order=task_order) }}
- -
- +
+ + {% endblock %} From 0826b0b1aa918555aa62604f09bf326fb10f6a09 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 14:11:55 -0400 Subject: [PATCH 09/12] Fix validation icons --- styles/sections/_task_order.scss | 14 +++++++++++++- templates/task_orders/edit.html | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index 830e591b..a6e0abc9 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -125,10 +125,22 @@ background-color: $color-gray-lightest; } - .task-order__form { + &.task_order__form { .totals-box { margin-top: 0; } + + .icon { + left: 100%; + } + + .usa-input--validation--dollars input { + max-width: unset; + } + + .usa-form-group-year { + margin-right: 0.4rem; + } } .row.row__form-fields { diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 1039a880..819dcd8e 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -91,7 +91,7 @@ {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} {% set review_action = url_for("task_orders.update", portfolio_id=portfolio.id, review=True) %} {% endif %} -
+ {{ form.csrf_token }} {% call StickyCTA(text="Add Funding") %} @@ -107,7 +107,7 @@ {% endcall %} -
+
{% include "fragments/flash.html" %} {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }} From b07cf0e4fcb2d715b5745cc9059605a94c97bd91 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 14:29:25 -0400 Subject: [PATCH 10/12] formatting --- atst/routes/task_orders/new.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index d92f2d16..b8284a35 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -56,8 +56,10 @@ def update(portfolio_id=None, task_order_id=None): else: task_order = TaskOrders.create(g.current_user, portfolio_id, **form.data) - if http_request.args.get('review'): - return redirect(url_for("task_orders.review_task_order", task_order_id=task_order.id)) + if http_request.args.get("review"): + return redirect( + url_for("task_orders.review_task_order", task_order_id=task_order.id) + ) flash("task_order_draft") From e5e668711fa0905b0a6373890fa6041c5c96050d Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 14:44:26 -0400 Subject: [PATCH 11/12] Remove SemiCollapsibleText --- templates/task_orders/edit.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 819dcd8e..2faa576d 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -109,7 +109,9 @@
{% include "fragments/flash.html" %} - {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }} +

+ {{ "task_orders.new.form_help_text" | translate }} +


From 753898db67c319a7e7c90e85e4945563ff71e765 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 12 Jun 2019 15:27:40 -0400 Subject: [PATCH 12/12] Set content width and move alert --- styles/sections/_task_order.scss | 8 ++++++-- templates/task_orders/edit.html | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index a6e0abc9..43ab28df 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -88,6 +88,7 @@ .task-order { margin-top: $gap * 4; + width: 900px; hr { border: 0; @@ -102,7 +103,6 @@ .col { flex-grow: 1; - max-width: 610px; } .h1, @@ -120,7 +120,7 @@ flex-grow: unset; margin-left: $gap * 6; margin-top: $gap * 3; - width: 33.77%; + width: 35%; height: fit-content; background-color: $color-gray-lightest; } @@ -141,6 +141,10 @@ .usa-form-group-year { margin-right: 0.4rem; } + + .usa-alert { + margin: 1.5em 0; + } } .row.row__form-fields { diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 2faa576d..6e0c9007 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -108,13 +108,14 @@
- {% include "fragments/flash.html" %}

{{ "task_orders.new.form_help_text" | translate }}


+ {% include "fragments/flash.html" %} +
Add your task order