mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 03:52:59 +00:00
allow adding unsorted columns to admin via template blocks
This commit is contained in:
@@ -42,6 +42,9 @@ require(["jquery", "bootstrap", "moment", "jhapi", "utils"], function ($, bs, mo
|
||||
$("th").map(function (i, th) {
|
||||
th = $(th);
|
||||
var col = th.data('sort');
|
||||
if (!col || col.length == 0) {
|
||||
return;
|
||||
}
|
||||
var order = th.find('i').hasClass('fa-sort-desc') ? 'asc':'desc';
|
||||
th.find('a').click(
|
||||
function () {
|
||||
|
@@ -1,15 +1,17 @@
|
||||
{% extends "page.html" %}
|
||||
|
||||
{% macro th(key, label, order, colspan) %}
|
||||
{% macro th(label, key='', colspan=1) %}
|
||||
<th data-sort="{{key}}" colspan="{{colspan}}">{{label}}
|
||||
<a href="#"><i class="fa {% if order == 'asc' -%}
|
||||
{% if key %}
|
||||
<a href="#"><i class="fa {% if sort.get(key) == 'asc' -%}
|
||||
fa-sort-asc
|
||||
{%- elif order == 'desc' -%}
|
||||
{%- elif sort.get(key) == 'desc' -%}
|
||||
fa-sort-desc
|
||||
{%- else -%}
|
||||
fa-sort
|
||||
{%- endif %} sort-icon">
|
||||
</i></a>
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -19,10 +21,12 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
{{ th('name', "User (%i)" % users.count(), sort.get('name'), 1) }}
|
||||
{{ th('admin', "Admin", sort.get('admin'), 1) }}
|
||||
{{ th('last_activity', "Last Seen", sort.get('last_activity'), 1) }}
|
||||
{{ th('running', "Running (%i)" % running.count(), sort.get('running'), 2) }}
|
||||
{% block thead %}
|
||||
{{ th("User (%i)" % users.count(), 'name') }}
|
||||
{{ th("Admin", 'admin') }}
|
||||
{{ th("Last Seen", 'last_activity') }}
|
||||
{{ th("Running (%i)" % running.count(), 'running', colspan=2) }}
|
||||
{% endblock thead %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -33,6 +37,7 @@
|
||||
</tr>
|
||||
{% for u in users %}
|
||||
<tr class="user-row" data-user="{{u.name}}" data-admin="{{u.admin}}">
|
||||
{% block user_row scoped %}
|
||||
<td class="name-col col-sm-2">{{u.name}}</td>
|
||||
<td class="admin-col col-sm-2">{% if u.admin %}admin{% endif %}</td>
|
||||
<td class="time-col col-sm-3">{{u.last_activity.isoformat() + 'Z'}}</td>
|
||||
@@ -49,6 +54,7 @@
|
||||
<span class="delete-user btn btn-xs btn-danger">delete</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endblock user_row %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user