Merge pull request #548 from dod-ccpo/to-congrats-msg

Add "Congrats" message after completing TO form
This commit is contained in:
patricksmithdds
2019-01-17 13:11:00 -05:00
committed by GitHub
6 changed files with 49 additions and 8 deletions

View File

@@ -8,7 +8,12 @@ from atst.utils.flash import formatted_flash as flash
@task_orders_bp.route("/task_orders/invite/<task_order_id>", 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,
)
)

View File

@@ -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 %}
<div class='alert__actions'>
<a href='{{ url_for("portfolios.show_portfolio", portfolio_id=portfolio.id) }}' class='icon-link'>
{{ Icon('shield') }}
<span>Go to my Portfolio Home Page</span>
</a>
<a href='#next-steps' class='icon-link'>
{{ Icon('arrow-down') }}
<span>Review Next Steps Below</span>
</a>
</div>
""",
"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"])