Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add formatting to warn/error messge banner #891

Merged
merged 3 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions webapp/apps/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from django.utils.safestring import mark_safe

DISTRIBUTION_TOOLTIP = "Key variables in the computation of tax liabilities."
DIFFERENCE_TOOLTIP = "Key variables that highlight the differences between two tax plans."
PAYROLL_TOOLTIP = " Include employee and employer payroll taxes in output."
Expand All @@ -22,3 +24,16 @@
DEFAULT_SOURCE = os.environ.get('DEFAULT_SOURCE', 'PUF')

TAXCALC_VERS_RESULTS_BACKWARDS_INCOMPATIBLE = "0.13.0"

OUT_OF_RANGE_ERROR_MSG = mark_safe("""
<div align="left">
Some fields have warnings or errors. Fields with warnings have message(s)
below them beginning with \'WARNING\', and fields with errors have
message(s) below them beginning with \'ERROR\'.
<br /> <br />
&emsp;- If the field has a warning message , then review the input to make sure
it is correct and click \'SUBMIT\' to run the model with these inputs.
<br />
&emsp;- If the field has an error message, then the parameter value must be
changed so that it is in a valid range.
</div>""")
10 changes: 2 additions & 8 deletions webapp/apps/taxbrain/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
REFORM_TOOLTIP, FISCAL_CURRENT_LAW, FISCAL_REFORM,
FISCAL_CHANGE, INCOME_BINS_TOOLTIP,
INCOME_DECILES_TOOLTIP, START_YEAR, START_YEARS,
DATA_SOURCES, DEFAULT_SOURCE)
DATA_SOURCES, DEFAULT_SOURCE, OUT_OF_RANGE_ERROR_MSG)

from ..formatters import get_version
from .param_formatters import (get_reform_from_file, get_reform_from_gui,
Expand All @@ -70,11 +70,6 @@

JOB_PROC_TIME_IN_SECONDS = 100

OUT_OF_RANGE_ERROR_MSG = ("Some fields have warnings or errors. Values "
"outside of suggested ranges will be accepted if "
"they only cause warnings and are submitted again "
"from this page. Warning messages begin with "
"'WARNING', and error messages begin with 'ERROR'.")

def log_ip(request):
"""
Expand Down Expand Up @@ -296,8 +291,7 @@ def submit_reform(request, user=None, json_reform_id=None):
"Please specify a tax-law change before submitting."
)
if taxcalc_warnings or taxcalc_errors:
msg = OUT_OF_RANGE_ERROR_MSG
personal_inputs.add_error(None, msg)
personal_inputs.add_error(None, OUT_OF_RANGE_ERROR_MSG)
if has_parse_errors:
msg = ("Some fields have unrecognized values. Enter comma "
"separated values for each input.")
Expand Down