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 #876 from jmcarp/feature/update-election-columns
Browse files Browse the repository at this point in the history
Update URLs and columns in top-level election table.
  • Loading branch information
Noah Manger committed Oct 22, 2015
2 parents bef7368 + e732590 commit 9c57db6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
43 changes: 22 additions & 21 deletions static/js/pages/elections.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,29 @@ var electionColumns = [
}
},
{data: 'party_full', className: 'all'},
{
data: 'total_receipts',
orderSequence: ['desc', 'asc'],
render: tables.buildTotalLink(['receipts'], function(data, type, row, meta) {
return {
committee_id: row.committee_ids,
cycle: context.election.cycle
};
})
},
{
data: 'total_disbursements',
orderSequence: ['desc', 'asc'],
render: tables.buildTotalLink(['disbursements'], function(data, type, row, meta) {
return {
committee_id: row.committee_ids,
cycle: context.election.cycle
};
})
},
tables.currencyColumn({data: 'total_receipts', orderSequence: ['desc', 'asc']}),
tables.currencyColumn({data: 'total_disbursements', orderSequence: ['desc', 'asc']}),
tables.barCurrencyColumn({data: 'cash_on_hand_end_period'}),
tables.urlColumn('pdf_url', {data: 'document_description', className: 'all', orderable: false})
{
render: function(data, type, row, meta) {
var dates = helpers.cycleDates(context.election.cycle);
var url = helpers.buildAppUrl(
['filings'],
{
committee_id: row.committee_ids,
min_receipt_date: dates.min,
max_receipt_date: dates.max
}
);
var anchor = document.createElement('a');
anchor.textContent = 'View';
anchor.setAttribute('href', url);
anchor.setAttribute('target', '_blank');
return anchor.outerHTML;
},
className: 'all',
orderable: false,
}
];

function makeCommitteeColumn(opts, factory) {
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/candidate/financial-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h5 class="term t-data-header" data-term="Debt">Debt</h5>
committee_id=committee_ids,
cycle=cycle,
) }}">
View source forms
View source filings
</a>
{% endif %}
</p>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/elections/candidate-comparison-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3 class="results-info__title">All candidates in this election</h3>
<th role="col">Total receipts</th>
<th role="col">Total disbursements</th>
<th role="col">Cash on hand</th>
<th role="col">Most recent report</th>
<th role="col">Source filings</th>
</thead>
</table>
</div>
Expand Down

0 comments on commit 9c57db6

Please sign in to comment.