diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d7aad0ea..065ea8b67 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -90,10 +90,18 @@ repos: rev: v1.31.1 hooks: - id: djlint-reformat + pass_filenames: false args: - OpenOversight/app/templates - - --format-js - --format-css - --profile=jinja - --indent=2 - --quiet + - id: djlint + require_serial: true + pass_filenames: false + args: + - OpenOversight/app/templates + - --profile=jinja + - --use-gitignore + - --ignore=H006,T028,H031,H021,H013,H011 diff --git a/OpenOversight/app/main/views.py b/OpenOversight/app/main/views.py index 898e44713..bfc3ad75a 100644 --- a/OpenOversight/app/main/views.py +++ b/OpenOversight/app/main/views.py @@ -144,7 +144,7 @@ def browse(): @sitemap_include @main.route("/find", methods=[HTTPMethod.GET, HTTPMethod.POST]) def get_officer(): - jsloads = ["js/find_officer.js"] + js_loads = ["js/find_officer.js"] form = FindOfficerForm() departments_dict = [dept_choice.toCustomDict() for dept_choice in dept_choices()] @@ -180,7 +180,7 @@ def get_officer(): "input_find_officer.html", form=form, depts_dict=departments_dict, - jsloads=jsloads, + jsloads=js_loads, ) diff --git a/OpenOversight/app/templates/about.html b/OpenOversight/app/templates/about.html index 3ac8a0724..5318a92a0 100644 --- a/OpenOversight/app/templates/about.html +++ b/OpenOversight/app/templates/about.html @@ -20,7 +20,9 @@

- Try it + Try it
diff --git a/OpenOversight/app/templates/base.html b/OpenOversight/app/templates/base.html index ae9e206ff..00eef61e0 100644 --- a/OpenOversight/app/templates/base.html +++ b/OpenOversight/app/templates/base.html @@ -54,28 +54,28 @@ - OpenOversight + OpenOversight
diff --git a/OpenOversight/app/templates/browse.html b/OpenOversight/app/templates/browse.html index 17d9c3377..558640e1a 100644 --- a/OpenOversight/app/templates/browse.html +++ b/OpenOversight/app/templates/browse.html @@ -1,7 +1,11 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %} -{% block title %}Browse OpenOversight{% endblock %} -{% block meta %}{% endblock %} +{% block title %} + Browse OpenOversight +{% endblock title %} +{% block meta %} + +{% endblock meta %} {% block content %}
@@ -34,4 +38,4 @@

{% endfor %}

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/cop_face.html b/OpenOversight/app/templates/cop_face.html index ef30c059e..9aa226f23 100644 --- a/OpenOversight/app/templates/cop_face.html +++ b/OpenOversight/app/templates/cop_face.html @@ -45,156 +45,159 @@

{% if department %}
- {% else %} - - {% endif %} - {{ form.hidden_tag() }} -
- -
- {% for error in form.dataX.errors %} -

- [{{ error }}] -

- {% endfor %} -
- -
-
- {% for error in form.dataY.errors %} -

- [{{ error }}] -

- {% endfor %} -
- -
- {% for error in form.dataWidth.errors %} -

- [{{ error }}] -

- {% endfor %} -
- -
- {% for error in form.dataHeight.errors %} -

- [{{ error }}] -

- {% endfor %} -
- - -
- {% for error in form.officer_id.errors %} -

- [{{ error }}] -

- {% endfor %} - - {% for error in form.image_id.errors %} -

- Image: [{{ error }}] -

- {% endfor %} -

-

- -
-

-
-
- Explanation: click this button to associate the selected image with the entered OpenOversight ID. -
-
- Explanation: after matching the officer's name, badge number, or face to the roster, enter the officer's OpenOversight ID here. -
-
-

+ + {% else %} +
+
+ {% endif %} + {{ form.hidden_tag() }} +
+ +
+ {% for error in form.dataX.errors %} +

+ [{{ error }}] +

+ {% endfor %} +
+ +
+
+ {% for error in form.dataY.errors %} +

+ [{{ error }}] +

+ {% endfor %} +
+ +
+ {% for error in form.dataWidth.errors %} +

+ [{{ error }}] +

+ {% endfor %} +
+ +
+ {% for error in form.dataHeight.errors %} +

+ [{{ error }}] +

+ {% endfor %} +
+ +
-
- {% if department %} - - {% else %} - - {% endif %} - Next Photo + {% for error in form.officer_id.errors %} +

+ [{{ error }}] +

+ {% endfor %} + + {% for error in form.image_id.errors %} +

+ Image: [{{ error }}] +

