lucyparsons / OpenOversight

Police oversight and accountability through public data 👮
https://openoversight.com
GNU General Public License v3.0
240 stars 79 forks source link

Make url_for work with all endpoints #1070

Closed abandoned-prototype closed 1 year ago

abandoned-prototype commented 1 year ago

Description of Changes

Some of the ModelView based endpoints were missing a distinct name that could be used for url_for, and instead string concatenation was used (mostly in templates). I also moved some logic out of templates (e.g. calculation of total pay), added helper methods and made some other changed to reduce the code needed in the templates and improve readability a little bit.

I also added an anonymous user class that is useful to call things like .is_admin_or_coordinator(department) on any current_user object, without first making sure the user is not anonymous.

Tests and linting

michplunkett commented 1 year ago

I'll finish reviewing later today!