Commit 488ec536 by Kálmán Viktor

dashboard: sort template list

parent 2f256c1b
......@@ -20,6 +20,23 @@ $(function() {
});
return false;
});
/* template table sort */
var ttable = $(".template-list-table").stupidtable();
ttable.on("beforetablesort", function(event, data) {
// pass
});
ttable.on("aftertablesort", function(event, data) {
$(".template-list-table thead th i").remove();
var icon_html = '<i class="icon-sort-' + (data.direction == "desc" ? "up" : "down") + ' pull-right" style="position: absolute;"></i>';
$(".template-list-table thead th").eq(data.column).append(icon_html);
});
// only if js is enabled
$(".template-list-table thead th").css("cursor", "pointer");
});
......
......@@ -203,16 +203,29 @@ class TemplateListTable(Table):
name = LinkColumn(
'dashboard.views.template-detail',
args=[A('pk')],
attrs={'th': {'data-sort': "string"}}
)
num_cores = Column(
verbose_name=_("Cores"),
attrs={'th': {'data-sort': "int"}}
)
ram_size = TemplateColumn(
"{{ record.ram_size }} Mb",
attrs={'th': {'data-sort': "string"}}
)
lease = TemplateColumn(
"{{ record.lease.name }}",
verbose_name=_("Lease"),
attrs={'th': {'data-sort': "string"}}
)
arch = Column(
attrs={'th': {'data-sort': "string"}}
)
system = Column(
attrs={'th': {'data-sort': "string"}}
)
access_method = Column(
attrs={'th': {'data-sort': "string"}}
)
actions = TemplateColumn(
verbose_name=_("Actions"),
......
......@@ -55,5 +55,6 @@
{% endblock %}
{% block extra_js %}
<script src="{{ STATIC_URL}}dashboard/template-list.js"></script>
<script src="{{ STATIC_URL}}dashboard/template-list.js"></script>
<script src="{{ STATIC_URL}}dashboard/js/stupidtable.min.js"></script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment