From b48445b29a9041f8ed2a91f584ce2138eb71a170 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Tue, 29 Jan 2019 09:56:44 -0500 Subject: [PATCH] Make the first issue's fix list appear by default --- css/80_app.css | 6 ++++++ modules/ui/entity_issues.js | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/css/80_app.css b/css/80_app.css index 593e6c4b0..1ff8ea1be 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -2990,6 +2990,12 @@ div.full-screen > button:hover { border-bottom-style: solid; border-bottom-width: 1px; } +.entity-issues .issue ul.fixes { + display: none; +} +.entity-issues .issue.fixes-open ul.fixes { + display: block; +} /* Background - Display Options Sliders ------------------------------------------------------- */ diff --git a/modules/ui/entity_issues.js b/modules/ui/entity_issues.js index 77dffd672..6b23c9464 100644 --- a/modules/ui/entity_issues.js +++ b/modules/ui/entity_issues.js @@ -45,7 +45,12 @@ export function uiEntityIssues(context) { } var items = selection.selectAll('.issue') - .data(issues, function(d) { return d.id(); }); + .data(issues, function(d) { + if (d.id) { + return d.id(); + } + return null; + }); // Exit items.exit() @@ -96,19 +101,18 @@ export function uiEntityIssues(context) { list = list.enter() .append('ul') .attr('class', 'fixes') - .style('display', 'none') .merge(list); issue.select('.label') .on('click', function() { - if (list.style('display') === 'none') { - list.style('display', 'block'); + if (!issue.classed('fixes-open')) { + issue.classed('fixes-open', true); var loc = d.loc(); if (loc) { context.map().centerZoomEase(loc, Math.max(context.map().zoom(), 18)); } } else { - list.style('display', 'none'); + issue.classed('fixes-open', false); } }); @@ -134,6 +138,12 @@ export function uiEntityIssues(context) { // Update items = items .merge(enter); + + // open the fixes for the first issue if no others are already open + if (selection.selectAll('.issue.fixes-open').empty()) { + selection.select('.issue:first-child').classed('fixes-open', true); + } + } entityIssues.entityID = function(val) {