Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display invalid markers in a separate sidebar #127

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
22 changes: 21 additions & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ html, body
.leaflet-control-zoom.leaflet-bar.leaflet-control
{
position: fixed;
right: 1%;
right: calc(250px + 3%);
bottom: 3%;
}

Expand Down Expand Up @@ -302,6 +302,26 @@ html, body
background: #00254A;
}

#dataTable .map-pin
{
display: inline-block;
}

#dataTable .map-pin:after
{
background: 0;
}

#dataTable p
{
/* Set the height to height of icons */
height: 32px;

display: inline-block;
margin: 0 0 0 4px;
vertical-align: middle;
}

#dataTable .col1 { width: 75px; text-align: center; }
#dataTable .col2 { width: 375px; text-align: center; }
#dataTable .col3 { width: 75px; text-align: center; }
Expand Down
32 changes: 30 additions & 2 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

const sidebar = document.getElementById("sidebar");
const sidebarToggle = document.getElementById("sidebarToggle");
const parentList = document.getElementById('badMarkers');

//Start with sidebar closed if mobile
if (screen.width <= 800) {
Expand Down Expand Up @@ -163,7 +164,11 @@
markers.forEach((marker) => {
if (marker.type.toLowerCase() === type && marker.isMapped) {
if (marker.inDate) {
marker.pin.addTo(map);
if (marker.isMapped) {
marker.pin.addTo(map);
} else {
parentList.appendChild(marker.tableEl);
}
}
marker.filtered = false;
}
Expand Down Expand Up @@ -407,6 +412,30 @@

record.isMapped = true;
} else {
// Give non-mapped markers a list element for displaying in a separate list
// of non-mapped markers
const li = document.createElement('li');
const headerLine = document.createElement('p');

const options = dataSource.icon.options;
const icon = document.createElement('div');
icon.className = options.className;
icon.innerHTML = options.html;
icon.style.width = options.iconSize[0];
icon.style.height = options.iconSize[1];

if (dataSource.table) {
headerLine.innerHTML = dataSource.table(record);
} else {
headerLine.innerHTML = dataSource.title(record);
}

li.appendChild(icon);
li.appendChild(headerLine);

parentList.appendChild(li);

record.tableEl = li;
record.isMapped = false;
}
markers.push(record);
Expand Down Expand Up @@ -656,7 +685,6 @@
fetchPittData('Laundry', 'SUTH_EAST', true),
fetchPittData('Laundry', 'SUTH_WEST', true),
fetchPittData('Laundry', 'FORBES_CRAIG', true)

]).catch((err) => {
displayNotification(err, "error", (retryDiv) => {
var retryButton = document.createElement("button");
Expand Down