+ {% endfor %} +

+

+
-
- - - All officers have been identified! - +

+
+
+ Explanation: click this button to associate the selected image with the entered OpenOversight ID.
-
-
-
-
-
- Explanation: click this button ONLY when all officers in it have been identified. This will remove it from the identification queue for ALL users. -
-
- Explanation: click this button if you would like to move on to the next image, without saving any info about this image. -
-
- Explanation: click this button to open the police roster. Use the roster to find the officer's OpenOversight ID. -
-
-
+
+ Explanation: after matching the officer's name, badge number, or face to the roster, enter the officer's OpenOversight ID here.
- {% elif current_user.is_disabled == True %} -

Your account has been disabled due to too many incorrect classifications/tags!

-

- Mail us to get it enabled again -

+
+
+
+ {% if department %} + Next Photo {% else %} -

All images have been tagged!

-

- {{ department.name }} -

-

- Submit officer pictures to us -

+ Next Photo {% endif %} - {% endif %} +
+ +
+
+
+
+
+ Explanation: click this button ONLY when all officers in it have been identified. This will remove it from the identification queue for ALL users. +
+
+ Explanation: click this button if you would like to move on to the next image, without saving any info about this image. +
+
+ Explanation: click this button to open the police roster. Use the roster to find the officer's OpenOversight ID. +
+
+
+
- {% endblock %} - {% block footer_class %}bottom-10{% endblock %} + {% elif current_user.is_disabled == True %} +

Your account has been disabled due to too many incorrect classifications/tags!

+

+ Mail us to get it enabled again +

+ {% else %} +

All images have been tagged!

+

+ {{ department.name }} +

+

+ Submit officer pictures to us +

+ {% endif %} + {% endif %} +
+{% endblock content %} +{% block footer_class %} + bottom-10 +{% endblock footer_class %} diff --git a/OpenOversight/app/templates/description_new.html b/OpenOversight/app/templates/description_new.html index b7abae46b..73efab899 100644 --- a/OpenOversight/app/templates/description_new.html +++ b/OpenOversight/app/templates/description_new.html @@ -1,4 +1,4 @@ -{% extends 'form.html' %} +{% extends "form.html" %} {% block page_title %} New Description {% endblock page_title %} diff --git a/OpenOversight/app/templates/edit_assignment.html b/OpenOversight/app/templates/edit_assignment.html index 30a9b0f0c..604054b82 100644 --- a/OpenOversight/app/templates/edit_assignment.html +++ b/OpenOversight/app/templates/edit_assignment.html @@ -1,6 +1,8 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %} -{% block title %}OpenOversight Admin - Edit Officer Assignment{% endblock %} +{% block title %} + OpenOversight Admin - Edit Officer Assignment +{% endblock title %} {% block content %}
-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/edit_officer.html b/OpenOversight/app/templates/edit_officer.html index 20c378564..52200e267 100644 --- a/OpenOversight/app/templates/edit_officer.html +++ b/OpenOversight/app/templates/edit_officer.html @@ -1,6 +1,8 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %} -{% block title %}OpenOversight Admin - Edit Officer{% endblock %} +{% block title %} + OpenOversight Admin - Edit Officer +{% endblock title %} {% block content %}
-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/form.html b/OpenOversight/app/templates/form.html index 7aca8880c..5ecc44936 100644 --- a/OpenOversight/app/templates/form.html +++ b/OpenOversight/app/templates/form.html @@ -8,7 +8,8 @@

{% endblock page_title %}

- {% block page_header %}{% endblock %} + {% block page_header %} + {% endblock page_header %}
{% block form %} {{ wtf.quick_form(form, action=post_url, method='post', button_map={'submit':'primary'}) }} diff --git a/OpenOversight/app/templates/image.html b/OpenOversight/app/templates/image.html index 87db1d660..d19e5979f 100644 --- a/OpenOversight/app/templates/image.html +++ b/OpenOversight/app/templates/image.html @@ -109,12 +109,11 @@

- -

- {% endif %} +

+ {% endif %} +

- -{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/incident_detail.html b/OpenOversight/app/templates/incident_detail.html index 41ec0b985..4c855611b 100644 --- a/OpenOversight/app/templates/incident_detail.html +++ b/OpenOversight/app/templates/incident_detail.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} +{% extends "base.html" %} {% set incident = obj %} {% block title %} {{ incident.department.name }} incident {% if incident.report_number %} {{ incident.report_number }}{% endif %} - OpenOversight - {% endblock %} + {% endblock title %} {% block meta %} @@ -31,9 +31,9 @@ }] } - {% endblock %} + {% endblock meta %} {% block content %} -
+
All Incidents {% if incident.department %}

