diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_base.html | 35 | ||||
-rw-r--r-- | templates/search.html | 44 |
2 files changed, 55 insertions, 24 deletions
diff --git a/templates/_base.html b/templates/_base.html new file mode 100644 index 0000000..b5826b2 --- /dev/null +++ b/templates/_base.html @@ -0,0 +1,35 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + {% block head %} + <link rel="stylesheet" href="{{ url_for("static", filename="style.css") }}" /> + <title>{% block title %}{% endblock %} - booksearch</title> + <script> + function start() { + var inputField = document.getElementById("searchInput"); + window.location = "/search/" + inputField.value; + return false; + } + </script> + {% endblock %} +</head> +<body> + <div id="header"> + booksearch + </div> + <div id="search"> + <span class="preSearchField">Search:</span> + <input id="searchInput" type="text" value="{% block searchValue %}{% endblock %}" placeholder="terms..." /> + <button onclick="start()">Senden</button> + </div> + <hr /> + <div id="content"> + {% block content %}{% endblock %} + </div> + <div id="footer"> + {% block footer %} + 2010 - booksearch + {% endblock %} + </div> +</body> diff --git a/templates/search.html b/templates/search.html index 0c5f3d6..5f68355 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,18 +1,13 @@ -<html> - <head> - <title>{{ objects.__len__() + skip}} matches</title> -<script> -function start() { -var inputField = document.getElementById("search"); -window.location = "/search/" + inputField.value; -} -</script> - </head> - <body> -<div> -<input id="search" type="text"/> -<button onclick="start()">Go</button> -</div> +{% extends "_base.html" %} +{% block title %} + {% if term != "" %} + {{ term }} + {% else %} + Start a new Search + {% endif %} +{% endblock %} +{% block searchValue %}{{ term }}{% endblock %} +{% block content %} {% if objects.__len__() == 0 %} No Matches {% else %} @@ -36,14 +31,15 @@ window.location = "/search/" + inputField.value; {% endfor %} {% endif %} - <div> - {% if skip > 0 %} - <a href="{{ url_for("do_search", term=term, skip=skip-5) }}">Previous 5</a> - {% else %} - Previous 5 + <div id="navigation"> + {% if term != "" %} + {% if skip > 0 %} + <a href="{{ url_for("do_search", term=term, skip=skip-5) }}">Previous 5</a> + {% else %} + Previous 5 + {% endif %} + - + <a href="{{ url_for("do_search", term=term, skip=skip+5) }}">Next 5</a> {% endif %} - - - <a href="{{ url_for("do_search", term=term, skip=skip+5) }}">Next 5</a> </div> - </body> -</html> +{% endblock %} |