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 #287 from 18F/feature/ie-only
Browse files Browse the repository at this point in the history
Feature/ie only
  • Loading branch information
Noah Manger committed Jun 30, 2015
2 parents a00869c + 965e84e commit 7d674f4
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 6 deletions.
4 changes: 3 additions & 1 deletion static/js/modules/glossary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

/* global require, module */
/* global require, module, document */

var $ = require('jquery');
var _ = require('underscore');
Expand All @@ -9,6 +9,8 @@ var List = require('list.js');

var terms = require('./terms');

var terms = require('./terms');

var glossaryLink = $('.term'),
glossaryIsOpen = false,
glossaryList,
Expand Down
1 change: 0 additions & 1 deletion static/js/modules/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ module.exports = {
committeeDataSet,
self = this;

// Creating a candidate suggestion engine
candidateEngine = this.createEngine('Candidates', this.getUrl('candidates'), function(response) {
return _.map(response.results, function(result) {
return filterCandidates(result);
Expand Down
6 changes: 4 additions & 2 deletions static/styles/_components/_charts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ $tooltip-border-color: #999;

.data--disbursement,
.data--disbursements,
.data--total_disbursements_period {
.data--total_disbursements_period,
.data--independent_contributions_period {
background: $data-disbursement;
.chart-series__bar__tooltip {
color: $data-disbursement;
}
}

.data--receipts,
.data--total_receipts_period {
.data--total_receipts_period,
.data--independent_expenditures_period {
background: $data-receipt;
.chart-series__bar__tooltip {
color: $data-receipt;
Expand Down
1 change: 0 additions & 1 deletion templates/candidates-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ <h5 class="entity__term__label">Elections</h5>

</div>


{% endblock %}

{% block scripts %}
Expand Down
10 changes: 9 additions & 1 deletion templates/committees-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ <h4>Most Recent Report:
{% include 'partials/committee-report-presidential.html' %}
{% elif committee_type == 'H' or committee_type == 'S' %}
{% include 'partials/committee-report-house-senate.html' %}
{% elif committee_type == 'I' %}
{% include 'partials/committee-report-ie-only.html' %}
{% else %}
{% include 'partials/committee-report-pac-party.html' %}
{% endif %}
Expand All @@ -170,13 +172,19 @@ <h3 class="section-header">Detailed Summary {{ reports.0.cycle-1 }} - {{ reports
{% include 'partials/committee-totals-presidential.html' %}
{% elif committee_type == 'H' or committee_type == 'S' %}
{% include 'partials/committee-totals-house-senate.html' %}
{% elif committee_type == 'I' %}
{% include 'partials/committee-totals-ie-only.html' %}
{% else %}
{% include 'partials/committee-totals-pac-party.html' %}
{% endif %}
</div>

<div class="row">
{% include 'partials/committee-charts.html' %}
{% if committee_type != 'I' %}
{% include 'partials/committee-charts.html' %}
{% else %}
{% include 'partials/ie-chart.html' %}
{% endif %}
{% endwith %}
</div>
{% else %}
Expand Down
6 changes: 6 additions & 0 deletions templates/partials/committee-report-ie-only.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% with committee=context() %}

{{ totals_table('Independent Contributions', reports.0.independent_contributions_period) }}
{{ totals_table('Independent Expenditures', reports.0.independent_expenditures_period) }}

{% endwith %}
6 changes: 6 additions & 0 deletions templates/partials/committee-totals-ie-only.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% with committee=context() %}

{{ totals_table('Independent Contributions', totals.0.total_independent_contributions) }}
{{ totals_table('Independent Expenditures', totals.0.total_independent_expenditures) }}

{% endwith %}
28 changes: 28 additions & 0 deletions templates/partials/ie-chart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% with %}
{% set reports = committee.reports %}
{% set totals = committee.totals %}
{% import 'macros/charts.html' as charts %}
{% import 'macros/null.html' as null %}
{% macro group_bar_tooltip(value, key) %}
<div class="chart-series__bar__tooltip">
<h5 class="chart-series__bar__tooltip__title">{{ key|replace('_', ' ')|title }}</h5>
<span class="chart-series__bar__tooltip__value">{{ null.null( value | currency )}}</span>
</div>
{% endmacro %}

{% if series_group_has_data(reports, ('independent_contributions_period', 'independent_expenditures_period')) %}
<div class="row">
<figure class="chart-container chart--r-d">
<div class="figure__title">
<h4>Independent Contributions and Independent Expenditures</h4>
<ul class="figure__key flat-list">
<li><span class="swatch data--receipts"></span> Total Independent Contributions</li>
<li><span class="swatch data--disbursements"></span> Total Independent Expenditures</li>
</ul>
</div>
{{ charts.chart_series_grouped(reports | reverse | list, ('independent_contributions_period', 'independent_expenditures_period'),
label_key=('coverage_start_date', 'coverage_end_date'), tooltip=group_bar_tooltip) }}
</figure>
</div>
{% endif %}
{% endwith %}

0 comments on commit 7d674f4

Please sign in to comment.