Skip to content

Commit

Permalink
Merge branch 'release/public-20221122' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pkfec committed Nov 22, 2022
2 parents 778abe0 + c5e3162 commit 16831d1
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 92 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[run]
omit=*migrations*
source = .
70 changes: 35 additions & 35 deletions fec/data/urls.py
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
from django.conf.urls import url
from django.urls import re_path

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

urlpatterns = [
url(r'^data/$', views.landing, name='data-landing'),
url(r'^data/search/$', views.search),
url(r'^data/browse-data/$', views.browse_data, name='browse-data'),
url(r'^data/candidate/(?P<candidate_id>\w+)/$', views.candidate),
url(r'^data/committee/(?P<committee_id>\w+)/$', views.committee, name='committee-by-id'),
url(r'^data/elections/(?P<office>\w+)/(?P<state>\w+)/(?P<district>\w+)/(?P<cycle>[0-9]+)/$',
re_path(r'^data/$', views.landing, name='data-landing'),
re_path(r'^data/search/$', views.search),
re_path(r'^data/browse-data/$', views.browse_data, name='browse-data'),
re_path(r'^data/candidate/(?P<candidate_id>\w+)/$', views.candidate),
re_path(r'^data/committee/(?P<committee_id>\w+)/$', views.committee, name='committee-by-id'),
re_path(r'^data/elections/(?P<office>\w+)/(?P<state>\w+)/(?P<district>\w+)/(?P<cycle>[0-9]+)/$',
views.elections, name='elections-house'),
url(r'^data/elections/(?P<office>\w+)/(?P<state>\w+)/(?P<cycle>[0-9]+)/$', views.elections,
re_path(r'^data/elections/(?P<office>\w+)/(?P<state>\w+)/(?P<cycle>[0-9]+)/$', views.elections,
name='elections-senate'),
url(r'^data/elections/president/(?P<cycle>[0-9]+)/$', views.elections_president, name='elections-president'),
url(r'^data/elections/$', views.elections_lookup),
url(r'^data/raising-bythenumbers/$', views.raising),
url(r'^data/spending-bythenumbers/$', views.spending),
re_path(r'^data/elections/president/(?P<cycle>[0-9]+)/$', views.elections_president, name='elections-president'),
re_path(r'^data/elections/$', views.elections_lookup),
re_path(r'^data/raising-bythenumbers/$', views.raising),
re_path(r'^data/spending-bythenumbers/$', views.spending),

# Feedback Tool
url(r'^data/issue/reaction/$', views.reactionFeedback),
url(r'^data/issue/$', views.feedback),
re_path(r'^data/issue/reaction/$', views.reactionFeedback),
re_path(r'^data/issue/$', views.feedback),

# Datatables
url(r'^data/candidates/(?P<office>\w+)/$',
re_path(r'^data/candidates/(?P<office>\w+)/$',
views_datatables.candidates_office),
url(r'^data/candidates/$', views_datatables.candidates),
url(r'^data/committees/$', views_datatables.committees),
url(r'^data/communication-costs/$',
re_path(r'^data/candidates/$', views_datatables.candidates),
re_path(r'^data/committees/$', views_datatables.committees),
re_path(r'^data/communication-costs/$',
views_datatables.communication_costs),
url(r'^data/disbursements/$', views_datatables.disbursements),
url(r'^data/electioneering-communications/$',
re_path(r'^data/disbursements/$', views_datatables.disbursements),
re_path(r'^data/electioneering-communications/$',
views_datatables.electioneering_communications),
url(r'^data/filings/$', views_datatables.filings),
url(r'^data/independent-expenditures/$',
re_path(r'^data/filings/$', views_datatables.filings),
re_path(r'^data/independent-expenditures/$',
views_datatables.independent_expenditures),
url(r'^data/individual-contributions/$',
re_path(r'^data/individual-contributions/$',
views_datatables.individual_contributions),
url(r'^data/loans/$', views_datatables.loans),
url(r'^data/party-coordinated-expenditures/$',
re_path(r'^data/loans/$', views_datatables.loans),
re_path(r'^data/party-coordinated-expenditures/$',
views_datatables.party_coordinated_expenditures),
url(r'^data/receipts/individual-contributions/$',
re_path(r'^data/receipts/individual-contributions/$',
views_datatables.individual_contributions),
url(r'^data/receipts/$', views_datatables.receipts),
url(r'^data/reports/(?P<form_type>[\w-]+)/$', views_datatables.reports),
url(r'^legal-resources/enforcement/audit-search/$', views_datatables.audit),
re_path(r'^data/receipts/$', views_datatables.receipts),
re_path(r'^data/reports/(?P<form_type>[\w-]+)/$', views_datatables.reports),
re_path(r'^legal-resources/enforcement/audit-search/$', views_datatables.audit),

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

if settings.FEATURES.get('pac_party'):
urlpatterns.append(
url(r'^data/committees/pac-party/$', views_datatables.pac_party)
re_path(r'^data/committees/pac-party/$', views_datatables.pac_party)
)

if settings.FEATURES.get('debts'):
# Debts section TODO: debts dates
urlpatterns.append(
url(r'^data/debts/$', views_datatables.debts)
re_path(r'^data/debts/$', views_datatables.debts)
)

if settings.FEATURES.get('presidential_map'):
# Presidential candidate map
urlpatterns.append(
url(r'^data/candidates/president/presidential-map/$', views.pres_finance_map)
re_path(r'^data/candidates/president/presidential-map/$', views.pres_finance_map)
)

if settings.FEATURES.get('house_senate_overview'):
Expand All @@ -74,9 +74,9 @@
"""
urlpatterns.append(
url(r'^data/elections/(?P<office>\w+)/(?P<cycle>[0-9]+)/$', views.house_senate_overview,
re_path(r'^data/elections/(?P<office>\w+)/(?P<cycle>[0-9]+)/$', views.house_senate_overview,
name='elections-overview')
)
urlpatterns.append(
url(r'^data/elections/(?P<office>\w+)/$', views.house_senate_overview)
re_path(r'^data/elections/(?P<office>\w+)/$', views.house_senate_overview)
)
4 changes: 2 additions & 2 deletions fec/data/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def feedback(request):
title, body=body
)

return JsonResponse(issue.to_json(), status=201)
return JsonResponse(issue.as_dict(), status=201)
else:
raise Http404()

Expand Down Expand Up @@ -1095,6 +1095,6 @@ def reactionFeedback(request):
title, body=body
)

return JsonResponse(issue.to_json(), status=201)
return JsonResponse(issue.as_dict(), status=201)
else:
raise Http404()
4 changes: 1 addition & 3 deletions fec/fec/static/js/pages/reaction-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ReactionBox.prototype.handleReset = function() {

/**
* To implement a reaction box:
* Add a reaction-box jinja macro to a template
* Add a reaction-box jinja macro to a template (use quoted strings for the name and location positional arguments)
* Include a reference to this JS file in the parent template(preferably in extra JS block)
* (The below function will use the name/location values of any
* reaction box on the page to initiate it as a new ReactionBox())
Expand Down Expand Up @@ -158,5 +158,3 @@ $(document).ready(function() {
};
});
});

new ReactionBox();
42 changes: 21 additions & 21 deletions fec/fec/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, re_path
from django.conf import settings
from django.contrib import admin
from django.views.generic.base import TemplateView
Expand All @@ -14,33 +14,33 @@


urlpatterns = [
url(
re_path(
r'^documents/(\d+)/(.*)$',
home_views.serve_wagtail_doc,
name='wagtaildocs_serve',
),
url(r'^auth/', include(uaa_urls)),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^calendar/$', home_views.calendar),
url(r'^about/leadership-and-structure/commissioners/$', home_views.commissioners),
url(r'^documents/', include(wagtaildocs_urls)),
url(r'^help-candidates-and-committees/question-rad/$', home_views.contact_rad),
url(r'^help-candidates-and-committees/guides/$', home_views.guides),
url(r'^meetings/$', home_views.index_meetings, name="meetings_page"),
url(r'^search/$', search_views.search, name='search'),
url(r'^legal-resources/policy-and-other-guidance/guidance-documents/$', search_views.policy_guidance_search,
re_path(r'^auth/', include(uaa_urls)),
re_path(r'^admin/', include(wagtailadmin_urls)),
re_path(r'^calendar/$', home_views.calendar),
re_path(r'^about/leadership-and-structure/commissioners/$', home_views.commissioners),
re_path(r'^documents/', include(wagtaildocs_urls)),
re_path(r'^help-candidates-and-committees/question-rad/$', home_views.contact_rad),
re_path(r'^help-candidates-and-committees/guides/$', home_views.guides),
re_path(r'^meetings/$', home_views.index_meetings, name="meetings_page"),
re_path(r'^search/$', search_views.search, name='search'),
re_path(r'^legal-resources/policy-and-other-guidance/guidance-documents/$', search_views.policy_guidance_search,
name='policy-guidance-search'),
url(r'^updates/$', home_views.updates),
url(r'', include('data.urls')), # URLs for /data
url(r'', include('legal.urls')), # URLs for legal pages
url(r'', include(wagtail_urls)),
url(
re_path(r'^updates/$', home_views.updates),
re_path(r'', include('data.urls')), # URLs for /data
re_path(r'', include('legal.urls')), # URLs for legal pages
re_path(r'', include(wagtail_urls)),
re_path(
r'^code\.json$',
TemplateView.as_view(
template_name='code.json', content_type="application/json"
),
),
url(
re_path(
r'^data\.json$',
TemplateView.as_view(
template_name='data.json', content_type="application/json"
Expand All @@ -51,10 +51,10 @@

if settings.FEC_CMS_ENVIRONMENT != 'LOCAL':
# admin/login always must come before admin/, so place at beginning of list
urlpatterns.insert(0, url(r'^admin/login', uaa_views.login, name='login'))
urlpatterns.insert(0, re_path(r'^admin/login', uaa_views.login, name='login'))

if settings.FEC_CMS_ENVIRONMENT != 'PRODUCTION':
urlpatterns += url(
urlpatterns += re_path(
r'^robots\.txt$',
TemplateView.as_view(
template_name='robots.txt',
Expand All @@ -72,6 +72,6 @@
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# hide django-admin unless DEBUG=True
urlpatterns.insert(1, url(r'^django-admin/', admin.site.urls))
urlpatterns.insert(1, re_path(r'^django-admin/', admin.site.urls))

handler500 = 'home.views.error_500'
4 changes: 2 additions & 2 deletions fec/home/templates/home/latest_updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
<div class="results-info">
<span>Page {{ updates.number }} of {{ updates.paginator.num_pages }}</span>
{% if updates.has_previous %}
<a class="button button--standard button--previous" href="?page={{ updates.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&amp;{{ key }}={{ value }}{% endifnotequal %}{% endfor %}"><span class="u-visually-hidden">Previous</span></a>
<a class="button button--standard button--previous" href="?page={{ updates.previous_page_number }}{% for key,value in request.GET.items %}{% if key != 'page' %}&amp;{{ key }}={{ value }}{% endif %}{% endfor %}"><span class="u-visually-hidden">Previous</span></a>
{% endif %}
{% if updates.has_next %}
<a class="button button--standard button--next" href="?page={{ updates.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&amp;{{ key }}={{ value }}{% endifnotequal %}{% endfor %}"><span class="u-visually-hidden">Next</span></a>
<a class="button button--standard button--next" href="?page={{ updates.next_page_number }}{% for key,value in request.GET.items %}{% if key != 'page' %}&amp;{{ key }}={{ value }}{% endif %}{% endfor %}"><span class="u-visually-hidden">Next</span></a>
{% endif %}
</div>
{% else %}
Expand Down
30 changes: 15 additions & 15 deletions fec/legal/urls.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
from django.conf.urls import url
from django.urls import re_path
from django.conf import settings

from legal import views

urlpatterns = [
url(r'^data/legal/advisory-opinions/(?P<ao_no>[\w-]+)/$',
re_path(r'^data/legal/advisory-opinions/(?P<ao_no>[\w-]+)/$',
views.advisory_opinion_page),
url(r'^data/legal/advisory-opinions/$', views.advisory_opinions_landing),
url(r'^data/legal/matter-under-review/(?P<mur_no>[\w-]+)/$',
re_path(r'^data/legal/advisory-opinions/$', views.advisory_opinions_landing),
re_path(r'^data/legal/matter-under-review/(?P<mur_no>[\w-]+)/$',
views.mur_page),
url(r'^data/legal/alternative-dispute-resolution/(?P<adr_no>[\w-]+)/$',
re_path(r'^data/legal/alternative-dispute-resolution/(?P<adr_no>[\w-]+)/$',
views.adr_page),
url(r'^data/legal/administrative-fine/(?P<admin_fine_no>[\w-]+)/$',
re_path(r'^data/legal/administrative-fine/(?P<admin_fine_no>[\w-]+)/$',
views.admin_fine_page),
url(r'^data/legal/statutes/$', views.statutes_landing),
re_path(r'^data/legal/statutes/$', views.statutes_landing),
# Legal search results
url(r'^data/legal/search/$', views.legal_search),
re_path(r'^data/legal/search/$', views.legal_search),

url(r'^data/legal/search/advisory-opinions/$', views.legal_doc_search_ao),
url(r'^data/legal/search/enforcement/$', views.legal_doc_search_mur),
url(r'^data/legal/search/murs/$', views.legal_doc_search_mur),
url(r'^data/legal/search/regulations/$',
re_path(r'^data/legal/search/advisory-opinions/$', views.legal_doc_search_ao),
re_path(r'^data/legal/search/enforcement/$', views.legal_doc_search_mur),
re_path(r'^data/legal/search/murs/$', views.legal_doc_search_mur),
re_path(r'^data/legal/search/regulations/$',
views.legal_doc_search_regulations),
url(r'^data/legal/search/statutes/$', views.legal_doc_search_statutes),
re_path(r'^data/legal/search/statutes/$', views.legal_doc_search_statutes),
]

if settings.FEATURES['adrs']:
urlpatterns += url(
urlpatterns += re_path(
r'^data/legal/search/adrs/$', views.legal_doc_search_adr
),

if settings.FEATURES['afs']:
urlpatterns += url(
urlpatterns += re_path(
r'^data/legal/search/admin_fines/$', views.legal_doc_search_af
),
Loading

0 comments on commit 16831d1

Please sign in to comment.