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 Coverage end date to Source reports #1701

Merged
merged 11 commits into from
Feb 22, 2018
43 changes: 23 additions & 20 deletions fec/fec/static/js/pages/elections.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ var d3 = require('d3');
var $ = require('jquery');
var _ = require('underscore');
var chroma = require('chroma-js');
var moment = require('moment');

var dropdown = require('../modules/dropdowns');
var coverageEndDate = require('../templates/coverageEndDate.hbs');

var fips = require('../modules/fips');
var maps = require('../modules/maps');
Expand Down Expand Up @@ -93,27 +95,28 @@ var electionColumns = [
columns.currencyColumn({data: 'total_disbursements', className: 'column--number', orderSequence: ['desc', 'asc']}),
columns.barCurrencyColumn({data: 'cash_on_hand_end_period', className: 'column--number'}),
{
render: function(data, type, row, meta) {
var dates = helpers.cycleDates(context.election.cycle);
var urlBase;
if (context.election.office === 'president') {
urlBase = ['reports', 'presidential'];
} else {
urlBase = ['reports','house-senate'];
}
var url = helpers.buildAppUrl(
urlBase,
{
committee_id: row.committee_ids,
cycle: context.election.cycle,
is_amended: 'false'
render: function(data, type, row, meta) {
var dates = helpers.cycleDates(context.election.cycle);
var urlBase;
if (context.election.office === 'president') {
urlBase = ['reports', 'presidential'];
} else {
urlBase = ['reports','house-senate'];
}
);
var anchor = document.createElement('a');
anchor.textContent = 'View';
anchor.setAttribute('href', url);
anchor.setAttribute('target', '_blank');
return anchor.outerHTML;
var url = helpers.buildAppUrl(
urlBase,
{
committee_id: row.committee_ids,
cycle: context.election.cycle,
is_amended: 'false'
}
);
var coverage_end_date = row.coverage_end_date ? moment(row.coverage_end_date).format('MM/DD/YYYY') : null;
return coverageEndDate({
coverage_end_date: coverage_end_date,
url: url
}
)
},
className: 'all',
orderable: false,
Expand Down
11 changes: 11 additions & 0 deletions fec/fec/static/js/templates/coverageEndDate.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{#if coverage_end_date }}
Coverage ending: {{ coverage_end_date }}
<br>
{{#if url}}
<a href="{{ url }}" target="_blank">View all</a>
{{/if}}
{{else}}
No processed data this period.
{{/if}}