From 6d659b80496fc9462f91c1065845b75cb112b490 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 17 Jan 2016 16:22:45 +0530 Subject: [PATCH] use itemKeys and turn .format into function --- static/js/transfersPanel.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/js/transfersPanel.js b/static/js/transfersPanel.js index 53db2bc..f651fc1 100644 --- a/static/js/transfersPanel.js +++ b/static/js/transfersPanel.js @@ -9,13 +9,18 @@ oml.ui.transfersPanel = function() { 'id', 'title', 'extension', 'size', 'transferadded', 'transferprogress' ].map(function(id) { - var key = Ox.getObjectById(oml.config.sortKeys, id); + var key = Ox.getObjectById(oml.config.itemKeys, id); return { align: Ox.contains([ 'size', 'transferprogress' ], id) ? 'right' : 'left', format: function(value) { - return Ox.encodeHTMLEntities(key.format(value)); + return Ox.encodeHTMLEntities(key.format + ? Ox['format' + Ox.toTitleCase(key.format.type)].apply( + this, [value].concat(key.format.args || []) + ) + : Ox.isArray(key.type) ? (value || []).join(', ') + : (value || '')); }, id: id, operator: oml.getSortOperator(id),