From 155f228d8a07244a8c06a472ad1a566984702b86 Mon Sep 17 00:00:00 2001
From: Anton Sarukhanov <code@ant.sr>
Date: Wed, 4 May 2016 19:09:16 -0400
Subject: [PATCH] damnit jquery

---
 app.py                     | 3 +++
 templates/modal-embed.html | 1 +
 2 files changed, 4 insertions(+)

diff --git a/app.py b/app.py
index f2bb92d..c7de1e2 100644
--- a/app.py
+++ b/app.py
@@ -26,6 +26,7 @@ cache_control.init_app(app)
 
 # Flask Web Routes
 @app.route('/')
+@cache_for(hours=1)
 def map():
     # TODO: serve different agency depending on cookie (or special domain)
     agency_tag = app.config['AGENCIES'][0]
@@ -35,6 +36,7 @@ def map():
     return r
 
 @app.route('/e<mode>')
+@cache_for(hours=1)
 def map_embed(mode):
     # TODO: serve different agency depending on cookie (or special domain)
     agency_tag = app.config['AGENCIES'][0]
@@ -53,6 +55,7 @@ def ajax():
     query = request.args.get('query')
     agency_tag = app.config['AGENCIES'][0]
     agency = db.session.query(Agency).filter(Agency.tag==agency_tag).one()
+    @cache_for(hours=1)
     def modal(name):
         """ Serve contents of a modal popup """
         if not name.isalnum():
diff --git a/templates/modal-embed.html b/templates/modal-embed.html
index d588e59..b6641f2 100644
--- a/templates/modal-embed.html
+++ b/templates/modal-embed.html
@@ -70,6 +70,7 @@
     No guarantees are made about availability, performance, or suitability of this service for any purpose.
 </p>
 <script>
+    $.ajaxSetup({ cache: true });
     $.getScript('static/js/embed.js', function() {
         BusMap.Embed({
             baseUrl: "{{ url_for('map_embed', mode='', _external=True, _scheme='') }}",
-- 
GitLab