diff --git a/atst/routes/task_orders/invite.py b/atst/routes/task_orders/invite.py index 1e8e40ac..ac40e0c2 100644 --- a/atst/routes/task_orders/invite.py +++ b/atst/routes/task_orders/invite.py @@ -8,7 +8,12 @@ from atst.utils.flash import formatted_flash as flash @task_orders_bp.route("/task_orders/invite/", methods=["POST"]) def invite(task_order_id): task_order = TaskOrders.get(g.current_user, task_order_id) - flash("task_order_submitted", task_order=task_order) + portfolio = task_order.portfolio + flash("task_order_congrats", portfolio=portfolio) return redirect( - url_for("portfolios.portfolio_members", portfolio_id=task_order.portfolio.id) + url_for( + "portfolios.view_task_order", + portfolio_id=task_order.portfolio_id, + task_order_id=task_order.id, + ) ) diff --git a/atst/utils/flash.py b/atst/utils/flash.py index 4ba9ac42..a64693e0 100644 --- a/atst/utils/flash.py +++ b/atst/utils/flash.py @@ -108,6 +108,26 @@ MESSAGES = { """, "category": "success", }, + "task_order_congrats": { + "title_template": "Congrats!", + "message_template": """ + You've created a new JEDI portfolio and jump started your first task order! + """, + "actions": """ + {% from "components/icon.html" import Icon %} +
+ + {{ Icon('shield') }} + Go to my Portfolio Home Page + + + {{ Icon('arrow-down') }} + Review Next Steps Below + +
+ """, + "category": "success", + }, } @@ -115,4 +135,7 @@ def formatted_flash(message_name, **message_args): config = MESSAGES[message_name] title = render_template_string(config["title_template"], **message_args) message = render_template_string(config["message_template"], **message_args) - flash({"title": title, "message": message}, config["category"]) + actions = None + if "actions" in config: + actions = render_template_string(config["actions"], **message_args) + flash({"title": title, "message": message, "actions": actions}, config["category"]) diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index 3b85a4a7..b524158e 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -59,6 +59,10 @@ .task-order-summary { + .alert .alert__actions { + margin-top: 2 * $gap; + } + .panel { width: 100%; } diff --git a/templates/fragments/flash.html b/templates/fragments/flash.html index 518f27a5..49057352 100644 --- a/templates/fragments/flash.html +++ b/templates/fragments/flash.html @@ -7,7 +7,7 @@ {% with messages = get_flashed_messages(with_categories=true, category_filter=category_filter) %} {% if messages %} {% for category, message_config in messages %} - {{ Alert(message_config["title"], message=message_config.get("message"), level=category) }} + {{ Alert(message_config["title"], message=message_config.get("message"), actions=message_config.get("actions"), level=category) }} {% endfor %} {% endif %} {% endwith %} diff --git a/templates/portfolios/task_orders/show.html b/templates/portfolios/task_orders/show.html index 863c81da..38dadacf 100644 --- a/templates/portfolios/task_orders/show.html +++ b/templates/portfolios/task_orders/show.html @@ -59,7 +59,10 @@ {% endmacro %} +
+ {% include "fragments/flash.html" %} +

New Task Order

@@ -83,7 +86,7 @@
-
+

What's next?

{{ Step( diff --git a/tests/routes/task_orders/test_invite.py b/tests/routes/task_orders/test_invite.py index 39cfeb76..6ee9fa30 100644 --- a/tests/routes/task_orders/test_invite.py +++ b/tests/routes/task_orders/test_invite.py @@ -1,11 +1,17 @@ import pytest from flask import url_for -from tests.factories import TaskOrderFactory +from tests.factories import PortfolioFactory, TaskOrderFactory -def test_invite(client): - to = TaskOrderFactory.create() +def test_invite(client, user_session): + portfolio = PortfolioFactory.create() + user_session(portfolio.owner) + to = TaskOrderFactory.create(portfolio=portfolio) response = client.post( url_for("task_orders.invite", task_order_id=to.id), follow_redirects=False ) + redirect = url_for( + "portfolios.view_task_order", portfolio_id=to.portfolio_id, task_order_id=to.id + ) + assert redirect in response.headers["Location"]