Merge pull request #548 from dod-ccpo/to-congrats-msg
Add "Congrats" message after completing TO form
This commit is contained in:
commit
ff9ade90b1
@ -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"])
|
@task_orders_bp.route("/task_orders/invite/<task_order_id>", methods=["POST"])
|
||||||
def invite(task_order_id):
|
def invite(task_order_id):
|
||||||
task_order = TaskOrders.get(g.current_user, 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(
|
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,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
@ -108,6 +108,26 @@ MESSAGES = {
|
|||||||
""",
|
""",
|
||||||
"category": "success",
|
"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]
|
config = MESSAGES[message_name]
|
||||||
title = render_template_string(config["title_template"], **message_args)
|
title = render_template_string(config["title_template"], **message_args)
|
||||||
message = render_template_string(config["message_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"])
|
||||||
|
@ -59,6 +59,10 @@
|
|||||||
|
|
||||||
.task-order-summary {
|
.task-order-summary {
|
||||||
|
|
||||||
|
.alert .alert__actions {
|
||||||
|
margin-top: 2 * $gap;
|
||||||
|
}
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{% with messages = get_flashed_messages(with_categories=true, category_filter=category_filter) %}
|
{% with messages = get_flashed_messages(with_categories=true, category_filter=category_filter) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
{% for category, message_config in 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 %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
@ -59,7 +59,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
<div class="task-order-summary">
|
<div class="task-order-summary">
|
||||||
|
{% include "fragments/flash.html" %}
|
||||||
|
|
||||||
<div class="panel task-order-heading row">
|
<div class="panel task-order-heading row">
|
||||||
<div class="panel__content task-order-heading__name row">
|
<div class="panel__content task-order-heading__name row">
|
||||||
<h2>New Task Order</h2>
|
<h2>New Task Order</h2>
|
||||||
@ -83,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="task-order-details">
|
<div class="task-order-details">
|
||||||
<div class="task-order-next-steps">
|
<div id="next-steps" class="task-order-next-steps">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h3 class="panel__content">What's next?</h3>
|
<h3 class="panel__content">What's next?</h3>
|
||||||
{{ Step(
|
{{ Step(
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
|
|
||||||
from tests.factories import TaskOrderFactory
|
from tests.factories import PortfolioFactory, TaskOrderFactory
|
||||||
|
|
||||||
|
|
||||||
def test_invite(client):
|
def test_invite(client, user_session):
|
||||||
to = TaskOrderFactory.create()
|
portfolio = PortfolioFactory.create()
|
||||||
|
user_session(portfolio.owner)
|
||||||
|
to = TaskOrderFactory.create(portfolio=portfolio)
|
||||||
response = client.post(
|
response = client.post(
|
||||||
url_for("task_orders.invite", task_order_id=to.id), follow_redirects=False
|
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"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user