@@ -47,10 +47,10 @@

{% if incident.report_number %}{{ incident.report_number }}{% endif %}

- +
{% with detail=True %} - {% include 'partials/incident_fields.html' %} + {% include "partials/incident_fields.html" %} {% endwith %}
@@ -60,19 +60,19 @@

Incident Description

{{ incident.description | markdown }}
- {% include 'partials/links_and_videos_row.html' %} + {% include "partials/links_and_videos_row.html" %} {% if current_user.is_administrator or (current_user.is_area_coordinator and current_user.ac_department_id == incident.department_id) %} {% endif %}
- {% endblock %} + {% endblock content %} diff --git a/OpenOversight/app/templates/incident_list.html b/OpenOversight/app/templates/incident_list.html index 2b6a5b7a5..eb29661fa 100644 --- a/OpenOversight/app/templates/incident_list.html +++ b/OpenOversight/app/templates/incident_list.html @@ -1,6 +1,8 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %} -{% block title %}View incidents - OpenOversight{% endblock %} +{% block title %} + View incidents - OpenOversight +{% endblock title %} {% block meta %} {% if incidents.items|length > 0 %} {% endif %} -{% endblock %} +{% endblock meta %} {% block content %}

Incidents

@@ -29,12 +31,12 @@
- {% with paginate=incidents, location='top' %} + {% with paginate=incidents, location="top" %} {% include "partials/paginate_nav.html" %} {% endwith %}
@@ -81,4 +83,4 @@

{% endblock content %} {% block js_footer %} -{% endblock %} +{% endblock js_footer %} diff --git a/OpenOversight/app/templates/incident_new.html b/OpenOversight/app/templates/incident_new.html index ed9a2048c..655a52311 100644 --- a/OpenOversight/app/templates/incident_new.html +++ b/OpenOversight/app/templates/incident_new.html @@ -1,4 +1,4 @@ -{% extends 'form.html' %} +{% extends "form.html" %} {% block page_title %} New Incident {% endblock page_title %} diff --git a/OpenOversight/app/templates/index.html b/OpenOversight/app/templates/index.html index f71c89ab0..64bab3c90 100644 --- a/OpenOversight/app/templates/index.html +++ b/OpenOversight/app/templates/index.html @@ -16,9 +16,11 @@

Search our public database for available information on officers in your city or to identify an officer with whom you have had a negative interaction.

- Browse officers + Browse officers
- Identify officers + Identify officers

@@ -64,4 +66,4 @@

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/input_find_officer.html b/OpenOversight/app/templates/input_find_officer.html index 899b4b5ba..a1a0821bb 100644 --- a/OpenOversight/app/templates/input_find_officer.html +++ b/OpenOversight/app/templates/input_find_officer.html @@ -1,9 +1,11 @@ {% extends "base.html" %} -{% block title %}Find an officer - OpenOversight{% endblock %} +{% block title %} + Find an officer - OpenOversight +{% endblock title %} {% block meta %} -{% endblock %} +{% endblock meta %} {% block content %}
@@ -259,4 +261,4 @@

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/label_data.html b/OpenOversight/app/templates/label_data.html index f79aef695..53a390def 100644 --- a/OpenOversight/app/templates/label_data.html +++ b/OpenOversight/app/templates/label_data.html @@ -1,10 +1,12 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %} -{% block title %}Volunteer with OpenOversight{% endblock %} +{% block title %} + Volunteer with OpenOversight +{% endblock title %} {% block meta %} -{% endblock %} +{% endblock meta %} {% block content %} {% if current_user and current_user.is_authenticated %}
@@ -23,7 +25,8 @@

New to working on images for OpenOversight? Or just need a refresher?

- + Leaderboard @@ -145,4 +148,4 @@

