diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_base.html | 9 | ||||
-rw-r--r-- | templates/search.html | 60 |
2 files changed, 52 insertions, 17 deletions
diff --git a/templates/_base.html b/templates/_base.html index b5826b2..92d1c16 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -1,9 +1,11 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> -<html lang="en"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> {% block head %} - <link rel="stylesheet" href="{{ url_for("static", filename="style.css") }}" /> + <link type="text/css" href="{{ url_for("static", filename="style.css") }}" rel="stylesheet" /> + <link type="text/css" href="{{ url_for("static", filename="css/ui-lightness/jquery-ui-1.8.6.custom.css") }}"rel="Stylesheet" /> + <script type="text/javascript" src="{{ url_for("static", filename="js/jquery-1.4.2.min.js") }}"></script> + <script type="text/javascript" src="{{ url_for("static", filename="js/jquery-ui-1.8.6.custom.min.js") }}"></script> <title>{% block title %}{% endblock %} - booksearch</title> <script> function start() { @@ -12,6 +14,7 @@ return false; } </script> + {% block javascript %}{% endblock %} {% endblock %} </head> <body> diff --git a/templates/search.html b/templates/search.html index 81a1007..8b7a561 100644 --- a/templates/search.html +++ b/templates/search.html @@ -7,26 +7,58 @@ {% endif %} {% endblock %} {% block searchValue %}{{ term }}{% endblock %} +{% block javascript %} + <script> + jQuery(document).ready(function() { + var acc = jQuery("div.matches").accordion({active:false}); + acc.bind('accordionchangestart', function(event, ui) { + var docnum = ui.newContent.find("p.docnum").text(); + var term = ui.newContent.find("p.term").text(); + jQuery.get('/excerpt/' + docnum + '/' + term, + function(data) { + ui.newContent.children("div.excerpt").html(data); + ui.newHeader.parent().accordion('resize'); + } + ); + var frontpage = jQuery(this).parent().parent().children("img.frontpage"); + frontpage.attr('src', '/static/ajax-loader.gif'); + frontpage.load(function() { + frontpage.attr('src', '/page/image/' + docnum); + }); + }); + }); + </script> +{% endblock %} {% block content %} {% if matches %} - {# Result rendering #} Matched {{ matches.__len__() }} Book{% if matches.__len__() > 1 %}s{% endif %} {% for docnum, matches in matches.items() %} + <h2 asd="foo"> <a href="{{ url_for("do_book_file", docnum=docnum) }}">book: {{ docnum }}</a> </h2> <div class="book"> - <a href="{{ url_for("do_book_file", docnum=docnum) }}">book: {{ docnum }}</a> - <img src="{{ url_for("do_book_frontpage", docnum=docnum) }}"/> - <br /> - {% for match in matches %} - <div class="match"> - Match at page {{ match[2] }} ( - <a href="{{ url_for("do_page_image", docnum=match[0]) }}">image</a>, - <a href="{{ url_for("do_page_file", docnum=match[0]) }}">pdf</a>) - score={{ match[0] }} - <a href="{{ url_for("json_excerpt", docnum=match[0], term=term) }}">excerpt</a> - </div> - {% endfor %} + <img class="frontpage" src="{{ url_for("do_book_frontpage", docnum=docnum) }}"/> + <div class="description"> + </div> + <div class="c_matches"> + <div class="matches"> + {% for match in matches %} + <h3> + <a href="#">Match at page {{ match[2] }}</a> + </h3> + <div class="match"> + <p class="docnum" style="display:none;">{{ match[0] }}</p> + <p class="term" style="display:none;">{{ term}}</p> + <div class="toolbar"> + <a href="{{ url_for("do_page_file", docnum=match[0]) }}">Download page as PDF</a> + - + <a href="{{ url_for("do_page_image", docnum=match[0]) }}">Download page as Image</a> + </div> + <div class="excerpt"></div> + </div> + {% endfor %} + </div> + </div> + <br style="clear: both;"/> </div> - <hr /> {% endfor %} {% endif %} {% endblock %} |