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: else:
task_order = TaskOrders.create(g.current_user, portfolio_id, **form.data) 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") flash("task_order_draft")
return redirect(url_for("task_orders.edit", task_order_id=task_order.id)) return redirect(url_for("task_orders.edit", task_order_id=task_order.id))

View File

@ -84,29 +84,31 @@
{% endmacro %} {% endmacro %}
{% block portfolio_content %} {% block portfolio_content %}
{% call StickyCTA(text="Add Funding") %} {% if task_order_id %}
<span class="action-group"> {% set action = url_for("task_orders.update", task_order_id=task_order_id) %}
<input type="submit" tabindex="0" value="Review task order" form="new-task-order" class="usa-button usa-button-primary"> {% set review_action = url_for("task_orders.update", task_order_id=task_order_id, review=True) %}
<input type="submit" tabindex="0" value="Save" form="new-task-order" class="usa-button usa-button-secondary"> {% else %}
<a {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %}
href="{{ cancel_url }}" {% set review_action = url_for("task_orders.update", portfolio_id=portfolio.id, review=True) %}
class="action-group__action icon-link"> {% endif %}
{{ "common.cancel" | translate }} <form id="new-task-order" class="task_order__form" action='{{ action }}' method="POST" autocomplete="off" enctype="multipart/form-data">
</a> {{ form.csrf_token }}
</span>
{% endcall %}
<to-form inline-template v-bind:initial-clin-count="{{ form.clins.data | length }}"> {% call StickyCTA(text="Add Funding") %}
<div class="task-order"> <span class="action-group">
{% include "fragments/flash.html" %} <input type="submit" formaction="{{ review_action }}" tabindex="0" value="Review task order" form="new-task-order" class="usa-button usa-button-primary">
{% if task_order_id %} <input type="submit" tabindex="0" value="Save" form="new-task-order" class="usa-button usa-button-secondary">
{% set action = url_for("task_orders.update", task_order_id=task_order_id) %} <a
{% else %} href="{{ cancel_url }}"
{% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} class="action-group__action icon-link">
{% endif %} {{ "common.cancel" | translate }}
<form id="new-task-order" class="task_order__form" action='{{ action }}' method="POST" autocomplete="off" enctype="multipart/form-data"> </a>
{{ form.csrf_token }} </span>
{% endcall %}
<to-form inline-template v-bind:initial-clin-count="{{ form.clins.data | length }}">
<div class="task-order">
{% include "fragments/flash.html" %}
{{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }} {{ SemiCollapsibleText(paragraph="task_orders.new.form_help_text" | translate) }}
<hr> <hr>
@ -352,8 +354,8 @@
</div> </div>
{{ TotalsBox(task_order=task_order) }} {{ TotalsBox(task_order=task_order) }}
</div> </div>
</form> </div>
</div> </to-form>
</to-form> </form>
{% endblock %} {% endblock %}