New project validation #160064518
This commit is contained in:
dandds
2018-09-25 15:11:01 -04:00
committed by GitHub
3 changed files with 63 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{% from "components/icon.html" import Icon %}
{% macro Alert(title, message=None, actions=None, level='info', fragment=None) -%}
{% macro Alert(title, message=None, actions=None, level='info', fragment=None, vue_template=False) -%}
{% set role = 'alertdialog' if actions else 'alert' %}
{% set levels = {
'warning': {
@@ -25,7 +25,11 @@
{{ Icon(levels.get(level).get('icon'), classes='alert__icon icon--large') }}
<div class='alert__content'>
<h2 class='alert__title'>{{title}}</h2>
{% if vue_template %}
<h2 class='alert__title' v-html='title'></h2>
{% else %}
<h2 class='alert__title'>{{title}}</h2>
{% endif %}
{% if message %}
<div class='alert__message'>{{ message | safe }}</div>

View File

@@ -42,11 +42,11 @@
</div>
</div>
{% if form.environment_names.errors %}
{% for error in form.environment_names.errors %}
{{ Alert(error, level="error") }}
{% endfor %}
{% endif %}
<div> {# this extra div prevents this bug: https://www.pivotaltracker.com/story/show/160768940 #}
<div v-cloak v-for="title in errors" :key="title">
{{ Alert(message=None, level="error", vue_template=True) }}
</div>
</div>
<div class="block-list project-list-item">
<header class="block-list__header block-list__header--grow">
@@ -74,9 +74,8 @@
</div>
</div>
<div class="action-group">
<button v-on:click="openModal('{{ modalName }}')" class="usa-button usa-button-primary" tabindex="0" type="button">{{ action_text }} Project</button>
<button v-on:click="validateAndOpenModal('{{ modalName }}')" class="usa-button usa-button-primary" tabindex="0" type="button">{{ action_text }} Project</button>
</div>
</div>