Merge pull request #1092 from dod-ccpo/template-cleanup

Delete unused Jinja macros and rearrange templates.
This commit is contained in:
dandds 2019-09-25 11:31:07 -04:00 committed by GitHub
commit a4f0b10bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 41 additions and 72 deletions

View File

@ -23,4 +23,4 @@ def has_portfolio_applications(_user, portfolio=None, **_kwargs):
message="view portfolio applications",
)
def portfolio_applications(portfolio_id):
return render_template("portfolios/applications/index.html")
return render_template("applications/index.html")

View File

@ -37,7 +37,7 @@ def render_new_application_form(
@user_can(Permissions.CREATE_APPLICATION, message="view create new application form")
def view_new_application_step_1(portfolio_id, application_id=None):
return render_new_application_form(
"portfolios/applications/new/step_1.html",
"applications/new/step_1.html",
NameAndDescriptionForm,
portfolio_id=portfolio_id,
application_id=application_id,
@ -78,7 +78,7 @@ def create_or_update_new_application_step_1(portfolio_id, application_id=None):
else:
return (
render_new_application_form(
"portfolios/applications/new/step_1.html",
"applications/new/step_1.html",
NameAndDescriptionForm,
portfolio_id,
application_id,
@ -94,7 +94,7 @@ def create_or_update_new_application_step_1(portfolio_id, application_id=None):
@user_can(Permissions.CREATE_APPLICATION, message="view create new application form")
def view_new_application_step_2(portfolio_id, application_id):
return render_new_application_form(
"portfolios/applications/new/step_2.html",
"applications/new/step_2.html",
EnvironmentsForm,
portfolio_id=portfolio_id,
application_id=application_id,
@ -122,7 +122,7 @@ def update_new_application_step_2(portfolio_id, application_id):
else:
return (
render_new_application_form(
"portfolios/applications/new/step_2.html",
"applications/new/step_2.html",
EnvironmentsForm,
portfolio_id,
application_id,

View File

@ -130,7 +130,7 @@ def render_settings_page(application, **kwargs):
)
return render_template(
"portfolios/applications/settings.html",
"applications/settings.html",
application=application,
environments_obj=environments_obj,
new_env_form=new_env_form,

View File

@ -18,7 +18,7 @@ def review_task_order(task_order_id):
else:
signature_form = SignatureForm()
return render_template(
"portfolios/task_orders/review.html",
"task_orders/review.html",
task_order=task_order,
signature_form=signature_form,
)
@ -37,7 +37,5 @@ def portfolio_funding(portfolio_id):
TaskOrderStatus.UNSIGNED: "purple",
}
return render_template(
"portfolios/task_orders/index.html",
task_orders=task_orders,
label_colors=label_colors,
"task_orders/index.html", task_orders=task_orders, label_colors=label_colors
)

View File

@ -2,7 +2,7 @@
{% from "components/text_input.html" import TextInput %}
{% from "components/checkbox_input.html" import CheckboxInput %}
{% from "components/phone_input.html" import PhoneInput %}
{% from "fragments/applications/member_perms_form_fields.html" import MemberPermsFields %}
{% from "applications/fragments/member_perms_form_fields.html" import MemberPermsFields %}
{% macro MemberFormTemplate(title, next_button, previous=True) %}
<div class="modal__form--header">

View File

@ -1,4 +1,4 @@
{% extends "portfolios/applications/base.html" %}
{% extends "applications/base.html" %}
{% from "components/alert.html" import Alert %}
{% from "components/text_input.html" import TextInput %}
@ -12,7 +12,7 @@
{% set action = url_for('applications.create_new_application_step_1', portfolio_id=portfolio.id, application_id=application_id) %}
{% endif %}
{% block application_content %}
{% include "fragments/flash.html" %}

View File

@ -1,4 +1,4 @@
{% extends "portfolios/applications/base.html" %}
{% extends "applications/base.html" %}
{% from "components/alert.html" import Alert %}
{% from "components/icon.html" import Icon %}

View File

@ -1,10 +1,10 @@
{% extends "portfolios/applications/base.html" %}
{% extends "applications/base.html" %}
{% from "components/alert.html" import Alert %}
{% from "components/delete_confirmation.html" import DeleteConfirmation %}
{% from "components/icon.html" import Icon %}
{% import "fragments/applications/new_member_modal_content.html" as member_steps %}
{% from "fragments/applications/member_perms_form_fields.html" import MemberPermsFields %}
{% import "applications/fragments/new_member_modal_content.html" as member_steps %}
{% from "applications/fragments/member_perms_form_fields.html" import MemberPermsFields %}
{% from "components/modal.html" import Modal %}
{% from "components/multi_step_modal_form.html" import MultiStepModalForm %}
{% from "components/pagination.html" import Pagination %}
@ -187,7 +187,7 @@
</div>
{% if user_can(permissions.CREATE_APPLICATION_MEMBER) %}
{% import "fragments/applications/new_member_modal_content.html" as member_steps %}
{% import "applications/fragments/new_member_modal_content.html" as member_steps %}
{{ MultiStepModalForm(
name=new_member_modal_name,
form=new_member_form,
@ -205,7 +205,7 @@
{{ 'common.resource_names.environments' | translate }}
{% if user_can(permissions.CREATE_ENVIRONMENT) %}
{% include "fragments/applications/add_new_environment.html" %}
{% include "applications/fragments/add_new_environment.html" %}
{% endif %}
</div>

View File

@ -1,18 +0,0 @@
{% macro TotalsBox(task_order=None, obligated_funds=0, contract_amount=0) -%}
<div class="totals-box">
{% if task_order %}
{% set obligated_funds = task_order.total_obligated_funds %}
{% set contract_amount = task_order.total_contract_amount %}
{% endif %}
<div class="h4">{{ 'components.totals_box.obligated_funds' | translate }}</div>
<div class="h3">{{ obligated_funds | dollars }}</div>
<p>{{ 'components.totals_box.obligated_text' | translate }}</p>
<div class="h4">{{ 'components.totals_box.total_amount' | translate }}</div>
<div class="h3">{{ contract_amount | dollars }}</div>
<p>{{ 'components.totals_box.total_text' | translate }}</p>
</div>
{%- endmacro %}

View File

@ -1,23 +0,0 @@
{% from "components/text_input.html" import TextInput %}
{% macro UserInfo(first_name, last_name, email, phone) -%}
<div class='form-row'>
<div class='form-col form-col--half'>
{{ TextInput(first_name) }}
</div>
<div class='form-col form-col--half'>
{{ TextInput(last_name) }}
</div>
</div>
<div class='form-row'>
<div class='form-col form-col--half'>
{{ TextInput(email, placeholder='name@mail.mil', validation='email') }}
</div>
<div class='form-col form-col--half'>
{{ TextInput(phone, placeholder='(123) 456-7890', validation='usPhone') }}
</div>
</div>
{% endmacro %}

View File

@ -53,15 +53,15 @@
</div>
{% if user_can(permissions.VIEW_PORTFOLIO_POC) %}
{% include "fragments/primary_point_of_contact.html" %}
{% include "portfolios/fragments/primary_point_of_contact.html" %}
{% endif %}
{% if user_can(permissions.ARCHIVE_PORTFOLIO) %}
{% include "fragments/delete_portfolio.html" %}
{% include "portfolios/fragments/delete_portfolio.html" %}
{% endif %}
{% if user_can(permissions.VIEW_PORTFOLIO_USERS) %}
{% include "fragments/admin/portfolio_members.html" %}
{% include "portfolios/fragments/portfolio_members.html" %}
{% endif %}
{% if user_can(permissions.VIEW_PORTFOLIO_ACTIVITY_LOG) %}

View File

@ -47,9 +47,9 @@
<tbody>
{% if user_can(permissions.EDIT_PORTFOLIO_USERS) %}
{% include "fragments/admin/members_edit.html" %}
{% include "portfolios/fragments/members_edit.html" %}
{% elif user_can(permissions.VIEW_PORTFOLIO_USERS) %}
{% include "fragments/admin/members_view.html" %}
{% include "portfolios/fragments/members_view.html" %}
{% endif %}
</tbody>
@ -73,7 +73,7 @@
</div>
</form>
{% if user_can(permissions.CREATE_PORTFOLIO_USERS) %}
{% include "fragments/admin/add_new_portfolio_member.html" %}
{% include "portfolios/fragments/add_new_portfolio_member.html" %}
{% endif %}
{% if user_can(permissions.EDIT_PORTFOLIO_USERS) %}

View File

@ -19,7 +19,7 @@
</p>
{% if user_can(permissions.EDIT_PORTFOLIO_POC) %}
{% include "fragments/admin/change_ppoc.html" %}
{% include "portfolios/fragments/change_ppoc.html" %}
{% endif %}
</div>
</section>

View File

@ -1,6 +1,5 @@
{% from "components/icon.html" import Icon %}
{% from "components/semi_collapsible_text.html" import SemiCollapsibleText %}
{% from "components/totals_box.html" import TotalsBox %}
<div class="task-order__review">
@ -10,7 +9,20 @@
{{ "task_orders.review.review_your_funding" | translate }}
</div>
<div>
{{ TotalsBox(task_order=task_order) }}
<div class="totals-box">
{% if task_order %}
{% set obligated_funds = task_order.total_obligated_funds %}
{% set contract_amount = task_order.total_contract_amount %}
{% endif %}
<div class="h4">{{ 'components.totals_box.obligated_funds' | translate }}</div>
<div class="h3">{{ obligated_funds | dollars }}</div>
<p>{{ 'components.totals_box.obligated_text' | translate }}</p>
<div class="h4">{{ 'components.totals_box.total_amount' | translate }}</div>
<div class="h3">{{ contract_amount | dollars }}</div>
<p>{{ 'components.totals_box.total_text' | translate }}</p>
</div>
</div>
<div class="h3">
@ -35,7 +47,7 @@
{{ "task_orders.review.funding_summary" | translate }}
</div>
<table class="fixed-table-wrapper">
<thead>
<tr>

View File

@ -11,6 +11,6 @@
{% endcall %}
<div class="task-order">
{% include "fragments/task_order_review.html" %}
{% include "task_orders/fragments/task_order_review.html" %}
</div>
{% endblock %}

View File

@ -13,5 +13,5 @@
{% endblock %}
{% block to_builder_form_field %}
{% include "fragments/task_order_review.html" %}
{% include "task_orders/fragments/task_order_review.html" %}
{% endblock %}