Delete unused Jinja macros and rearrange templates.

Templates and fragments that relate to specific resources (portfolios,
applications, task orders) should reside in directories named for the
relevant resource. This also matches the way the application routes are
distributed among modules named for each resource type.
This commit is contained in:
dandds
2019-09-24 09:55:31 -04:00
parent c8a2e9ee96
commit 4f8cbc2b68
26 changed files with 41 additions and 72 deletions

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 %}