{% endif %} -{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/leaderboard.html b/OpenOversight/app/templates/leaderboard.html index 9a58d2099..889aedd44 100644 --- a/OpenOversight/app/templates/leaderboard.html +++ b/OpenOversight/app/templates/leaderboard.html @@ -33,4 +33,4 @@

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/link_new.html b/OpenOversight/app/templates/link_new.html index 66ce7dc47..f0c881016 100644 --- a/OpenOversight/app/templates/link_new.html +++ b/OpenOversight/app/templates/link_new.html @@ -1,4 +1,4 @@ -{% extends 'form.html' %} +{% extends "form.html" %} {% block page_title %} New Link {% endblock page_title %} diff --git a/OpenOversight/app/templates/list.html b/OpenOversight/app/templates/list.html index 2621baed9..aed88d2a3 100644 --- a/OpenOversight/app/templates/list.html +++ b/OpenOversight/app/templates/list.html @@ -1,12 +1,12 @@ {% extends "base.html" %} {% block content %}
- {% with paginate=objects, next_url=url_for(url, page=objects.next_num), prev_url=url_for(url, page=objects.prev_num), location='top' %} + {% with paginate=objects, next_url=url_for(url, page=objects.next_num), prev_url=url_for(url, page=objects.prev_num), location="top" %} {% include "partials/paginate_nav.html" %} {% endwith %} {% block list %} {% endblock list %} - {% with paginate=objects, next_url=url_for(url, page=objects.next_num), prev_url=url_for(url, page=objects.prev_num), location='bottom' %} + {% with paginate=objects, next_url=url_for(url, page=objects.next_num), prev_url=url_for(url, page=objects.prev_num), location="bottom" %} {% include "partials/paginate_nav.html" %} {% endwith %}
diff --git a/OpenOversight/app/templates/note_new.html b/OpenOversight/app/templates/note_new.html index 1e88a63bf..881c103f9 100644 --- a/OpenOversight/app/templates/note_new.html +++ b/OpenOversight/app/templates/note_new.html @@ -1,4 +1,4 @@ -{% extends 'form.html' %} +{% extends "form.html" %} {% block page_title %} New Note {% endblock page_title %} diff --git a/OpenOversight/app/templates/officer.html b/OpenOversight/app/templates/officer.html index 3853df8b6..65c8566fb 100644 --- a/OpenOversight/app/templates/officer.html +++ b/OpenOversight/app/templates/officer.html @@ -1,5 +1,7 @@ {% extends "base.html" %} -{% block title %}{{ officer.full_name() }} - OpenOversight{% endblock %} +{% block title %} + {{ officer.full_name() }} - OpenOversight +{% endblock title %} {% block meta %} {% set job_title = officer.job_title() if officer.job_title() and officer.job_title() != 'Not Sure' else 'Employee' %} {% set description = 'See detailed information about ' ~ officer.full_name() ~ ', ' ~ job_title ~ ' of the ' ~ officer.department.name ~ '.' %} @@ -34,41 +36,24 @@ "@context": "https://schema.org/", "@type": "Person", "name": "{{ officer.full_name() }}", - { - % - if officer.birth_year % - } + {% if officer.birth_year %} "birthDate": "{{ officer.birth_year }}", - { - % - endif % - } + {% endif %} "gender": "{{ officer.gender_label() }}", "jobTitle": "{{ job_title }}", "worksFor": { "@type": "Organization", "name": "{{ officer.department.name | title }}" }, - { - % - if officer.unique_internal_identifier % - } + {% if officer.unique_internal_identifier %} "identifier": "{{ officer.unique_internal_identifier }}", - { - % - endif % - } { - % - if officer.image_url % - } + {%endif %} + {% if officer.image_url %} "image": { "@type": "URL", "url": "{{ officer.image_url }}" }, - { - % - endif % - } + {% endif %} "url": { "@type": "URL", "url": "{{ url_for(request.endpoint, officer_id=officer.id, _external=True) }}" @@ -98,7 +83,7 @@ }] } -{% endblock %} +{% endblock meta %} {% block content %} {% set is_admin_or_coordinator = current_user.is_administrator or (current_user.is_area_coordinator and current_user.ac_department_id == officer.department_id) %}
@@ -136,7 +121,7 @@

{% endif %}

