forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Munger: OPA Incidents, improved detail formatting (#99)
* Add data munging * Documentation & comments * Rearrange partials, force column ordering * Improve long-form text layout * Only show a cross-street if we have one * Give the incident detail page more padding on the bottom * Add ellipses to cut off text * Only show street name if we have one * Formatting * Add "OPA Case" prefix to incident title * Only show unique internal identifier if it exists * Add args to just recipes, start stack after fresh start * Allow incident descriptions to have HTML * Improve OPA incident description formatting, add officer name * Remove OPA Case prefix when matching links * Formatting! * Remove redundant "Incident" in report number title * Add "number of known incidents" to general information section * Allow spaces in incident names (but no other special characters) * Add known incident count to officer list * Have acceptance tests be a separate step This should make it easier to run the regular tests, then the functional ones in dev while not having to run the regular ones twice * Fix the functional tests based on new description cutoff * Remove conditional for known incidents
- Loading branch information
1 parent
07f25b6
commit eef7d5f
Showing
18 changed files
with
639 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ jobs: | |
- name: Run tests | ||
run: | | ||
just build | ||
just test | ||
just test-acceptance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 91 additions & 88 deletions
179
OpenOversight/app/templates/partials/incident_fields.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,96 @@ | ||
<table class='table table-hover table-responsive'> | ||
<tbody> | ||
<tr> | ||
<td><strong>Date</strong></td> | ||
<td>{{ incident.date.strftime('%b %d, %Y') }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>Time</strong></td> | ||
<td>{% if incident.time %}{{ incident.time.strftime('%l:%M %p') }}{% endif %}</td> | ||
</tr> | ||
{% if incident.report_number %} | ||
<tr> | ||
<td><strong>Report #</strong></td> | ||
<td>{{ incident.report_number }}</td> | ||
</tr> | ||
{% endif %} | ||
<tr> | ||
<td><strong>Department</strong></td> | ||
<td>{{ incident.department.name }}</td> | ||
</tr> | ||
{% if incident.officers %} | ||
<tr> | ||
<td><strong>Officers</strong></td> | ||
<td> | ||
{% for officer in incident.officers %} | ||
<a href="{{url_for('main.officer_profile', officer_id=officer.id)}}">{{ officer.full_name()|title }}</a>{% if not loop.last %}, {% endif %} | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% if detail and incident.license_plates %} | ||
<tr> | ||
<td><strong>License Plates</strong></td> | ||
<td> | ||
{% for plate in incident.license_plates %} | ||
{{ plate.state }} {{ plate.number }}{% if not loop.last %}<br/> {% endif %} | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% if not detail %} | ||
<tr> | ||
<td><strong>Description</strong></td> | ||
<td class="incident-description" id="incident-description_{{incident.id}}" data-incident='{{incident.id | tojson}}'> | ||
{{ incident.description }} | ||
</td> | ||
</tr> | ||
<tr id="description-overflow-row_{{ incident.id }}" > | ||
<td style="border-top: none"></td> | ||
<td style="border-top: none" id="description-overflow-cell_{{ incident.id }}"> | ||
<button id="description-overflow-button_{{ incident.id }}"> | ||
Click to read more | ||
</button> | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% with address=incident.address %} | ||
{% if address %} | ||
<tr> | ||
<td><strong>Address</strong></td> | ||
<td> | ||
{{ address.street_name }} | ||
{% if address.cross_street1 and address.cross_street2 %} | ||
<em>between</em> {{ address.cross_street1 }} <em>and</em> {{ address.cross_street2 }} | ||
{% else %} | ||
<em>near</em> {{ address.cross_street1 }} | ||
{% endif %} | ||
<br/> | ||
{{ address.city }}, {{ address.state }} {% if address.zipcode %} {{ address.zip_code }} {% endif %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% endwith %} | ||
{% if detail and current_user.is_administrator %} | ||
{% if incident.creator %} | ||
<tr> | ||
<td><strong>Creator</strong></td> | ||
<td><a href="{{ url_for('main.profile', username=incident.creator.username)}}">{{ incident.creator.username }}</a></td> | ||
</tr> | ||
{% endif %} | ||
{% if incident.last_updated_by %} | ||
<tr> | ||
<td><strong>Last Edited By</strong></td> | ||
<td><a href="{{ url_for('main.profile', username=incident.last_updated_by.username)}}">{{ incident.last_updated_by.username }}</a></td> | ||
</tr> | ||
{% endif %} | ||
{% endif %} | ||
</tbody> | ||
<tbody> | ||
<tr> | ||
<td><strong>Date</strong></td> | ||
<td>{{ incident.date.strftime('%b %d, %Y') }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>Time</strong></td> | ||
<td>{% if incident.time %}{{ incident.time.strftime('%l:%M %p') }}{% endif %}</td> | ||
</tr> | ||
{% if incident.report_number %} | ||
<tr> | ||
<td><strong>Report #</strong></td> | ||
<td>{{ incident.report_number }}</td> | ||
</tr> | ||
{% endif %} | ||
<tr> | ||
<td><strong>Department</strong></td> | ||
<td>{{ incident.department.name }}</td> | ||
</tr> | ||
{% if incident.officers %} | ||
<tr> | ||
<td><strong>Officers</strong></td> | ||
<td> | ||
{% for officer in incident.officers %} | ||
<a href="{{url_for('main.officer_profile', officer_id=officer.id)}}">{{ officer.full_name()|title }}</a>{% if not loop.last %}, {% endif %} | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% if detail and incident.license_plates %} | ||
<tr> | ||
<td><strong>License Plates</strong></td> | ||
<td> | ||
{% for plate in incident.license_plates %} | ||
{{ plate.state }} {{ plate.number }}{% if not loop.last %}<br/> {% endif %} | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% if not detail %} | ||
<tr> | ||
<td><strong>Description</strong></td> | ||
<td class="incident-description" id="incident-description_{{incident.id}}" data-incident='{{incident.id | tojson}}'> | ||
{% for paragraph in incident.description.split('\n') %} | ||
{{ paragraph | safe }}<br/> | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
<tr id="description-overflow-row_{{ incident.id }}" > | ||
<td style="border-top: none"></td> | ||
<td style="border-top: none" id="description-overflow-cell_{{ incident.id }}"> | ||
<button id="description-overflow-button_{{ incident.id }}"> | ||
Click to read more | ||
</button> | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% with address=incident.address %} | ||
{% if address %} | ||
<tr> | ||
<td><strong>Address</strong></td> | ||
<td> | ||
{% if address.street_name %} | ||
{{ address.street_name }}<br/> | ||
{% endif %} | ||
{% if address.cross_street1 and address.cross_street2 %} | ||
<em>between</em> {{ address.cross_street1 }} <em>and</em> {{ address.cross_street2 }} | ||
{% elif address.cross_street1 %} | ||
<em>near</em> {{ address.cross_street1 }} | ||
{% endif %} | ||
{{ address.city }}, {{ address.state }} {% if address.zipcode %} {{ address.zip_code }} {% endif %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% endwith %} | ||
{% if detail and current_user.is_administrator %} | ||
{% if incident.creator %} | ||
<tr> | ||
<td><strong>Creator</strong></td> | ||
<td><a href="{{ url_for('main.profile', username=incident.creator.username)}}">{{ incident.creator.username }}</a></td> | ||
</tr> | ||
{% endif %} | ||
{% if incident.last_updated_by %} | ||
<tr> | ||
<td><strong>Last Edited By</strong></td> | ||
<td><a href="{{ url_for('main.profile', username=incident.last_updated_by.username)}}">{{ incident.last_updated_by.username }}</a></td> | ||
</tr> | ||
{% endif %} | ||
{% endif %} | ||
</tbody> | ||
</table> | ||
|
||
{% block js_footer %} | ||
<script src="{{ url_for('static', filename='js/incidentDescription.js') }}"></script> | ||
<script src="{{ url_for('static', filename='js/incidentDescription.js') }}"></script> | ||
{% endblock %} |
Oops, something went wrong.