minor fix in handler500
[wolnelektury.git] / wolnelektury / templates / lessons / document_list.html
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load catalogue_tags chunks %}
4
5 {% block bodyid %}document-list-body{% endblock %}
6
7 {% block title %}{% trans "Hand-outs for teachers on " %}WolneLektury.pl{% endblock %}
8
9 {% block extrahead %}
10     <script type="text/javascript" charset="utf-8">
11         $(function() {
12             $('#document-list a').click(function() {
13                 if (!$(this).hasClass('active')) {
14                     $('#document-list a').removeClass('active');
15                     $(this).addClass('active');
16                     document.location.hash = $(this).attr('data-hash');
17                 }
18                 return false;
19             });
20             
21             var lastHash = null;
22             
23             function checkHash() {
24                 if (document.location.hash != lastHash) {
25                     lastHash = document.location.hash;
26                     var documentLink = $('#document-list a[data-hash=' + document.location.hash + ']');
27                     if (!documentLink.hasClass('active')) {
28                         $('#document-list a').removeClass('active');
29                         documentLink.addClass('active');
30                     };
31                     
32                     if ($('#document-detail').attr('data-hash') != lastHash) {
33                         $('#document-detail')
34                             .attr('data-hash', lastHash)
35                             .load(documentLink.attr('href'));
36                     };
37                 } else if (!document.location.hash) {
38                     $('#document-list a:first').click();
39                 }
40                 
41                 setTimeout(checkHash, 500);
42             };
43             
44             checkHash();
45         });
46     </script>
47 {% endblock extrahead %}
48 {% block body %}
49     <h1>{% trans "Hand-outs for teachers" %}</h1>
50     <form action="{% url search %}" method="GET" accept-charset="utf-8" id="search-form">
51         <p>{{ form.q }} <input type="submit" value="{% trans "Search" %}" /> <strong>{% trans "or" %}</strong> <a href="{% url main_page %}">{% trans "return to main page" %}</a></p>
52     </form>
53     
54     <div id="document-list">
55         <ol>
56         {% for object in object_list %}
57             <li><a href="{{ object.get_absolute_url }}" data-hash="#{{ object.slug }}">{{ object }}</a></li>
58         {% endfor %}
59         </ol>
60     </div>
61     <div id="document-detail">
62     </div>
63 {% endblock %}
64