Skip to content

Commit

Permalink
Merge pull request #377 from cfpb/rram
Browse files Browse the repository at this point in the history
FLC is now RRAM
  • Loading branch information
sleitner committed Mar 8, 2016
2 parents 7346c9a + 772b5cd commit 1fb1263
Show file tree
Hide file tree
Showing 93 changed files with 2,850 additions and 2,565 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ Thumbs.db
frontend/node_modules
frontend/bower_components
frontend/dist
*.js.map
18 changes: 11 additions & 7 deletions frontend/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module.exports = function(grunt) {

'use strict';

var isCI = !!(process.env.JENKINS_URL || process.env.CONTINUOUS_INTEGRATION);

grunt.initConfig({

/**
Expand All @@ -27,7 +29,7 @@ module.exports = function(grunt) {
map: {
src: [
'frontend/src/less/leaflet.rrose.css',
'frontend/bower_components/leaflet-MiniMap/src/Control.MiniMap.css'
'frontend/bower_components/leaflet-minimap/dist/Control.MiniMap.min.css'
],
dest: 'frontend/dist/map/css/vendor.css',
}
Expand All @@ -45,7 +47,7 @@ module.exports = function(grunt) {
options: {
paths: ['frontend/src/less'],
compress: false,
sourceMap: true,
sourceMap: !isCI,
sourceMapFilename: 'frontend/dist/basestyle/css/mapusaurus_sourcemap.css.map',
sourceMapURL: '/static/basestyle/css/mapusaurus_sourcemap.css.map'
},
Expand Down Expand Up @@ -77,9 +79,11 @@ module.exports = function(grunt) {
*/
uglify: {
options: {
compress: true,
compress: {},
mangle: false,
beautify: true
beautify: true,
sourceMap: !isCI,
sourceMapIncludeSources: !isCI
},
vendor: {
src: [
Expand All @@ -99,10 +103,10 @@ module.exports = function(grunt) {
'frontend/bower_components/blockui/jquery.blockUI.js',
'frontend/src/js/leaflet/leaflet.js',
'frontend/bower_components/leaflet-hash/leaflet-hash.js',
'frontend/bower_components/leaflet-utfgrid/src/leaflet.utfgrid.js',
'frontend/bower_components/Leaflet.utfgrid/dist/leaflet.utfgrid.js',
'frontend/bower_components/leaflet-rrose/rrose-src.js',
'frontend/bower_components/numeral-js/min/numeral.min.js',
'frontend/bower_components/leaflet-MiniMap/src/Control.MiniMap.js'
'frontend/bower_components/leaflet-MiniMap/dist/Control.MiniMap.min.js'
],
dest: 'frontend/dist/map/js/map-vendor.min.js'
},
Expand Down Expand Up @@ -231,4 +235,4 @@ module.exports = function(grunt) {
grunt.registerTask('build-less', ['less', 'copy:django']);
grunt.registerTask('default', ['build']);

};
};
9 changes: 4 additions & 5 deletions frontend/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
"cf-pagination": "git+https://github.com/cfpb/cf-pagination#0.4.0",
"leaflet-rrose": "git+https://github.com/sephcoster/rrose.git#3775b4ca496f8dbe4f0fbcd441c99d1ad4daa3dd",
"leaflet-hash": "git+https://github.com/sephcoster/leaflet-hash.git",
"leaflet-MiniMap": "git+https://github.com/Norkart/Leaflet-MiniMap.git#",
"leaflet-utfGrid": "git+https://github.com/danzel/Leaflet.utfgrid.git#",
"leaflet-minimap": "3.0.0",
"topojson": "git+https://github.com/mbostock/topojson#1.6.18",
"numeral-js": "git+https://github.com/adamwdraper/Numeral-js.git#1.5.3",
"typeahead": "git+https://github.com/twitter/typeahead.js#0.10.5",
"blockui": "git+https://github.com/malsup/blockui#2.70",
"jquery.sparkline": "git+https://github.com/gwatts/jquery.sparkline#v2.1.2",
"tooltipsy": "git+https://github.com/briancray/tooltipsy",
"tablesorter": "git+https://github.com/Mottie/tablesorter"
"tablesorter": "git+https://github.com/Mottie/tablesorter",
"Leaflet.utfgrid": "danzel/Leaflet.utfgrid#18b7043c4a"
}

}
}
16 changes: 9 additions & 7 deletions frontend/src/js/asyncHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

var rawGeo, rawLar, rawMinority, rawData,
selectedYear = selectedYear || 2014,
isUIBlocked = false,
larVolume = [],
pctMinority = [],
Expand All @@ -17,7 +18,7 @@

// Create the appropriate URL path to return values
var endpoint = '/api/tractCentroids/',
params = {};
params = { year: selectedYear };

if( bounds && typeof bounds === 'object' ){
params.neLat = bounds.neLat;
Expand Down Expand Up @@ -60,8 +61,8 @@
// Return a promise.
function getTractData( actionTakenVal, bounds, geoType ){
$('#bubbles_loading').show();
var endpoint = '/api/hmda',
params = { year: 2013,
var endpoint = '/api/hmda/',
params = { year: selectedYear,
'lh': false,
'peers': false,
'geo_type': geoType };
Expand Down Expand Up @@ -131,8 +132,8 @@

// Get the Metro Areas currently shown on the map (used to check if we need to load new data on move)
function getMsasInBounds(){
var endpoint = '/api/msas',
params = {},
var endpoint = '/api/msas/',
params = { year: selectedYear },
bounds = getBoundParams();

params.neLat = bounds.neLat;
Expand Down Expand Up @@ -160,7 +161,8 @@

// Create the appropriate URL path to return values
var endpoint = '/api/branchLocations/',
params = { neLat: bounds.neLat,
params = { year: selectedYear,
neLat: bounds.neLat,
neLon: bounds.neLon,
swLat: bounds.swLat,
swLon: bounds.swLon };
Expand All @@ -184,4 +186,4 @@

/*
END GET DATA SECTION
*/
*/
6 changes: 3 additions & 3 deletions frontend/src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
var peerList = $('.peer-link');
$.each(peerList, function(i, val){
var instid = $(val).data('instid');
var href = '/map/?metro=' + urlParam('metro') + '&lender=' + instid + window.location.hash.replace('&peers=true', '');
var href = '/map/?metro=' + urlParam('metro') + '&lender=' + instid + '&year=' + selectedYear + window.location.hash.replace('&peers=true', '');
$(val).attr('href', href);
});
}
Expand All @@ -321,7 +321,7 @@
function updateCensusLink(){
var actions = getHashParams()
var actionVar = getActionTaken( actions.action.values );
$('#downloadCensus').attr('href', '/census/race_summary_csv/?metro=' + urlParam('metro') + '&lender=' + urlParam('lender') + '&action_taken=' + actionVar );
$('#downloadCensus').attr('href', '/census/race_summary_csv/?metro=' + urlParam('metro') + '&lender=' + urlParam('lender') + '&action_taken=' + actionVar + '&year=' + selectedYear );
}

// Parameter helper function that filters the query according to dropdown values
Expand Down Expand Up @@ -398,4 +398,4 @@
}
/*
END UTILITY FUNCTIONS
*/
*/
6 changes: 3 additions & 3 deletions frontend/src/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ $(document).ready(function(){
var keyHide = $('.hide-key');
var keyShow = $('.show-key');
var keyContents = $('.key-contents');
var minorityKeyContents = $('.minority-key');
keyHide.on('click', function(e){
keyShow.removeClass('hidden');
keyContents.addClass('hidden');
minorityKeyContents.addClass('hidden');
keyHide.addClass('hidden');
});
keyShow.on('click', function(e){
keyHide.removeClass('hidden');
keyContents.removeClass('hidden');
minorityKeyContents.removeClass('hidden');
keyShow.addClass('hidden');
});

Expand Down Expand Up @@ -166,9 +169,6 @@ $(document).ready(function(){
}
});

map.on('moveend', function(){
moveEndAction[geoQueryType]();
});
map.on('zoomend', function(){
buildKeyCircles();
});
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/js/metro-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

$(document).ready(function() {
var searchNameBox = $('#geoid'),
year = $('#year').val(),
msaField = $('#msa-field'),
search = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/shapes/search/?auto=1&q=%QUERY',
url: '/shapes/search/?auto=1&q=%QUERY&year=' + year,
filter: function(resp) {
return resp.geos;
}
Expand Down
57 changes: 38 additions & 19 deletions frontend/src/js/search.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
'use strict';

$(document).ready(function() {
var search = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/institutions/search/?auto=1&q=%QUERY',
filter: function(resp) { return resp.institutions;}
}
}),

var $typeahead = $('#institutions_search input.search_institution');
var $year = $('#search-year');
var selectedYear = getYear();

searchNameBox = $('#search_name');
search.initialize();
initTypeahead();

searchNameBox.typeahead({
highlight: true
}, {
displayKey: 'formatted_name',
source: search.ttAdapter()
$year.on('change', function() {
selectedYear = getYear();
$typeahead.typeahead('destroy');
$typeahead.val('');
initTypeahead();
});

function getYear() {
return parseInt($year.val());
}

function initTypeahead() {
var search = new Bloodhound({
initialize: false,
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/institutions/search/?auto=1&year=' + selectedYear + '&q=%QUERY',
filter: function(resp) { return resp.institutions; }
}
});

search.initialize();

$('#institutions_search').find('#search_year').val(selectedYear);
$typeahead.typeahead({
highlight: true
}, {
displayKey: 'formatted_name',
source: search.ttAdapter()
});
}

});
5 changes: 2 additions & 3 deletions frontend/src/less/mapusaurus/map.less
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ select {
.key-contents {
.webfont-regular();
width: 230px;
border: solid 1px #000;
border-bottom: none;
border-right: solid 1px #000;
border-left: solid 1px #000;
background: #fff;
padding: 5px;

Expand Down Expand Up @@ -592,7 +592,6 @@ select {
color: @pacific;
background-color: @gray-20;
border: 1px solid @black;
border-bottom: none;
padding: 5px;
}

Expand Down
7 changes: 6 additions & 1 deletion frontend/src/less/mapusaurus/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@

}

#search-year {
font-size: .9em;
background: transparent;
}

}

/* Search input form (gray bar at top of page ) */
Expand Down Expand Up @@ -507,4 +512,4 @@

}

}
}
Loading

0 comments on commit 1fb1263

Please sign in to comment.