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:
83
templates/portfolios/fragments/add_new_portfolio_member.html
Normal file
83
templates/portfolios/fragments/add_new_portfolio_member.html
Normal file
@@ -0,0 +1,83 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/text_input.html" import TextInput %}
|
||||
{% from "components/multi_step_modal_form.html" import MultiStepModalForm %}
|
||||
|
||||
{% macro SimpleOptionsInput(field) %}
|
||||
<div class="usa-input">
|
||||
<fieldset data-ally-disabled="true" class="usa-input__choices">
|
||||
<legend>
|
||||
<div class="usa-input__title-inline">
|
||||
{{ field.label | striptags}}
|
||||
</div>
|
||||
</legend>
|
||||
{{ field() }}
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% set step_one %}
|
||||
<div class="modal__form--header">
|
||||
<h1>Invite new portfolio member</h1>
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(member_form.user_data.first_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(member_form.user_data.last_name, validation='requiredField', optional=False) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(member_form.user_data.email, validation='email', optional=False) }}
|
||||
</div>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(member_form.user_data.phone_number, validation='usPhone') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(member_form.user_data.dod_id, validation='dodId', optional=False) }}
|
||||
</div>
|
||||
<div class='form-col form-col--half'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='action-group'>
|
||||
<input
|
||||
type='button'
|
||||
v-on:click="next()"
|
||||
v-bind:disabled="invalid"
|
||||
class='action-group__action usa-button'
|
||||
value='Next'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('{{ new_port_mem }}')">Cancel</a>
|
||||
</div>
|
||||
{% endset %}
|
||||
{% set step_two %}
|
||||
<div class="modal__form--padded">
|
||||
<div class="modal__form--header">
|
||||
<h1>Assign member permissions</h1>
|
||||
<a class='icon-link'>
|
||||
{{ Icon('info') }}
|
||||
{{ "portfolios.admin.permissions_info" | translate }}
|
||||
</a>
|
||||
</div>
|
||||
{{ SimpleOptionsInput(member_form.permission_sets.perms_app_mgmt) }}
|
||||
{{ SimpleOptionsInput(member_form.permission_sets.perms_funding) }}
|
||||
{{ SimpleOptionsInput(member_form.permission_sets.perms_reporting) }}
|
||||
{{ SimpleOptionsInput(member_form.permission_sets.perms_portfolio_mgmt) }}
|
||||
<div class='action-group'>
|
||||
<input
|
||||
type="submit"
|
||||
class='action-group__action usa-button'
|
||||
form="add-port-mem"
|
||||
value='Invite member'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('{{ new_port_mem }}')">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endset %}
|
||||
{{ MultiStepModalForm(
|
||||
'add-port-mem',
|
||||
member_form,
|
||||
url_for("portfolios.invite_member", portfolio_id=portfolio.id),
|
||||
[step_one, step_two],
|
||||
) }}
|
83
templates/portfolios/fragments/change_ppoc.html
Normal file
83
templates/portfolios/fragments/change_ppoc.html
Normal file
@@ -0,0 +1,83 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/selector.html" import Selector %}
|
||||
{% from "components/text_input.html" import TextInput %}
|
||||
{% from "components/multi_step_modal_form.html" import MultiStepModalForm %}
|
||||
{% from "components/alert.html" import Alert %}
|
||||
{% from "components/options_input.html" import OptionsInput %}
|
||||
|
||||
{% set step_one %}
|
||||
<div class="modal__form--header">
|
||||
<h1>{{ "fragments.ppoc.update_ppoc_title" | translate }}</h1>
|
||||
</div>
|
||||
|
||||
{{
|
||||
Alert(
|
||||
level="warning",
|
||||
title=("fragments.ppoc.alert.title" | translate),
|
||||
message=("fragments.ppoc.alert.message" | translate),
|
||||
)
|
||||
}}
|
||||
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{
|
||||
OptionsInput(
|
||||
assign_ppoc_form.role_id
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<div class='form-col form-col--half'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='action-group'>
|
||||
<input
|
||||
type='button'
|
||||
v-on:click="next()"
|
||||
v-bind:disabled="invalid"
|
||||
class='action-group__action usa-button'
|
||||
value='{{ "fragments.ppoc.assign_user_button_text" | translate }}'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('change-ppoc-form')">
|
||||
{{ "common.cancel" | translate }}
|
||||
</a>
|
||||
</div>
|
||||
{% endset %}
|
||||
|
||||
{% set step_two %}
|
||||
<div class="modal__form--padded">
|
||||
<div class="modal__form--header">
|
||||
<h1>{{ "fragments.ppoc.update_ppoc_confirmation_title" | translate }}</h1>
|
||||
</div>
|
||||
|
||||
{{
|
||||
Alert(
|
||||
level="info",
|
||||
title=("fragments.ppoc.confirm_alert.title" | translate),
|
||||
)
|
||||
}}
|
||||
|
||||
<div class='action-group'>
|
||||
<input
|
||||
type="submit"
|
||||
class='action-group__action usa-button'
|
||||
form="change-ppoc-form"
|
||||
value='{{ "common.confirm" | translate }}'>
|
||||
<a class='action-group__action icon-link icon-link--default' v-on:click="closeModal('change-ppoc-form')">
|
||||
{{ "common.cancel" | translate }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endset %}
|
||||
|
||||
<div class="flex-reverse-row">
|
||||
<a class="usa-button-primary" v-on:click="openModal('change-ppoc-form')">
|
||||
{{ "fragments.ppoc.update_btn" | translate }}
|
||||
</a>
|
||||
{{
|
||||
MultiStepModalForm(
|
||||
'change-ppoc-form',
|
||||
assign_ppoc_form,
|
||||
form_action=url_for("portfolios.update_ppoc", portfolio_id=portfolio.id),
|
||||
steps=[step_one, step_two],
|
||||
)
|
||||
}}
|
||||
</div>
|
42
templates/portfolios/fragments/delete_portfolio.html
Normal file
42
templates/portfolios/fragments/delete_portfolio.html
Normal file
@@ -0,0 +1,42 @@
|
||||
{% from "components/delete_confirmation.html" import DeleteConfirmation %}
|
||||
{% from "components/alert.html" import Alert %}
|
||||
{% from "components/modal.html" import Modal %}
|
||||
|
||||
<section id="primary-point-of-contact" class="panel">
|
||||
<div class="panel__content">
|
||||
<h2>{{ "fragments.delete_portfolio.title" | translate }}</h2>
|
||||
<p>{{ "fragments.delete_portfolio.subtitle" | translate }}</p>
|
||||
|
||||
|
||||
<div
|
||||
class="usa-button-primary {% if applications_count == 0 %}button-danger{% else %}usa-button-disabled{% endif %}"
|
||||
{% if applications_count == 0 %}v-on:click="openModal('delete_portfolio')"{% endif %}
|
||||
>
|
||||
{{ "common.deactivate" | translate }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% call Modal(name="delete_portfolio") %}
|
||||
<h1>
|
||||
{{ 'fragments.delete_portfolio.title' | translate }}
|
||||
</h1>
|
||||
|
||||
{{
|
||||
Alert(
|
||||
level="warning",
|
||||
title=('components.modal.destructive_title' | translate),
|
||||
message=('components.modal.destructive_message' | translate({"resource": "portfolio"})),
|
||||
)
|
||||
}}
|
||||
|
||||
{{
|
||||
DeleteConfirmation(
|
||||
modal_id='delete_portfolio',
|
||||
delete_text='Deactivate',
|
||||
delete_action=url_for('portfolios.delete_portfolio', portfolio_id=portfolio.id),
|
||||
form=portfolio_form,
|
||||
confirmation_text="deactivate",
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
39
templates/portfolios/fragments/members_edit.html
Normal file
39
templates/portfolios/fragments/members_edit.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% from "components/alert.html" import Alert %}
|
||||
{% from "components/modal.html" import Modal %}
|
||||
{% from "components/options_input.html" import OptionsInput %}
|
||||
|
||||
{% for subform in member_perms_form.members_permissions %}
|
||||
{% set modal_id = "portfolio_id_{}_user_id_{}".format(portfolio.id, subform.member_id.data) %}
|
||||
{% set ppoc = subform.member_id.data == ppoc_id %}
|
||||
{% set archive_button_class = 'button-danger-outline' %}
|
||||
|
||||
<tr {% if ppoc %}class="members-table-ppoc"{% endif %}>
|
||||
<td class='name'>{{ subform.member_name.data }}
|
||||
<div>
|
||||
{% if ppoc %}
|
||||
{% set archive_button_class = 'usa-button-disabled' %}
|
||||
<span class='you'>PPoC</span>
|
||||
{% endif %}
|
||||
{% if subform.member_id.data == current_member_id %}
|
||||
{% set archive_button_class = 'usa-button-disabled' %}
|
||||
<span class='you'>(<span class='green'>you</span>)</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td>{{ OptionsInput(subform.perms_app_mgmt, label=False, disabled=ppoc) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_funding, label=False, disabled=ppoc) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_reporting, label=False, disabled=ppoc) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_portfolio_mgmt, label=False, disabled=ppoc) }}</td>
|
||||
|
||||
<td>
|
||||
<a v-on:click="openModal('{{ modal_id }}')" class='usa-button {{ archive_button_class }}'>
|
||||
{{ "portfolios.members.archive_button" | translate }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
{% if not ppoc %}
|
||||
{{ subform.member_id() }}
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
26
templates/portfolios/fragments/members_view.html
Normal file
26
templates/portfolios/fragments/members_view.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% for subform in member_perms_form.members_permissions %}
|
||||
{% set ppoc = subform.member_id.data == ppoc_id %}
|
||||
{% set heading_perms = [subform.perms_app_mgmt, subform.perms_funding, subform.perms_reporting, subform.perms_portfolio_mgmt] %}
|
||||
|
||||
<tr>
|
||||
<td class='name'>{{ subform.member_name.data }}
|
||||
<div>
|
||||
{% if ppoc %}
|
||||
<span class='you'>PPoC</span>
|
||||
{% endif %}
|
||||
{% if subform.member_id.data == current_member_id %}
|
||||
<span class='you'>(<span class='green'>you</span>)</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{% for access in heading_perms %}
|
||||
{% if dict(access.choices).get(access.data) == ('portfolios.members.permissions.edit_access' | translate) %}
|
||||
<td class='green'>{{ 'portfolios.members.permissions.edit_access' | translate }}</td>
|
||||
{% else %}
|
||||
<td>{{ 'common.view' | translate }}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
107
templates/portfolios/fragments/portfolio_members.html
Normal file
107
templates/portfolios/fragments/portfolio_members.html
Normal file
@@ -0,0 +1,107 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from 'components/save_button.html' import SaveButton %}
|
||||
{% from "components/modal.html" import Modal %}
|
||||
{% from "components/alert.html" import Alert %}
|
||||
|
||||
<section class="member-list" id="portfolio-members">
|
||||
<base-form inline-template>
|
||||
<div class='responsive-table-wrapper panel accordion-table'>
|
||||
{% if g.matchesPath("portfolio-members") %}
|
||||
{% include "fragments/flash.html" %}
|
||||
{% endif %}
|
||||
<form method='POST' id="member-perms" action='{{ url_for("portfolios.edit_members", portfolio_id=portfolio.id) }}' autocomplete="off" enctype="multipart/form-data">
|
||||
{{ member_perms_form.csrf_token }}
|
||||
|
||||
<div class='application-list-item'>
|
||||
<header>
|
||||
<div class='responsive-table-wrapper__header'>
|
||||
<div class='responsive-table-wrapper__title'>
|
||||
<div class='h3'>{{ "portfolios.admin.portfolio_members_title" | translate }}</div>
|
||||
<div class='subheading'>
|
||||
{{ "portfolios.admin.portfolio_members_subheading" | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class='icon-link'>
|
||||
{{ Icon('info') }}
|
||||
{{ "portfolios.admin.settings_info" | translate }}
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if not portfolio.members %}
|
||||
<p>{{ "portfolios.admin.no_members" | translate }}</p>
|
||||
{% else %}
|
||||
<table class="atat-table">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{ "portfolios.members.permissions.name" | translate }}</td>
|
||||
<td>{{ "portfolios.members.permissions.app_mgmt" | translate }}</td>
|
||||
<td>{{ "portfolios.members.permissions.funding" | translate }}</td>
|
||||
<td>{{ "portfolios.members.permissions.reporting" | translate }}</td>
|
||||
<td>{{ "portfolios.members.permissions.portfolio_mgmt" | translate }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% if user_can(permissions.EDIT_PORTFOLIO_USERS) %}
|
||||
{% include "portfolios/fragments/members_edit.html" %}
|
||||
{% elif user_can(permissions.VIEW_PORTFOLIO_USERS) %}
|
||||
{% include "portfolios/fragments/members_view.html" %}
|
||||
{% endif %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="panel__footer">
|
||||
<div class="action-group save">
|
||||
{% if user_can(permissions.EDIT_PORTFOLIO_USERS) %}
|
||||
{{ SaveButton(text=('common.save' | translate), element="input", form="member-perms") }}
|
||||
{% endif %}
|
||||
|
||||
{% if user_can(permissions.CREATE_PORTFOLIO_USERS) %}
|
||||
<a class="icon-link modal-link" v-on:click="openModal('add-port-mem')">
|
||||
{{ "portfolios.admin.add_new_member" | translate }}
|
||||
{{ Icon("plus") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% if user_can(permissions.CREATE_PORTFOLIO_USERS) %}
|
||||
{% include "portfolios/fragments/add_new_portfolio_member.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% if user_can(permissions.EDIT_PORTFOLIO_USERS) %}
|
||||
{% for subform in member_perms_form.members_permissions %}
|
||||
{% set modal_id = "portfolio_id_{}_user_id_{}".format(portfolio.id, subform.member_id.data) %}
|
||||
{% call Modal(name=modal_id, dismissable=False) %}
|
||||
<h1>{{ "portfolios.admin.alert_header" | translate }}</h1>
|
||||
{{
|
||||
Alert(
|
||||
title="portfolios.admin.alert_title" | translate,
|
||||
message="portfolios.admin.alert_message" | translate,
|
||||
level="warning"
|
||||
)
|
||||
}}
|
||||
<div class="panel__footer">
|
||||
<div class="action-group">
|
||||
<form method="POST" action="{{ url_for('portfolios.remove_member', portfolio_id=portfolio.id, portfolio_role_id=subform.member_id.data)}}">
|
||||
{{ member_perms_form.csrf_token }}
|
||||
<button class="usa-button usa-button-danger">
|
||||
{{ "portfolios.members.archive_button" | translate }}
|
||||
</button>
|
||||
</form>
|
||||
<a v-on:click="closeModal('{{ modal_id }}')" class="action-group__action icon-link icon-link--default">{{ "common.cancel" | translate }}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</base-form>
|
||||
</section>
|
25
templates/portfolios/fragments/primary_point_of_contact.html
Normal file
25
templates/portfolios/fragments/primary_point_of_contact.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<section id="primary-point-of-contact" class="panel">
|
||||
<div class="panel__content">
|
||||
{% if g.matchesPath("primary-point-of-contact") %}
|
||||
{% include "fragments/flash.html" %}
|
||||
{% endif %}
|
||||
|
||||
<h2>{{ "fragments.ppoc.title" | translate }}</h2>
|
||||
<p>{{ "fragments.ppoc.subtitle" | translate }}</p>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
{{ portfolio.owner.first_name }}
|
||||
{{ portfolio.owner.last_name }}
|
||||
</strong>
|
||||
<br />
|
||||
{{ portfolio.owner.email }}
|
||||
<br />
|
||||
{{ portfolio.owner.phone_number | usPhone }}
|
||||
</p>
|
||||
|
||||
{% if user_can(permissions.EDIT_PORTFOLIO_POC) %}
|
||||
{% include "portfolios/fragments/change_ppoc.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
Reference in New Issue
Block a user