Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Commit

Permalink
Merge pull request #842 from jmcarp/feature/fix-election-urls
Browse files Browse the repository at this point in the history
Fix candidate URL on election page.
  • Loading branch information
Noah Manger committed Oct 15, 2015
2 parents bfa40e6 + ce774ac commit 62821af
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions static/js/pages/elections.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

var d3 = require('d3');
var $ = require('jquery');
var URI = require('URIjs');
var _ = require('underscore');
var chroma = require('chroma-js');

Expand Down Expand Up @@ -49,7 +48,7 @@ var electionColumns = [
render: function(data, type, row, meta) {
return tables.buildEntityLink(
data,
'/candidate/' + row.candidate_id,
helpers.buildAppUrl(['candidate', row.candidate_id]),
'candidate',
{isIncumbent: row.incumbent_challenge_full === 'Incumbent'}
);
Expand Down Expand Up @@ -154,7 +153,7 @@ function drawComparison(results) {
var $comparison = $('#comparison');
var context = {selected: results.slice(0, 10), options: results.slice(10)};
$comparison.prepend(comparisonTemplate(context));
new dropdown.Dropdown($comparison.find('.js-dropdown'));
new dropdown.Dropdown($comparison.find('.js-dropdown'));
$comparison.on('change', 'input[type="checkbox"]', refreshTables);
refreshTables();
}
Expand Down Expand Up @@ -187,25 +186,6 @@ function mapState(response, primary) {
});
}

function mapType(response, primary) {
var groups = {};
var typeMap = {
true: 'individual',
false: 'committee'
};
_.each(response.results, function(result) {
groups[result.candidate_id] = groups[result.candidate_id] || {};
groups[result.candidate_id][typeMap[result.individual]] = result.total;
});
return _.map(_.pairs(groups), function(pair) {
return _.extend(
pair[1], {
candidate_id: pair[0],
candidate_name: primary[pair[0]].candidate_name
});
});
}

var defaultOpts = {
destroy: true,
searching: false,
Expand Down

0 comments on commit 62821af

Please sign in to comment.