aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-08-06 18:39:21 +0300
committerPriit Laes <plaes@plaes.org>2010-08-06 18:39:21 +0300
commit512095f5e9a8df07b34af470a042e3f4b0036f3e (patch)
treec263f562b091f18583efa30a6859a9a204f8fefb
parentImprove templating a bit (diff)
downloadgsoc2010-grumpy-512095f5e9a8df07b34af470a042e3f4b0036f3e.tar.gz
gsoc2010-grumpy-512095f5e9a8df07b34af470a042e3f4b0036f3e.tar.bz2
gsoc2010-grumpy-512095f5e9a8df07b34af470a042e3f4b0036f3e.zip
Aded load_js macro to templates for loading js scripts from static
-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>