From fbadfec8f604852c21694b65fd0860982397388d Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 19 Apr 2012 09:34:40 +0000 Subject: [PATCH] fix a bug that would make item keys available as text list columns even though they depend on a capability --- static/js/pandora/list.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/static/js/pandora/list.js b/static/js/pandora/list.js index 8471f852..adfbce5f 100644 --- a/static/js/pandora/list.js +++ b/static/js/pandora/list.js @@ -54,22 +54,25 @@ pandora.ui.list = function() { width: 16 }], Ox.map(pandora.site.sortKeys, function(key) { var position = pandora.user.ui.listColumns.indexOf(key.id); - return { - align: ['string', 'text'].indexOf( - Ox.isArray(key.type) ? key.type[0]: key.type - ) > -1 ? 'left' : key.type == 'list' ? 'center' : 'right', - defaultWidth: key.columnWidth, - format: key.format, - id: key.id, - operator: pandora.getSortOperator(key.id), - position: position, - removable: !key.columnRequired, - title: key.title, - type: key.type, - unique: key.id == 'id', - visible: position > -1, - width: pandora.user.ui.listColumnWidth[key.id] || key.columnWidth - }; + return !key.capability + || pandora.site.capabilities[key.capability][pandora.user.level] + ? { + align: ['string', 'text'].indexOf( + Ox.isArray(key.type) ? key.type[0]: key.type + ) > -1 ? 'left' : key.type == 'list' ? 'center' : 'right', + defaultWidth: key.columnWidth, + format: key.format, + id: key.id, + operator: pandora.getSortOperator(key.id), + position: position, + removable: !key.columnRequired, + title: key.title, + type: key.type, + unique: key.id == 'id', + visible: position > -1, + width: pandora.user.ui.listColumnWidth[key.id] || key.columnWidth + } + : null; })), columnsMovable: true, columnsRemovable: true,