Quickview: don't run tabFilter

For compact detail view (quickview), don't execute tabFilter, as only
the first tab is rendered in all cases. This prevents excessive API
calls from being made, slowing performance.
This commit is contained in:
Brian Federle 2012-10-24 12:35:33 -07:00
parent 72259693ac
commit 7ed60961f0

View File

@ -1019,7 +1019,6 @@
var context = options.context ? options.context : {};
var updateContext = $detailView.data('view-args').updateContext;
var compact = options.compact;
var tabTotal = 0;
if (updateContext) {
$.extend($detailView.data('view-args').context, updateContext({
@ -1035,16 +1034,22 @@
);
}
if (tabFilter) {
if (tabFilter && !compact) {
removedTabs = tabFilter({
context: context
});
} else if (compact) {
removedTabs = $.grep(
$.map(
tabs,
function(value, key) { return key; }
), function(tab, index) { return index > 0; }
);
}
$.each(tabs, function(key, value) {
// Don't render tab, if filtered out
if ($.inArray(key, removedTabs) > -1) return true;
if (compact && tabTotal) return true;
var propGroup = key;
var prop = value;
@ -1062,8 +1067,6 @@
$tabContent.data('detail-view-tab-id', key);
$tabContent.data('detail-view-tab-data', value);
tabTotal++;
return true;
});