Toggle on click

- New copy to the translations file
- CSS is not updated
This commit is contained in:
Montana 2019-05-08 09:40:02 -04:00
parent 4c2b6c331b
commit 41818d7955
4 changed files with 53 additions and 0 deletions

View File

@ -169,6 +169,19 @@ def update(application_id):
environments_obj=get_environments_obj_for_app(application=application),
)
@applications_bp.route("/applications/<application_id>/add_environment", methods=["POST"])
@user_can(Permissions.EDIT_APPLICATION, message="add application environment")
def add_environment(application_id):
application = Applications.get(application_id)
form = ApplicationForm(http_request.form)
return render_template(
"portfolios/applications/settings.html",
application=application,
form=form,
environments_obj=get_environments_obj_for_app(application=application),
)
@applications_bp.route("/environments/<environment_id>/roles", methods=["POST"])
@user_can(Permissions.ASSIGN_ENVIRONMENT_MEMBER, message="update environment roles")

View File

@ -0,0 +1,33 @@
{% from "components/toggle_list.html" import ToggleButton, ToggleSection %}
<form method='POST' id="add-new-env" action='{{ url_for("applications.add_environment", application_id=application.id) }}' autocomplete="off" enctype="multipart/form-data">
{{ form.csrf_token }}
<toggler inline-template>
<div>
{% set add_env_link %}
<a class='icon-link'>
{{ "portfolios.applications.add_environment" | translate }}
{{ Icon('plus') }}
</a>
{% endset %}
{% call ToggleSection(section_name="add-new-environment") %}
<div class="accordion-table__item-content">
<span>{{ "portfolios.applications.create_new_env" | translate }}</span>
<div>{{ "portfolios.applications.create_new_env_info" | translate }}</div>
<span>{{ "portfolios.applications.enter_env_name" | translate }}</span>
</div>
{% endcall %}
{{
ToggleButton(
open_html=add_env_link,
close_html=add_env_link,
section_name="add-new-environment"
)
}}
</div>
</toggler>
</form>

View File

@ -69,6 +69,10 @@
{% if user_can(permissions.EDIT_APPLICATION) %}
{% include "fragments/applications/edit_environments.html" %}
{% if user_can(permissions.CREATE_ENVIRONMENT) %}
{% include "fragments/applications/add_new_environment.html" %}
{% endif %}
{% elif user_can(permissions.VIEW_ENVIRONMENT) %}
{% include "fragments/applications/read_only_environments.html" %}
{% endif %}

View File

@ -420,6 +420,8 @@ portfolios:
add_another_environment: Add another environment
app_settings_text: App settings
create_button_text: Create
create_new_env: Create a new environment.
create_new_env_info: Creating an environment gives you access to the Cloud Service Provider. This environment will function within the constraints of the task order, and any costs will be billed against the portfolio.
csp_console_text: CSP console
delete:
alert:
@ -427,6 +429,7 @@ portfolios:
title: Warning! This action is permanent.
button: Delete application
header: Are you sure you want to delete this application?
enter_env_name: "Enter environment name:"
environments:
name: Name
delete: