1*eb8dc403SDave Cobbley{% comment %} 2*eb8dc403SDave Cobbley Adds sorted columns to a detail table. 3*eb8dc403SDave Cobbley Must be preceded by <table class="table table-bordered table-hover tablesorter" id="otable"> 4*eb8dc403SDave Cobbley Must be followed by <tbody>...</tbody></table>. 5*eb8dc403SDave Cobbley Requires tablecols setup column fields dclass, clclass, qhelp, orderfield. 6*eb8dc403SDave Cobbley{% endcomment %} 7*eb8dc403SDave Cobbley{% load projecttags %} 8*eb8dc403SDave Cobbley{# <table class="table table-bordered table-hover tablesorter" id="otable"> #} 9*eb8dc403SDave Cobbley <thead> 10*eb8dc403SDave Cobbley <!-- Table header row; generated from "tablecols" entry in the context dict --> 11*eb8dc403SDave Cobbley <tr> 12*eb8dc403SDave Cobbley {% for tc in tablecols %}<th class="{%if tc.dclass%}{{tc.dclass}}{% endif %} {%if tc.class %}{{tc.clclass}}{% endif %}"> 13*eb8dc403SDave Cobbley {%if tc.qhelp%}<span class="glyphicon glyphicon-question-sign get-help" title="{{tc.qhelp}}"></span>{%endif%} 14*eb8dc403SDave Cobbley {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })">{{tc.name}}</a>{%else%}<span class="text-muted">{{tc.name}}</span>{%endif%} 15*eb8dc403SDave Cobbley {%if tc.ordericon%} <span class="icon-caret-{{tc.ordericon}}"></span>{%endif%} 16*eb8dc403SDave Cobbley {% if request.GET.search and forloop.first %} 17*eb8dc403SDave Cobbley <span class="badge badge-info">{{objects.paginator.count}}</span> 18*eb8dc403SDave Cobbley {% endif %} 19*eb8dc403SDave Cobbley {%if tc.filter%}<div class="btn-group pull-right"> 20*eb8dc403SDave Cobbley <a href="#filter_{{tc.filter.class}}" role="button" class="btn btn-mini {%if request.GET.filter%}{{tc.filter.options|filtered_icon:request.GET.filter}} {%endif%}" {%if request.GET.filter and tc.filter.options|filtered_tooltip:request.GET.filter %} title="<p>{{tc.filter.options|filtered_tooltip:request.GET.filter}}</p><p><a class='btn btn-sm btn-primary' href=javascript:reload_params({'filter':''})>Show all {% if filter_search_display %}{{filter_search_display}}{% else %}{{objectname}}{% endif %}</a></p>" {%endif%} data-toggle="modal"> <i class="glyphicon glyphicon-filter filtered"></i> </a> 21*eb8dc403SDave Cobbley </div>{%endif%} 22*eb8dc403SDave Cobbley </th>{% endfor %} 23*eb8dc403SDave Cobbley </tr> 24*eb8dc403SDave Cobbley </thead> 25*eb8dc403SDave Cobbley 26