diff --git a/OpenOversight/app/main/views.py b/OpenOversight/app/main/views.py index e79200847..71a0fbe76 100644 --- a/OpenOversight/app/main/views.py +++ b/OpenOversight/app/main/views.py @@ -160,7 +160,6 @@ def index(): state_count=state_count, department_count=department_count, departments_by_state=departments_by_state, - map_paths=current_app.config["MAP_DATA"], ) @@ -179,10 +178,19 @@ def set_session_timezone(): @main.route("/browse", methods=[HTTPMethod.GET]) def browse(): departments_by_state = Department.by_state() - return render_template( - "browse.html", - departments_by_state=departments_by_state, - map_paths=current_app.config["MAP_DATA"], + return render_template("browse.html", departments_by_state=departments_by_state) + + +@main.route("/map.svg", methods=[HTTPMethod.GET]) +def render_map(): + departments_by_state = Department.by_state() + return Response( + render_template( + "map.svg", + departments_by_state=departments_by_state, + map_paths=current_app.config["MAP_DATA"], + ), + mimetype="image/svg+xml", ) diff --git a/OpenOversight/app/templates/browse.html b/OpenOversight/app/templates/browse.html index 5266e545f..c6bb64b03 100644 --- a/OpenOversight/app/templates/browse.html +++ b/OpenOversight/app/templates/browse.html @@ -13,36 +13,7 @@
Use the map or list below to browse officers by department.
- + {% for state, departments in departments_by_state.items() %}