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

Feature/3514 presidential map 1 #3547

Merged
merged 30 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ca53d16
WIP
rfultz Feb 10, 2020
84f2f60
Fix currency formatting
rfultz Feb 10, 2020
b636622
WIP
rfultz Feb 11, 2020
1cdb043
Getting the summary information in, sorting
rfultz Feb 12, 2020
3d39bb7
Summaries are working except the exports
rfultz Feb 12, 2020
1e5b85f
Summaries and downloads are in and working
rfultz Feb 12, 2020
6a297ef
Updating comments, removing abandoned code
rfultz Feb 12, 2020
a5b5c8b
Prepping for cash_on_hand and federal_funds
rfultz Feb 12, 2020
d9885f0
Renaming Cash on Hand to match the new PR
rfultz Feb 13, 2020
0d84ce9
dispatcher and handler for state click, breadcrumb state name
johnnyporkchops Feb 13, 2020
d5ebec4
fixed change-history disrepency(merge conflicts)
johnnyporkchops Feb 13, 2020
5acc407
candidate full name for breadcrumb
johnnyporkchops Feb 13, 2020
852d701
last breadcrumb not a link
johnnyporkchops Feb 13, 2020
52ea039
Removing styles copied from the live site
rfultz Feb 13, 2020
0a9e4d8
Started adding temp styles
rfultz Feb 13, 2020
1d46113
Remove listener-based data refresh, add placeholder for zoom reset
rfultz Feb 13, 2020
69a16ed
Add significant documentation and prune unused code
rfultz Feb 13, 2020
d3b6b68
Merge branch 'feature/3514-presidential-map-1' of github.com:fecgov/f…
rfultz Feb 13, 2020
bae4f4a
Swap to live instead of temp/local fetches
rfultz Feb 13, 2020
5896284
add you-might-also-like boxes at bottom
johnnyporkchops Feb 14, 2020
904bae2
open download area, scroll to view
johnnyporkchops Feb 14, 2020
69b30e2
scrollIntoView and slidedown for export area
johnnyporkchops Feb 14, 2020
9dd0e2d
downloads area styling, edits to scroll-to/show JS
johnnyporkchops Feb 17, 2020
a452782
WIP
rfultz Feb 18, 2020
a672e2a
Merge branch 'feature/3514-presidential-map-1' of github.com:fecgov/f…
rfultz Feb 18, 2020
87ed1c1
Add feature flag for presidential map
lbeaufort Feb 18, 2020
c6a5b90
Fix formatting, silence tests for map
lbeaufort Feb 19, 2020
1f1fc42
Clean up python logic, fix default year
lbeaufort Feb 19, 2020
8f473ab
Use constants.states_excl_territories for state list
lbeaufort Feb 19, 2020
dc436a4
Merge pull request #3556 from fecgov/feature/3514-presidential-map-1-…
lbeaufort Feb 19, 2020
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
86 changes: 86 additions & 0 deletions fec/data/templates/pres-finance-map.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{% extends 'layouts/main.jinja' %}
{# {% import 'macros/cycle-select.jinja' as select %} #}
{% import 'macros/page-header.jinja' as header %}

{% block title %}{{ title }}{% endblock %}

{% block css %}
<link rel="stylesheet" type="text/css" href="{{ asset_for_css('base.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ asset_for_css(page_specific_css) }}" />
{% endblock %}

{% block body %}
{{ header.header(title) }}
<section class="main">
<div class="container">
<header class="heading--main">
<h1>Section title?</h1>
</header>
</div>

<div class="container">
<div class="content__section--extra">
<div class="usa-width-one-whole">
{% include './widgets/pres-finance-map.jinja' %}
</div>
</div>
</div>
</section>
<div class="slab slab--neutral">
<div class="container">
<h2>You might also like</h2>
<div class="grid grid--4-wide">
<div class="grid__item">
<a href="/data/raising-bythenumbers/">
<aside class="card card--horizontal card--primary">
<div class="card__image__container">
<span class="card__icon i-receipt"><span class="u-visually-hidden">Icon of a piggy bank</span></span>
</div>
<div class="card__content">
Raising by the numberss
</div>
</aside>
</a>
</div>
<div class="grid__item">
<a href="/data/spending-bythenumbers/">
<aside class="card card--horizontal card--primary">
<div class="card__image__container">
<span class="card__icon i-disbursement"><span class="u-visually-hidden">Icon of representing spending</span></span>
</div>
<div class="card__content">
Spending by the numbers
</div>
</aside>
</a>
</div>
<div class="grid__item">
<a href="/data/elections">
<aside class="card card--horizontal card--primary">
<div class="card__image__container">
<span class="card__icon i-elections"><span class="u-visually-hidden">Icon representing elections</span></span>
</div>
<div class="card__content">
Find elections
</div>
</aside>
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

{% block scripts %}
{# Load jQuery from the CDN #}
<script src="https://code.jquery.com/jquery-3.4.1.js" crossorigin="anonymous"></script>
{# <script>
var context = {
election: {
cycle: '{{ cycle }}',
state: '{{ state or '' }}'
}
}; #}
</script>
{% endblock %}
147 changes: 147 additions & 0 deletions fec/data/templates/widgets/pres-finance-map.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{% import "macros/widgets.jinja" as widgets %}

<div id="gov-fec-pres-finance" class="pres-finance-map is-loading w-s" data-election_year="{{ election_year }}">
<div class="TODO-SEPARATE-TOP-SECTION">
<div id="filter-year" class="filters is-open">
<fieldset class="filter toggles js-filter js-table-switcher" style="border: none;">
<legend class="label t-inline-block">Candidates running in:</legend>
<!-- The radio buttons are added here by the code -->
</fieldset>
</div>
<div id="filter-map-type" class="filters is-open">
<fieldset class="filter toggles js-filter js-map-switcher" style="border: none;">
<legend class="label t-inline-block">View as:</legend>
<label class="toggle" for="switcher-map-type-bubbles">
<input type="radio" class="toggle" value="bubbles" id="switcher-map-type-bubbles" name="map-type-selector" aria-controls="bubbles-message" tabindex="0" checked><span class="button--alt">Bubbles</span>
</label>
<label class="toggle" for="switcher-map-type-gradient">
<input type="radio" class="toggle" value="gradient" id="switcher-map-type-gradient" name="map-type-selector" aria-controls="gradient-message" tabindex="0"><span class="button--alt">Gradient</span>
</label>
</fieldset>
</div>
<div class="TODO-buttons-holder">
<a class="button--cta button--export js-export-report-summary">Export report summary data</a>
<button class="button--alt js-methodology">Methodology</button>
</div>
</div>
<div class="candidate-list-wrapper">
<div class="table-scroller">
<div class="ps-scrollbar-y-rail"><div class="ps-scrollbar-y"></div></div>
<table id="pres-fin-map-candidates-table" class="data-table data-table--heading-borders data-table--entity u-margin--top" data-type="filings-{{ dataType }}" data-cycle="{{ election_year }}">
<thead>
<tr>
<th scope="col">Candidate</th>
<th scope="col" class="t-right-aligned">Total raised</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="text-align:center">loading&hellip;</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="map-wrapper">
<div id="breadcrumb-wrapper">
<nav class="breadcrumb-nav">
<a class="js-reset-app" href="" data-stateID="">Nationwide: All candidates</a><span> &raquo; </span><span></span>
</nav>
</div>
<div class="map-details">
<hgroup class="candidate-details">
<h1 class="js-cand-name-par-a">Candidate Name&nbsp;</h1>
<h2>&nbsp;</h2>
<h3>&nbsp;</h3>
</hgroup>
<div class="legend-container">
<span class="t-sans t-block">By state, total amount received</span>
<svg></svg>
</div>
</div>
<div class="election-map"></div>
</div>
<div class="right-column-wrapper">
<a class="button--cta button--export js-export-state-data" href="">Export ST raising data</a>
<ul id="financial-summaries" class="js-accordion" data-content-prefix="first">
<li>
<button class="accordion__button">Summary</button>
<h5 class="js-cand-name-par-a">NAME, CANDIDATE [PAR]</h5>
<div class="js-coverage-date">coverage date</div>
<div class="accordion__content">
<table class="simple-table">
<tbody>
<tr><td class="simple-table__cell">Receipts</td><td class="t-right-aligned t-mono" data-sum-id="net_receipts">$000</td></tr>
<tr><td>Disbursements</td><td class="t-right-aligned t-mono" data-sum-id="disbursements_less_offsets">$000</td></tr>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that styling work still needs to be done. But what can be done about longer words running into the dollar amount? This will happen more often, especially for the hundreds of millions and above figures. cc @JonellaCulmer

Screen Shot 2020-02-18 at 12 20 51 PM

<tr><td>Cash-on-hand</td><td class="t-right-aligned t-mono" data-sum-id="cash_on_hand_end">CHECK THIS $000</td></tr>
<tr><td>Debts owed by committee</td><td class="t-right-aligned t-mono" data-sum-id="debts_owed_by_committee">$000</td></tr>
</tbody>
</table>
</div>
</li>
<li>
<button class="accordion__button">Raising</button>
<div class="accordion__content">
<h5 class="js-cand-name-par-a">NAME, CANDIDATE [PAR]</h5>
<div class="js-coverage-date">coverage date</div>
<table>
<tbody>
<tr><td colspan="2">Contributions from</td></tr>
<tr><td>&nbsp;&nbsp;Individuals</td><td class="t-right-aligned t-mono" data-sum-id="individual_contributions_less_refunds">$000</td></tr>
<tr><td>&nbsp;&nbsp;PACs</td><td class="t-right-aligned t-mono" data-sum-id="pac_contributions_less_refunds">$000</td></tr>
<tr><td>&nbsp;&nbsp;Parties</td><td class="t-right-aligned t-mono" data-sum-id="party_contributions_less_refunds">$000</td></tr>
<tr><td>&nbsp;&nbsp;Candidates</td><td class="t-right-aligned t-mono" data-sum-id="candidate_contributions_less_repayments">$000</td></tr>
<tr><td>Federal funds</td><td class="t-right-aligned t-mono" data-sum-id="federal_funds">CHECK THIS $000</td></tr>
<tr><td>Transfers-in</td><td class="t-right-aligned t-mono" data-sum-id="transfers_to_other_authorized_committees">$000</td></tr>
<tr><td colspan="2">Contributions by size</td></tr>
<tr><td>$200 and under</td><td class="t-right-aligned t-mono" data-size_range_id="1">$000</td></tr>
<tr><td>$200.01-$499</td><td class="t-right-aligned t-mono" data-size_range_id="2">$000</td></tr>
<tr><td>$500-$999</td><td class="t-right-aligned t-mono" data-size_range_id="3">$000</td></tr>
<tr><td>$1000-$1,999</td><td class="t-right-aligned t-mono" data-size_range_id="4">$000</td></tr>
<tr><td>$2000 and over</td><td class="t-right-aligned t-mono" data-size_range_id="5">$000</td></tr>
</tbody>
</table>
<a href="" class="button--cta button--export js-export-raising-data">Export raising data</a>
</div>
</li>
<li>
<button class="accordion__button">Spending</button>
<div class="accordion__content">
<h5 class="js-cand-name-par-a">NAME, CANDIDATE [PAR]</h5>
<div class="js-coverage-date">coverage date</div>
<table>
<tbody>
<tr><td>Operating Expenditures</td><td class="t-right-aligned t-mono" data-sum-id="operating_expenditures">$000</td></tr>
<tr><td>Transfers to other authorized</td><td class="t-right-aligned t-mono" data-sum-id="transfers_to_other_authorized_committees">$000</td></tr>
<tr><td>Fundraising expenditures</td><td class="t-right-aligned t-mono" data-sum-id="fundraising_disbursements">$000</td></tr>
<tr><td>Exempt legal and accounting disbursements</td><td class="t-right-aligned t-mono" data-sum-id="exempt_legal_accounting_disbursement">$000</td></tr>
<tr><td colspan="2">Loan repayments</td></tr>
<tr><td>&nbsp;&nbsp;Candidate</td><td class="t-right-aligned t-mono" data-sum-id="repayments_loans_made_by_candidate">$000</td></tr>
<tr><td>&nbsp;&nbsp;Other</td><td class="t-right-aligned t-mono" data-sum-id="repayments_other_loans">$000</td></tr>
<tr><td>Other disbursements</td><td class="t-right-aligned t-mono" data-sum-id="other_disbursements">$000</td></tr>
<tr><td>Offsets to expenditures</td><td class="t-right-aligned t-mono" data-sum-id="offsets_to_operating_expenditures">$000</td></tr>
<tr><td>Contribution refunds</td><td class="t-right-aligned t-mono" data-sum-id="total_contribution_refunds">$000</td></tr>
</tbody>
</table>
<a href="" class="button--cta button--export js-export-spending-data">Export spending data</a>
</div>
</li>
</ul>
{# <a class="TODO-button--standard button--table js-browse-pres-finance-map" href="TODO-/data/receipts/individual-contributions">Browse TODO stuff</a> #}
</div>
<div id="downloads-wrapper">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to be able to close this so that it doesn't persist down the page?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to be able to close this so that it doesn't persist down the page?

Yes, there is a TODO in the comments for that

<header class="heading--main content__section--extra">
<h2>
Export raising data
</h2>
</header>
<div class="u-margin--bottom"><a href="" data-stateID="ALL">All states</a></div>
<div class=downloads-links>
{% for value in constants.states_excl_territories %}
<a href="" data-stateID="{{ value }}">{{ value }}</a>
{% endfor %}
<a href="" data-stateID="OTHER">Other</a>
</div>
</div>
</div>
<script defer src="{{ asset_for_js('widgets/pres-finance-map-box.js') }}" data-standalone="true"></script>
8 changes: 7 additions & 1 deletion fec/data/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from data import views
from data import views_datatables
from fec import settings

urlpatterns = [
url(r'^data/$', views.landing),
Expand All @@ -16,7 +17,6 @@
url(r'^data/raising-bythenumbers/$', views.raising),
url(r'^data/spending-bythenumbers/$', views.spending),


# Feedback Tool
url(r'^data/issue/reaction/$', views.reactionFeedback),
url(r'^data/issue/$', views.feedback),
Expand Down Expand Up @@ -47,3 +47,9 @@

url(r'^widgets/aggregate-totals/$', views.aggregate_totals),
]

if settings.FEATURES.get('presidential_map'):
# Presidential Campaign Finance Map
urlpatterns.append(
url(r'^data/candidates/president/presidential-map/$', views.pres_finance_map)
)
21 changes: 20 additions & 1 deletion fec/data/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ def elections(request, office, cycle, state=None, district=None):
},
)


def raising(request):
office = request.GET.get("office", "P")

Expand Down Expand Up @@ -681,6 +680,26 @@ def spending(request):
)



def pres_finance_map(request):

election_year = int(
request.GET.get("election_year", constants.DEFAULT_PRESIDENTIAL_YEAR)
)

return render(
request,
"pres-finance-map.jinja",
{
"parent": "data",
"title": "Presidential Campaign Finance Map",
"election_year": election_year,
"social_image_identifier": "data",
"page_specific_css": "/static/css/widgets/pres-finance-map.css",

},
)

def feedback(request):
if request.method == "POST":

Expand Down
1 change: 1 addition & 0 deletions fec/fec/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'use_tag_manager': bool(env.get_credential('FEC_FEATURE_USE_TAG_MANAGER', '')),
'contributionsbystate': bool(env.get_credential('FEC_FEATURE_CONTRIBUTIONS_BY_STATE', '')),
'ierawfilters': bool(env.get_credential('FEC_FEATURE_IE_RAW_FILTERS', '')),
'presidential_map': bool(env.get_credential('FEC_FEATURE_PRESIDENTIAL_MAP', '')),
}

ENVIRONMENTS = {
Expand Down
Loading