aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grumpy/templates/_util.html3
-rw-r--r--grumpy/templates/dashboard.html4
-rw-r--r--grumpy/templates/layout.html1
3 files changed, 6 insertions, 2 deletions
diff --git a/grumpy/templates/_util.html b/grumpy/templates/_util.html
new file mode 100644
index 0000000..5e6ee0b
--- /dev/null
+++ b/grumpy/templates/_util.html
@@ -0,0 +1,3 @@
+{% macro load_js(filename) -%}
+<script type="text/javascript" language="javascript" src="{{ url_for('static', filename='js/' + filename +'.js' )}}"></script>
+{% endmacro -%}
diff --git a/grumpy/templates/dashboard.html b/grumpy/templates/dashboard.html
index 59e05f9..49d539f 100644
--- a/grumpy/templates/dashboard.html
+++ b/grumpy/templates/dashboard.html
@@ -1,8 +1,8 @@
{% extends "layout.html" %}
{% block title %}Your Dashboard{% endblock %}
{% block script %}
-<script type="text/javascript" language="javascript" src="{{ url_for('static', filename='js/jquery.min.js' )}}"></script>
-<script type="text/javascript" language="javascript" src="{{ url_for('static', filename='js/jquery.dataTables.min.js' )}}"></script>
+{{ importer.load_js('jquery.min') }}
+{{ importer.load_js('jquery.dataTables.min') }}
<script type="text/javascript">
$(document).ready(function() {
$('#owned_pkgs').dataTable();
diff --git a/grumpy/templates/layout.html b/grumpy/templates/layout.html
index 3823903..60f0754 100644
--- a/grumpy/templates/layout.html
+++ b/grumpy/templates/layout.html
@@ -1,4 +1,5 @@
{% import '_userinfo.html' as userinfo -%}
+{% import '_util.html' as importer -%}
<!doctype html>
<head>
<title>{% block title %}Welcome{% endblock %} | Grumpy</title>