9001ee84350063a2f8758a37b9fd5bc8caeb0ab0
[xnet] / xnet / templates / groups / index.html
1 {% extends "base.html" %}
2 {% load static %}
3
4 {% block css %}
5 {{ block.super }}
6 <link href="{% static 'css/groups.css' %}" rel="stylesheet">
7 {% endblock %}
8 {% block js %}
9 <script type="text/javascript">
10 $('.search-field').keyup(function(){
11 var children = $('#' + $(this).data('target') + ' ul').children();
12 var search = $(this).val();
13 console.log(children);
14 console.log($(this).data('target'));
15 for(var i=0; i<children.length; i++)
16 if($(children[i]).html().match(new RegExp(search, 'i')) == null)
17 $(children[i]).hide();
18 else
19 $(children[i]).show();
20 });
21 </script>
22 {% endblock %}
23
24 {% block content %}
25 {% regroup groups by get_kind_display as group_list %}
26 {% for group in group_list %}
27 <div class="group_list" id="{{ group.grouper }}_type">
28 <h3>{{ group.grouper }}</h3>
29 <input type="text" class="search-field" data-target="{{ group.grouper }}_type" />
30 <ul>
31 {% for item in group.list %}
32 <li><a href="{% url 'groups:view' item.pk %}">{{ item }}</a></li>
33 {% endfor %}
34 </ul>
35 </div>
36 {% endfor %}
37 {% endblock %}