Skip to content

Commit abc510d

Browse files
authored
Merge pull request #422 from datamade/donations-styles
Mobile styles for alder donations and compare alder page
2 parents 3b6a88b + 3bff57c commit abc510d

File tree

3 files changed

+69
-44
lines changed

3 files changed

+69
-44
lines changed

chicago/static/css/custom.css

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ h4 {
8282
border-radius: 0px;
8383
padding: 12px 10px 12px 10px;
8484
color: #3d8a8e;
85+
border-bottom: 8px solid #ffffff;
8586
}
8687
.nav-pills > li.active > a,
8788
.nav-pills > li.active > a:hover,
@@ -502,6 +503,10 @@ fieldset[disabled] .form-control {
502503
background-color: #fff;
503504
}
504505

506+
div.dataTables_wrapper div.dataTables_processing {
507+
background-color: #ffffffbb;
508+
}
509+
505510
@media only screen and (max-width: 768px) {
506511
/* Force table to not be like tables anymore */
507512
table.rows-and-columns,

chicago/templates/compare_council_members.html

+19-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1>Compare Alders</h1>
1515
</div>
1616
<div class="col-sm-12">
1717
<div class="table-responsive">
18-
<table class='table' id='council-members'>
18+
<table class='table rows-and-columns' id='council-members'>
1919
<thead>
2020
<tr>
2121
<th></th>
@@ -36,17 +36,31 @@ <h1>Compare Alders</h1>
3636
</div>
3737
</td>
3838
<td>
39+
<span class="visible-xs-block small-table-header">Alder</span>
3940
{{ person.link_html | safe }}
4041
</td>
41-
<td>{{ person.latest_council_membership.post.label }}</td>
42-
<td>{{ person.years_in_office }}</td>
4342
<td>
43+
<span class="visible-xs-block small-table-header">Ward</span>
44+
{{ person.latest_council_membership.post.label }}
45+
</td>
46+
<td>
47+
<span class="visible-xs-block small-table-header">Years in office</span>
48+
{{ person.years_in_office }}
49+
</td>
50+
<td>
51+
<span class="visible-xs-block small-table-header">Non-routine bills sponsored</span>
4452
<a href='/search/?q=&selected_facets=sponsorships_exact:{{person.name}}&selected_facets=topics_exact%3ANon-Routine'>
4553
{{ person.statistics.legislation_count }} bills
4654
</a>
4755
</td>
48-
<td>{{ person.statistics.attendance_percent }}</td>
49-
<td>{{ person.caucus }}</td>
56+
<td>
57+
<span class="visible-xs-block small-table-header">Attendance (this session)</span>
58+
{{ person.statistics.attendance_percent }}
59+
</td>
60+
<td>
61+
<span class="visible-xs-block small-table-header">Caucus</span>
62+
{{ person.caucus }}
63+
</td>
5064
</tr>
5165
{% endfor %}
5266
</tbody>

chicago/templates/person.html

+45-39
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ <h3>Campaign Donations</h3>
214214
<p><a href="https://illinoissunshine.org/candidates/{{ person.candidate_id }}/" target="_blank">Explore more campaign donations for <strong>{{person.name}}</strong> on Illinois Sunshine ></a></p>
215215

216216
<div class="table-responsive">
217-
<table id="campaign-donations" class="table">
217+
<table id="campaign-donations" class="table rows-and-columns">
218218
<thead>
219219
<tr>
220220
<th>Commitee Name</th>
@@ -228,19 +228,6 @@ <h3>Campaign Donations</h3>
228228
<th>Filing</th>
229229
</tr>
230230
</thead>
231-
<tfoot>
232-
<tr>
233-
<th>Commitee Name</th>
234-
<th>Received Date</th>
235-
<th>Amount</th>
236-
<th>Type</th>
237-
<th>Donor Name</th>
238-
<th>Occupation</th>
239-
<th>Employer</th>
240-
<th>City, State Zip</th>
241-
<th>Filing</th>
242-
</tr>
243-
</tfoot>
244231
</table>
245232
</div>
246233
{% endif %}
@@ -336,42 +323,61 @@ <h3>Tools</h3>
336323
{% if person.candidate_id %}
337324
<!-- Campaign Donations table -->
338325
<script type="text/javascript" language="javascript" class="init">
326+
function addHeader(keyName, formatter) {
327+
function addKeyedHeader(data, type, row, meta) {
328+
if (formatter){
329+
if (formatter.display) {
330+
data = formatter.display(data, type, row, meta)
331+
}
332+
else {
333+
data = formatter(data, type, row, meta)
334+
}
335+
}
336+
337+
return `<span class="visible-xs-block small-table-header">${keyName}</span>
338+
${data? data : "&nbsp;"}`
339+
}
340+
return addKeyedHeader
341+
}
342+
343+
function formatFilingLink(data, type, row, meta) {
344+
if (type === "display") {
345+
const encoded_doc_id = encodeURIComponent(row.filed_doc_id);
346+
let path = "";
347+
switch (row.doc_name) {
348+
case "A-1":
349+
path = `A1List.aspx?FiledDocID=${encoded_doc_id}&ContributionType=wOGh3QTPfKqV2YWjeRmjTeStk426RfVK&Archived=Gl5sibpnFrQ%3d`;
350+
break;
351+
case "Final":
352+
path = `D2Semiannual.aspx?id=${encoded_doc_id}`;
353+
break;
354+
default:
355+
path = `D2Quarterly.aspx?id=${encoded_doc_id}`;
356+
}
357+
return `<a href="https://www.elections.il.gov/CampaignDisclosure/${path}">${row.filed_doc_id}</a>`;
358+
}
359+
}
360+
339361
$(document).ready(function () {
340362

341363
$("#campaign-donations").DataTable({
342364
columns: [
343-
{ data: "committee_name" },
344-
{ data: "received_date" },
365+
{ data: "committee_name", render: addHeader("Committee Name") },
366+
{ data: "received_date", render: addHeader("Received Date") },
345367
{
346368
data: "amount",
347-
render: $.fn.dataTable.render.number(",", ".", 0, "$"),
369+
render: addHeader("Amount", $.fn.dataTable.render.number(",", ".", 0, "$")),
348370
className: "dt-body-right",
349371
},
350-
{ data: "type" },
351-
{ data: "name" },
352-
{ data: "occupation" },
353-
{ data: "employer" },
354-
{ data: "city_state_zip" },
372+
{ data: "type", render: addHeader("Type") },
373+
{ data: "name", render: addHeader("Name") },
374+
{ data: "occupation", render: addHeader("Occupation") },
375+
{ data: "employer", render: addHeader("Employer")},
376+
{ data: "city_state_zip", render: addHeader("City, State, Zip") },
355377
{
356378
data: "filed_doc_id",
357379
defaultContent: "",
358-
render: function (data, type, row, meta) {
359-
if (type === "display") {
360-
const encoded_doc_id = encodeURIComponent(row.filed_doc_id);
361-
let path = "";
362-
switch (row.doc_name) {
363-
case "A-1":
364-
path = `A1List.aspx?FiledDocID=${encoded_doc_id}&ContributionType=wOGh3QTPfKqV2YWjeRmjTeStk426RfVK&Archived=Gl5sibpnFrQ%3d`;
365-
break;
366-
case "Final":
367-
path = `D2Semiannual.aspx?id=${encoded_doc_id}`;
368-
break;
369-
default:
370-
path = `D2Quarterly.aspx?id=${encoded_doc_id}`;
371-
}
372-
return `<a href="https://www.elections.il.gov/CampaignDisclosure/${path}">${row.filed_doc_id}</a>`;
373-
}
374-
},
380+
render: addHeader("Filing", formatFilingLink)
375381
},
376382
],
377383
order: [[1, "desc"]],

0 commit comments

Comments
 (0)