diff --git a/atst/routes/portfolios/applications.py b/atst/routes/portfolios/applications.py index 955683dd..85216b9e 100644 --- a/atst/routes/portfolios/applications.py +++ b/atst/routes/portfolios/applications.py @@ -58,6 +58,15 @@ def create_application(portfolio_id): ) +def get_environments_obj_for_app(application): + environments_obj = {} + + for env in application.environments: + environments_obj[env.name] = [user.full_name for user in env.users] + + return environments_obj + + @portfolios_bp.route("/portfolios//applications//edit") @user_can(Permissions.EDIT_APPLICATION, message="view application edit form") def edit_application(portfolio_id, application_id): @@ -65,16 +74,12 @@ def edit_application(portfolio_id, application_id): application = Applications.get(application_id) form = ApplicationForm(name=application.name, description=application.description) - environments_obj = {} - for env in application.environments: - environments_obj[env.name] = [user.full_name for user in env.users] - return render_template( "portfolios/applications/edit.html", portfolio=portfolio, application=application, form=form, - environments_obj=environments_obj, + environments_obj=get_environments_obj_for_app(application=application), ) @@ -99,6 +104,7 @@ def update_application(portfolio_id, application_id): portfolio=portfolio, application=application, form=form, + environments_obj=get_environments_obj_for_app(application=application), ) diff --git a/styles/components/_accordion_table.scss b/styles/components/_accordion_table.scss index 53153470..69694322 100644 --- a/styles/components/_accordion_table.scss +++ b/styles/components/_accordion_table.scss @@ -1,65 +1,111 @@ +.float-right { + float: right; +} + .accordion-table { + ul { + padding-left: 0; + } + + &.accordion-table-list { + display: table; + width: 100%; + } + + .accordion-table__head { + padding: $gap $gap*2; + font-weight: 700; + color: $color-gray; + text-transform: uppercase; + background-color: $color-gray-lightest; + border-bottom: 1px solid $color-gray-lightest; + border-top: none; + } + + thead th { + text-transform: uppercase; + border-bottom: 1px solid $color-gray-lightest; + border-top: none; + } + + th, td { + white-space: nowrap; + + button { + margin: 0; + } + } + + .accordion-table__item-content { + padding-top: $gap*3; + padding-right: $gap; + padding-bottom: $gap*3; + padding-left: $gap*3; + } + + .accordion-table__items { + margin: 0; + + li { + + list-style-type: none; - table { - thead th { - text-transform: uppercase; border-bottom: 1px solid $color-gray-lightest; - border-top: none; - } + margin: 0; - th, td { - white-space: nowrap; + ul { + margin-top: 0; + margin-bottom: 0; + background-color: $color-gray-lightest; - button { - margin: 0; + li { + border-bottom: 1px solid $color-gray-lighter; + } } } - .accordion-table__items { - .accordion-table__item__toggler { - @include icon-link-color($color-blue, $color-gray-lightest); - float: right; - margin-left: -$gap; - color: $color-blue; + .accordion-table__item__toggler { + @include icon-link-color($color-blue, $color-gray-lightest); + float: right; + color: $color-blue; + padding: $gap; + margin: -$gap 0; - .icon { - @include icon-size(12); - margin-right: $gap; - } - - .open-indicator { - position: absolute; - bottom: 0; - left: 5 * $gap; - width: 0; - height: 0; - border-left: 10px solid transparent; - border-right: 10px solid transparent; - - border-bottom: 10px solid $color-blue-light; - } + .icon { + @include icon-size(12); + margin-right: $gap; } - th, td, tr { - border-bottom: 1px dashed $color-gray-lightest; + .open-indicator { + position: absolute; + bottom: 0; + left: 5 * $gap; + width: 0; + height: 0; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + + border-bottom: 10px solid $color-blue-light; } + } - th[scope=rowgroup] { - position: relative; - } + th, td, tr { + border-bottom: 1px dashed $color-gray-lightest; + } - .accordion-table__item__expanded { - margin-left: 2 * $gap; + th[scope=rowgroup] { + position: relative; + } - th, td { - .icon-link { - font-weight: $font-normal; - font-size: $base-font-size; - } - - border-bottom: 1px dashed $color-white; - background-color: $color-gray-lightest; + .accordion-table__item__expanded { + th, td { + .icon-link { + font-weight: $font-normal; + font-size: $base-font-size; } + + border-bottom: 1px dashed $color-white; + background-color: $color-gray-lightest; } } } diff --git a/styles/components/_portfolio_layout.scss b/styles/components/_portfolio_layout.scss index 06b9f416..de9f3f92 100644 --- a/styles/components/_portfolio_layout.scss +++ b/styles/components/_portfolio_layout.scss @@ -326,9 +326,6 @@ } .application-list-item { - ul { - padding-left: 0; - } .block-list__footer { border-bottom: none; } diff --git a/styles/elements/_tables.scss b/styles/elements/_tables.scss index 7b8da846..61bb1f9d 100644 --- a/styles/elements/_tables.scss +++ b/styles/elements/_tables.scss @@ -4,7 +4,7 @@ * @source https://github.com/uswds/uswds/blob/develop/src/stylesheets/elements/_table.scss */ - table { +table { @include panel-margin; min-width: 100%; diff --git a/templates/components/toggle_list.html b/templates/components/toggle_list.html new file mode 100644 index 00000000..8bce7dc1 --- /dev/null +++ b/templates/components/toggle_list.html @@ -0,0 +1,43 @@ +{% from "components/icon.html" import Icon %} + +{% macro ToggleItem(action, item_type, length, icon) %} + + {{ action }} {{ item_type }} ({{ length }}){{ Icon(icon) }} + +{% endmacro %} + +{% macro ToggleList(item_name, item_type, length) %} +
  • + +
  • +{% endmacro %} diff --git a/templates/fragments/applications/environments.html b/templates/fragments/applications/environments.html index 6300cd51..8ae3083a 100644 --- a/templates/fragments/applications/environments.html +++ b/templates/fragments/applications/environments.html @@ -1,4 +1,5 @@ {% from "components/icon.html" import Icon %} +{% from "components/toggle_list.html" import ToggleList %}
    @@ -13,38 +14,24 @@
    - - - - - - +
    +
    + {{ "portfolios.applications.environments.name" | translate }} + {{ "portfolios.applications.environments.members" | translate }} +
    -
    - - - - - - - - - - - - - -
    {{ "portfolios.applications.environments.name" | translate }}{{ "portfolios.applications.environments.members" | translate }}
    -
    - -
    -
    -
    + + diff --git a/translations.yaml b/translations.yaml index cf3a3fdb..f5646265 100644 --- a/translations.yaml +++ b/translations.yaml @@ -31,6 +31,8 @@ flash: application: deleted: You have successfully deleted the {application_name} application. To view the retained activity log, visit the portfolio administration page. common: + hide: Hide + show: Show back: Back cancel: Cancel confirm: Confirm