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