Skip to content

Commit

Permalink
Fix Marker attr lookups, if data is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Edan Schwartz committed May 13, 2014
1 parent 13c89fa commit 80d66d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/maps/markers/earthquakemarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ define([
* @protected
*/
EarthquakeMarker.prototype.lookupTitle_ = function() {
var mag = this.getDataAttribute('report.mag').toFixed(1);
var mag = this.getDataAttribute('report.mag');
return _.isUndefined(mag) ? 'Earthquake' :
'Magnitute ' + mag + ' Earthquake.';
'Magnitute ' + mag.toFixed(1) + ' Earthquake.';
};


Expand Down
4 changes: 4 additions & 0 deletions src/maps/markers/stormreportmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ define([
var type = this.getDataAttribute('report.type');
var name = this.getDataAttribute('report.name');

if (!type || !name) {
return this.get('title');
}

// Capitalize type
type = type.charAt(0).toUpperCase() + type.slice(1);

Expand Down

0 comments on commit 80d66d5

Please sign in to comment.