From 380185efd4414e3bd2f9f02cc00ce0705a3c64a7 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 19 May 2015 17:47:20 +0530 Subject: [PATCH] more places where year might not exist, fixes #2778 --- static/js/list.js | 4 ++-- static/js/listDialog.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/list.js b/static/js/list.js index da2c5491..c129a1f9 100644 --- a/static/js/list.js +++ b/static/js/list.js @@ -190,7 +190,7 @@ pandora.ui.list = function() { ) + size + '.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director'].indexOf(sortKey) > -1) { - info = data['year']; + info = data['year'] || data['date'] || ''; } else { format = pandora.getSortKeyData(sortKey).format; if (format) { @@ -277,7 +277,7 @@ pandora.ui.list = function() { ) + size + '.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director'].indexOf(sortKey) > -1) { - info = data['year']; + info = data['year'] || data['date'] || ''; } else { format = pandora.getSortKeyData(sortKey).format; if (format) { diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 69816f12..c153130d 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -459,11 +459,17 @@ pandora.ui.listIconPanel = function(listData) { $list = Ox.IconList({ borderRadius: 16, item: function(data, sort) { - var size = 128; + var infoKey = ['title', 'director'].indexOf(sort[0].key) > -1 + ? pandora.site.itemKeys.filter(function(key) { + return ['year', 'date'].indexOf(key.id) > -1 + }).map(function(key) { + return key.id; + })[0] : sort[0],key, + size = 128; return { height: size, id: data.id, - info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], + info: data[infoKey] || '', title: pandora.getItemTitle(data), url: pandora.getMediaURL('/' + data.id + '/icon' + size + '.jpg?' + data.modified), width: size