Skip to content

Commit

Permalink
Merge pull request #257 from cfpb/no-program
Browse files Browse the repository at this point in the history
Form-level error for bad Program ID
  • Loading branch information
marteki committed Aug 5, 2016
2 parents 5a96c45 + ee3b1bd commit 371bcd0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.
- Updates loan origination fee displays to work with corrected constants
- Fix alignment issues in debt summary
- Update our national statistics from scorecard project
- Add form-level error for bad program ID
- Update national stats to deliver generic stats at /api/national-stats/
- simplify warnings for ID problems

Expand Down
20 changes: 19 additions & 1 deletion paying_for_college/templates/worksheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,32 @@ <h1 class="hero_heading">
<section class="verify step content_wrapper">
<div class="content_main">
<div class="cf-notification cf-notification__error verify_content"
data-error-block="badSchoolData">
data-missing-data-error="noSchool">
<span class="cf-notification_icon cf-notification_icon__error cf-icon cf-icon-delete-round" role="alert"></span>
<div class="cf-notification_text">
<p>The information your school provided is missing the school ID, which is vital information for this tool to work. Please contact your school and ask them to ensure they are sending us the right school ID and it's in the correct format.</p>

<p>Once your school provides you with an updated URL link, you will be able to return here so you can continue reviewing the information in the tool.</p>
</div>
</div>
<div class="cf-notification cf-notification__error verify_content"
data-missing-data-error="noProgram">
<span class="cf-notification_icon cf-notification_icon__error cf-icon cf-icon-delete-round" role="alert"></span>
<div class="cf-notification_text">
<p>The information your school provided is missing the program ID, which is vital information for this tool to work. Please contact your school and ask them to ensure they are sending us the right program ID and it's in the correct format.</p>

<p>Once your school provides you with an updated URL link, you will be able to return here so you can continue reviewing the information in the tool.</p>
</div>
</div>
<div class="cf-notification cf-notification__error verify_content"
data-missing-data-error="noOffer">
<span class="cf-notification_icon cf-notification_icon__error cf-icon cf-icon-delete-round" role="alert"></span>
<div class="cf-notification_text">
<p>The information your school provided is missing the offer ID, which is vital information for this tool to work. Please contact your school and ask them to ensure they are sending us the right offer ID and it's in the correct format.</p>

<p>Once your school provides you with an updated URL link, you will be able to return here so you can continue reviewing the information in the tool.</p>
</div>
</div>
<div class="verify_wrapper">
<div class="verify_content" data-warning="{{warning}}">
<h2 class="verify_prompt">
Expand Down
2 changes: 1 addition & 1 deletion src/disclosures/css/disclosures.less
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
font-size: 1em;
}

[data-error-block] {
[data-missing-data-error] {
display: none;
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/disclosures/js/dispatchers/get-api-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ var getApiValues = {
success: function( resp ) {
return resp;
},
// TODO: the user should be notified of errors
error: function( req, status, err ) {
// console.log( 'API: fetchSchoolData', status, err );
financialView.badSchoolData();
financialView.missingData( 'school' );
}
} );

Expand All @@ -80,9 +78,8 @@ var getApiValues = {
success: function( resp ) {
return resp;
},
// TODO: the user should be notified of errors
error: function( req, status, err ) {
console.log( 'API: fetchProgramData', status, err );
financialView.missingData( 'program' );
}
} );

Expand Down Expand Up @@ -125,6 +122,12 @@ var getApiValues = {
},

initialData: function() {
// If there's a [data-warning], display error
var warning = $( '[data-warning]' ).attr( 'data-warning' );
if ( warning !== '' ) {
financialView.missingData( warning );
return $.Deferred;
}
return $.when( this.constants(), this.expenses() );
}

Expand Down
7 changes: 5 additions & 2 deletions src/disclosures/js/views/financial-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,13 @@ var financialView = {

/**
* Update view for bad school requests
* @param {string} dataType - type of missing data, 'school' or 'program'
*/
badSchoolData: function() {
missingData: function( dataType ) {
$( '.verify_wrapper' ).hide();
$( '[data-error-block="badSchoolData"]').show();
if ( $( '[data-missing-data-error]:visible' ).length === 0 ) {
$( '[data-missing-data-error="' + dataType + '"]').show();
}
}
};

Expand Down
6 changes: 2 additions & 4 deletions src/disclosures/js/views/metric-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ var metricView = {
},

settlementStatus: false,
$gradGraphContent: $( '.content-grad-program' ),
$defaultGraphContent: $( '.content-default-program' ),

/**
* Initiates the object
Expand Down Expand Up @@ -399,10 +397,10 @@ var metricView = {

$ele.text( text );
if ( metricKey === 'gradRate' && source === 'school' ) {
this.$gradGraphContent.hide();
$( '.content-grad-program' ).hide();
}
if ( metricKey === 'defaultRate' && source === 'school' ) {
this.$defaultGraphContent.text( source );
$( '.content-default-program' ).text( source );
}
},

Expand Down

0 comments on commit 371bcd0

Please sign in to comment.