Move submit buttons inside form and add formaction to review button

This commit is contained in:
leigh-mil 2019-06-12 13:37:12 -04:00
parent 4e46827335
commit db58c64a89
2 changed files with 29 additions and 24 deletions

View File

@ -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))

View File

@ -84,9 +84,19 @@
{% endmacro %}
{% block portfolio_content %}
{% 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 id="new-task-order" class="task_order__form" action='{{ action }}' method="POST" autocomplete="off" enctype="multipart/form-data">
{{ form.csrf_token }}
{% call StickyCTA(text="Add Funding") %}
<span class="action-group">
<input type="submit" tabindex="0" value="Review task order" form="new-task-order" class="usa-button usa-button-primary">
<input type="submit" formaction="{{ review_action }}" tabindex="0" value="Review task order" form="new-task-order" class="usa-button usa-button-primary">
<input type="submit" tabindex="0" value="Save" form="new-task-order" class="usa-button usa-button-secondary">
<a
href="{{ cancel_url }}"
@ -99,14 +109,6 @@
<to-form inline-template v-bind:initial-clin-count="{{ form.clins.data | length }}">
<div class="task-order">
{% 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 id="new-task-order" class="task_order__form" action='{{ action }}' method="POST" autocomplete="off" enctype="multipart/form-data">
{{ form.csrf_token }}
{{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }}
<hr>
@ -352,8 +354,8 @@
</div>
{{ TotalsBox(task_order=task_order) }}
</div>
</form>
</div>
</to-form>
</form>
{% endblock %}