Commit 69674084 authored by Phil Hughes's avatar Phil Hughes

Made logic simpler by moving away from underscorejs

parent 931274ba
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
dataType: 'JSON', dataType: 'JSON',
data: data data: data
}).done(function(data) { }).done(function(data) {
var labelCount, template, labelTooltipTitle; var labelCount, template, labelTooltipTitle, labelTitles;
$loading.fadeOut(); $loading.fadeOut();
$dropdown.trigger('loaded.gl.dropdown'); $dropdown.trigger('loaded.gl.dropdown');
$selectbox.hide(); $selectbox.hide();
...@@ -69,20 +69,16 @@ ...@@ -69,20 +69,16 @@
$sidebarCollapsedValue.text(labelCount); $sidebarCollapsedValue.text(labelCount);
if (data.labels.length) { if (data.labels.length) {
labelTooltipTitle = _.chain(data.labels) labelTitles = data.labels.map(function(label) {
.map(function (label, i) { return label.title;
if (i < 5) { });
return label.title;
}
})
.compact()
.values();
if (data.labels.length > 5) { if (labelTitles.length > 5) {
labelTooltipTitle.push('and ' + (data.labels.length - 5) + ' more'); labelTitles = labelTitles.slice(0, 5);
labelTitles.push('and ' + (data.labels.length - 5) + ' more');
} }
labelTooltipTitle = labelTooltipTitle.join(', '); labelTooltipTitle = labelTitles.join(', ');
} else { } else {
labelTooltipTitle = ''; labelTooltipTitle = '';
$sidebarLabelTooltip.tooltip('destroy'); $sidebarLabelTooltip.tooltip('destroy');
......
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 to comment