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

WIP: Path to locality- & date-nested contributions data in committee.html #436

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _includes/candidate/finance.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h2 class="candidate__money-heading">Contributions</h2>
{% include money-bar.html label=label value=value color="green" max=money_bar_max %}
{% endfor %}
{% if candidate.filer_id and candidate.filer_id != "" %}
<p><a href="{{ site.baseurl }}/committee/{{ candidate.filer_id }}/">{% include
<p><a href="{{ site.baseurl }}/committee/{{ path }}/{{ candidate.filer_id }}">{% include
svg-icon.html icon="table-solid" %} See all contributions</a></p>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/supporting_opposing_committees.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{% if filer_id != "pending" and filer_id != "Pending" and filer_id != "PENDING" %}
<div class="committee__support_oppose">
<div>{{ name | smartify }}</div>
<a href="{{ site.baseurl }}/committee/{{ filer_id }}/">See all contributions to this committee</a>
<a href="{{ site.baseurl }}/committee/{{ path }}/{{ filer_id }}/">See all contributions to this committee</a>
{% if money > 0 %}
<div>{{ money | dollars }}</div>
{% include money-bar.html value=money color=include.color max=max %}
Expand Down
5 changes: 3 additions & 2 deletions _layouts/candidate.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% assign expenditures_opposing = finance.opposing_money.opposing_expenditures %}
{% assign expenditures_supporting = finance.supporting_money.total_supporting_independent %}
{% assign alert_text = "candidate" %}
{% capture path %}{{ locality.slug }}/{{ election_day }}{% endcapture %}

{% capture body %}
<div class="candidate">
Expand Down Expand Up @@ -85,7 +86,7 @@ <h2>{{ candidate.name | smartify }}</h2>
</section>
{% if finance.total_contributions > 0 or finance.total_expenditures > 0
or finance.supporting_money.total_supporting_independent > 0 or finance.opposing_money.opposing_expenditures > 0 %}
{% include candidate/finance.html candidate=candidate finance=finance %}
{% include candidate/finance.html candidate=candidate finance=finance path = path %}
{% else %}
<section class="l-section">
<div class="l-section__content">
Expand All @@ -101,7 +102,7 @@ <h2>{{ candidate.name | smartify }}</h2>
<div class="l-section__content">
<h2 class="candidate__money-heading">Other committees controlled by this candidate</h2>
{% for committee in other_committees %}
<p><a href="{{ site.baseurl }}/committee/{{ committee.filer_id }}/">{{ committee.name | smarity | escape }}</a></p>
<p><a href="{{ site.baseurl }}/committee/{{ path }}/{{ committee.filer_id }}/">{{ committee.name | smarity | escape }}</a></p>
{% endfor %}
</div>
</section>
Expand Down
8 changes: 6 additions & 2 deletions _layouts/committee.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
---
{% assign empty_array = '' | split: '' %}
{% assign committee = page %}
{% assign finance = site.data.committees[committee.filer_id] %}
{% capture ballot_path %}{{ committee.election }}.md{% endcapture %}
{% assign ballot_path = ballot_path | replace: "/.md", ".md" %}
{% assign ballot = site.elections | where: "path", ballot_path | first %}
{% assign locality = site.localities | where: "locality_id", ballot.locality | first %}
{% assign election_day = ballot.election | date: '%Y-%m-%d' %}
{% assign finance = site.data.committees[locality.slug][election_day][committee.filer_id] %}
{% assign contributions = finance.contributions | default: empty_array | sort: 'Tran_Amt1' | reverse %}


<header class="grid">
<h1 class="grid-col-12">{{ committee.name }}</h1>
</header>
Expand Down
3 changes: 2 additions & 1 deletion _layouts/referendum.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{% assign voters_edge_url = opposing.voters_edge_url | escape %}
{% assign locality = site.localities | where: 'locality_id', referendum.locality | first %}
{% assign alert_text = "ballot measure" %}
{% capture path %}{{ referendum.locality }}/{{ election_day }}{% endcapture %}


{% capture body %}
Expand Down Expand Up @@ -104,7 +105,7 @@ <h2>Spending breakdown by committee
</div>
<div class="l-section__content l-section__content--half">
<div class="subheading">In support of the measure</div>
{% include supporting_opposing_committees.html committees=supporting.supporting_organizations color="green" %}
{% include supporting_opposing_committees.html committees=supporting.supporting_organizations path=path color="green" %}
</div>

<!-- opposing contributions/expenditures column -->
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ gulp.task('pull:committees', function () {
});

gulp.task('pull:committees-finance', function () {
return gulp.src(dataDir('_data', 'committees', '*.json'))
return gulp.src(dataDir('_data', 'committees', '**', '*.json'))
.pipe(gulp.dest('_data/committees'));
});

Expand Down