From 772ca756881e0b5f6290f94e978580577c1477aa Mon Sep 17 00:00:00 2001 From: Montana Date: Thu, 21 Feb 2019 14:36:43 -0500 Subject: [PATCH] Refactor form action for new task order templates --- atst/routes/task_orders/new.py | 9 +++++++++ templates/task_orders/_new.html | 10 +--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index eff1584b..8ad10f27 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -215,6 +215,12 @@ def new(screen, task_order_id=None, portfolio_id=None): "complete": workflow.is_complete, } + url_args = {"screen": screen} + if task_order_id: + url_args["task_order_id"] = task_order_id + else: + url_args["portfolio_id"] = portfolio_id + if workflow.task_order: template_args["task_order"] = workflow.task_order if http_request.args.get("ko_edit"): @@ -224,6 +230,9 @@ def new(screen, task_order_id=None, portfolio_id=None): portfolio_id=workflow.task_order.portfolio.id, task_order_id=task_order_id, ) + url_args["next"] = template_args["next"] + + template_args["action_url"] = url_for("task_orders.update", **url_args) return render_template(workflow.template, **template_args) diff --git a/templates/task_orders/_new.html b/templates/task_orders/_new.html index 415e2c65..d4b7c48a 100644 --- a/templates/task_orders/_new.html +++ b/templates/task_orders/_new.html @@ -9,15 +9,7 @@ {% include "fragments/flash.html" %} {% block form_action %} - {% if ko_edit %} -
- {% endif %} - - {% if task_order_id %} - - {% else %} - - {% endif %} + {% endblock %}