Skip to content

Commit

Permalink
Filter receipts by occupation.
Browse files Browse the repository at this point in the history
[Resolves fecgov#407]
  • Loading branch information
jmcarp committed Aug 4, 2015
1 parent 1ba4f1f commit 7132441
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion static/js/pages/receipts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var columns = [
data: 'contributor',
orderable: false,
className: 'all',
width: '30%',
width: '20%',
render: function(data, type, row, meta) {
if (data) {
return tables.buildEntityLink(data.name, '/committee/' + data.committee_id, 'committee');
Expand All @@ -24,6 +24,7 @@ var columns = [
},
{data: 'contributor_state', orderable: false, className: 'min-desktop hide-panel'},
{data: 'contributor_employer', orderable: false, className: 'min-desktop hide-panel'},
{data: 'contributor_occupation', orderable: false, className: 'min-desktop hide-panel'},
tables.currencyColumn({data: 'contributor_receipt_amount', className: 'min-tablet'}),
tables.dateColumn({data: 'contributor_receipt_date', className: 'min-tablet'}),
{
Expand Down
1 change: 1 addition & 0 deletions templates/partials/receipts-filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h5 class="js-accordion_header accordion__header">Contributor Information <a hre
{{ text.field('contributor_city', 'City') }}
{{ states.field('contributor_state') }}
{{ text.field('contributor_employer', 'Employer') }}
{{ text.field('contributor_occupation', 'Occupation') }}
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions templates/partials/receipts-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<th scope="col">Contributor Name</th>
<th scope="col">State</th>
<th scope="col">Employer</th>
<th scope="col">Occupation</th>
<th scope="col">Amount</th>
<th scope="col">Date</th>
<th scope="col">Recipient</th>
Expand Down
16 changes: 8 additions & 8 deletions tests/selenium/test_itemized.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def check_sort(driver, index, parser, reverse=False):
table = driver.find_element_by_css_selector('table#results')
values = [
parser(row.find_elements_by_tag_name('td')[index].text)
for row in table.find_elements_by_tag_name('tr')[1:]
for row in table.find_elements_by_css_selector('tr[role="row"]')[1:]
]
assert values == sorted(values, reverse=reverse)

Expand All @@ -34,15 +34,15 @@ def test_sort(self):
self.driver.get(self.url)

# Sort on date
check_sort(self.driver, 4, parse_date, reverse=True)
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_date, reverse=False)
check_sort(self.driver, 5, parse_date, reverse=True)
toggle_sort(self.driver, 5)
check_sort(self.driver, 5, parse_date, reverse=False)

# Sort on amount
toggle_sort(self.driver, 3)
check_sort(self.driver, 3, parse_amount, reverse=False)
toggle_sort(self.driver, 3)
check_sort(self.driver, 3, parse_amount, reverse=True)
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_amount, reverse=False)
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_amount, reverse=True)


class TestDisbursements(SearchPageTestCase):
Expand Down

0 comments on commit 7132441

Please sign in to comment.