{# end col #} -
+
{% if officer.salaries or is_admin_or_coordinator %} {% include "partials/officer_salary.html" %} {% endif %} @@ -151,5 +136,4 @@

{# end row #}
- {# end container #} -{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/partials/incident_form.html b/OpenOversight/app/templates/partials/incident_form.html index 07643cae3..bf9300c9b 100644 --- a/OpenOversight/app/templates/partials/incident_form.html +++ b/OpenOversight/app/templates/partials/incident_form.html @@ -1,7 +1,7 @@ {% import "bootstrap/wtf.html" as wtf %}
{{ form.hidden_tag() }} -
{{ wtf.form_errors(form, hiddens="only") }}
+
{{ wtf.form_errors(form, hiddens="only") }}
{{ wtf.form_field(form.date_field, autofocus="autofocus") }} {{ wtf.form_field(form.time_field) }} {{ wtf.form_field(form.report_number) }} diff --git a/OpenOversight/app/templates/partials/links_and_videos_row.html b/OpenOversight/app/templates/partials/links_and_videos_row.html index 404484fb5..2ac622ca9 100644 --- a/OpenOversight/app/templates/partials/links_and_videos_row.html +++ b/OpenOversight/app/templates/partials/links_and_videos_row.html @@ -35,7 +35,7 @@

Links

New Link/Video {% endif %} - {% for type, list in obj.links|groupby("link_type") %} + {% for type, list in obj.links | groupby("link_type") %} {% if type == "video" %}

Videos

diff --git a/OpenOversight/app/templates/privacy.html b/OpenOversight/app/templates/privacy.html index 411b1ab85..73199763b 100644 --- a/OpenOversight/app/templates/privacy.html +++ b/OpenOversight/app/templates/privacy.html @@ -1,9 +1,11 @@ {% extends "base.html" %} -{% block title %}Privacy Policy - OpenOversight{% endblock %} +{% block title %} + Privacy Policy - OpenOversight +{% endblock title %} {% block meta %} -{% endblock %} +{% endblock meta %} {% block content %}
@@ -64,4 +66,4 @@

Future Changes

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/profile.html b/OpenOversight/app/templates/profile.html index f9506f594..23782b993 100644 --- a/OpenOversight/app/templates/profile.html +++ b/OpenOversight/app/templates/profile.html @@ -121,4 +121,4 @@

Officer Identifications

{% endif %} -{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/sort.html b/OpenOversight/app/templates/sort.html index e4f871352..4bf6dcac3 100644 --- a/OpenOversight/app/templates/sort.html +++ b/OpenOversight/app/templates/sort.html @@ -1,5 +1,7 @@ {% extends "base.html" %} -{% block head %}{% endblock %} +{% block head %} + +{% endblock head %} {% block js_footer %} -{% endblock %} +{% endblock js_footer %} {% block content %}
{% if current_user and current_user.is_authenticated %} @@ -92,4 +94,4 @@

All images have been classfied!

{% endif %} {% endif %}
-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/submit_image.html b/OpenOversight/app/templates/submit_image.html index f6eed910e..ef3d040b5 100644 --- a/OpenOversight/app/templates/submit_image.html +++ b/OpenOversight/app/templates/submit_image.html @@ -1,16 +1,18 @@ {% extends "base.html" %} {% import "bootstrap/wtf.html" as wtf %}¬ -{% block title %}Submit images to OpenOversight{% endblock %} +{% block title %} + Submit images to OpenOversight +{% endblock title %} {% block meta %} -{% endblock %} +{% endblock meta %} {% block head %} -{% endblock %} +{% endblock head %} {% block content %}

Drop images here to submit photos of officers:

-
+

Drag photographs from your computer directly into the box above or click the box to launch a finder window. @@ -84,4 +88,4 @@

High Security Submissions

We do not log unique identifying information of visitors to our website, but if you have privacy concerns in submitting photographs, we recommend using Tor Browser.

-{% endblock %} +{% endblock content %} diff --git a/OpenOversight/app/templates/submit_officer_image.html b/OpenOversight/app/templates/submit_officer_image.html index 634360354..67785418c 100644 --- a/OpenOversight/app/templates/submit_officer_image.html +++ b/OpenOversight/app/templates/submit_officer_image.html @@ -4,7 +4,7 @@ rel="stylesheet"> -{% endblock %} +{% endblock head %} {% block content %}
-{% endblock %} +{% endblock content %} {% block js_footer %} -{% endblock %} +{% endblock js_footer %} diff --git a/OpenOversight/app/templates/tag.html b/OpenOversight/app/templates/tag.html index e8b834a8d..59304812b 100644 --- a/OpenOversight/app/templates/tag.html +++ b/OpenOversight/app/templates/tag.html @@ -122,26 +122,25 @@

- -

-

- Set as featured tag Admin only -

-

-

- - -
-

- {% endif %} +

+

+ Set as featured tag Admin only +

+

+

+ + +
+

+ {% endif %} +
- -{% endif %} -{% endblock %} + {% endif %} +{% endblock content %} diff --git a/OpenOversight/app/templates/tutorial.html b/OpenOversight/app/templates/tutorial.html index 47ad5715a..673ef0920 100644 --- a/OpenOversight/app/templates/tutorial.html +++ b/OpenOversight/app/templates/tutorial.html @@ -1,9 +1,11 @@ {% extends "base.html" %} -{% block title %}Tutorial - OpenOversight{% endblock %} +{% block title %} + Tutorial - OpenOversight +{% endblock title %} {% block meta %} -{% endblock %} +{% endblock meta %} {% block content %}
@@ -113,4 +115,4 @@

Ready to get started?

-{% endblock %} +{% endblock content %}