From 609685a605fb4ec00f9b3e2dd4763782188a455a Mon Sep 17 00:00:00 2001 From: mbilker Date: Tue, 7 Feb 2017 21:12:34 -0500 Subject: [PATCH 1/8] After fetch, display unmapped records in the sidebar --- index.html | 4 ++-- main.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8b11f52..70b0131 100644 --- a/index.html +++ b/index.html @@ -65,8 +65,8 @@

PantherView

Legend

-
-
+
+

Legend

-
+
+ +
diff --git a/main.css b/main.css index fc59673..5fcaaa7 100644 --- a/main.css +++ b/main.css @@ -134,7 +134,7 @@ html, body .leaflet-control-zoom.leaflet-bar.leaflet-control { position: fixed; - right: 1%; + right: calc(250px + 3%); bottom: 3%; } diff --git a/main.js b/main.js index ddfeb87..de7e9fc 100644 --- a/main.js +++ b/main.js @@ -43,6 +43,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) { @@ -139,17 +140,34 @@ if (elm.checked) { markers.forEach((marker) => { +<<<<<<< HEAD if (marker.type.toLowerCase() === type && marker.isMapped) { +======= + if (marker.type === type) { +>>>>>>> Precompute table data to allow for filtering if (marker.inDate) { - marker.pin.addTo(map); + if (marker.isMapped) { + marker.pin.addTo(map); + } else { + parentList.appendChild(marker.tableEl); + } } marker.filtered = false; } }); } else { markers.forEach((marker) => { +<<<<<<< HEAD if (marker.type.toLowerCase() === type && marker.isMapped) { map.removeLayer(marker.pin); +======= + if (marker.type === type) { + if (marker.isMapped) { + map.removeLayer(marker.pin); + } else if (marker.tableEl.parentElement) { + marker.tableEl.parentElement.removeChild(marker.tableEl); + } +>>>>>>> Precompute table data to allow for filtering marker.filtered = true; } }); @@ -158,29 +176,6 @@ generateDataTable(); } - // List markers that were not put on the map in a list on the sidebar - function displayInvalidMarkers() { - const parentDiv = document.getElementById('badMarkers'); - - for (const record of markers) { - if (record.isMapped) { - continue; - } - - const dataSource = WPRDC_DATA_SOURCES[record.dataSourceName]; - - const headerLine = document.createElement('p'); - headerLine.innerHTML = dataSource.title(record); - - const div = document.createElement('div'); - div.appendChild(headerLine); - - parentDiv.appendChild(div); - - console.log(record); - } - } - //Displays and hides the sidebar function toggleSidebar() { if (sidebarToggle.open == 1) { @@ -370,6 +365,17 @@ record.isMapped = true; } else { + // Give non-mapped markers a list element for displaying in a separate list + // of non-mapped markers + const headerLine = document.createElement('p'); + headerLine.innerHTML = dataSource.title(record); + + const li = document.createElement('li'); + li.appendChild(headerLine); + + parentList.appendChild(li); + + record.tableEl = li; record.isMapped = false; } markers.push(record); @@ -580,7 +586,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"); From 9c5c1de6fd15d6e628dd0d1c3ec69da4f6f631c1 Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 15 Mar 2017 17:11:29 -0400 Subject: [PATCH 3/8] Displaying marker in the new sidebar --- main.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index de7e9fc..eed1abd 100644 --- a/main.js +++ b/main.js @@ -367,11 +367,15 @@ } else { // Give non-mapped markers a list element for displaying in a separate list // of non-mapped markers - const headerLine = document.createElement('p'); - headerLine.innerHTML = dataSource.title(record); - const li = document.createElement('li'); - li.appendChild(headerLine); + + if (dataSource.table) { + li.innerHTML = `
${dataSource.icon.options.html}
${dataSource.table(record)}`; + } else { + const headerLine = document.createElement('p'); + headerLine.innerHTML = `
${dataSource.icon.options.html}
${dataSource.title(record)}`; + li.appendChild(headerLine); + } parentList.appendChild(li); From c5a156cdf2b380e606c2f71af672b3e0d8c8649d Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 15 Mar 2017 18:04:04 -0400 Subject: [PATCH 4/8] Made the invalid entries sidebar look much nicer --- index.html | 1 + main.css | 20 ++++++++++++++++++++ main.js | 20 ++++++++++++++++---- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 6566cdf..7135930 100644 --- a/index.html +++ b/index.html @@ -76,6 +76,7 @@

Legend

+

Invalid Entries

    diff --git a/main.css b/main.css index 5fcaaa7..9bad8f2 100644 --- a/main.css +++ b/main.css @@ -272,6 +272,26 @@ html, body box-shadow: 2px 2px 10px #a3a3a3; } +#unmappedRecords .map-pin +{ + display: inline-block; +} + +#unmappedRecords .map-pin:after +{ + background: 0; +} + +#unmappedRecords p +{ + /* Set the height to height of icons */ + height: 32px; + + display: inline-block; + margin: 0 0 0 4px; + vertical-align: middle; +} + #dataArea { position: fixed; diff --git a/main.js b/main.js index eed1abd..0bdc840 100644 --- a/main.js +++ b/main.js @@ -368,15 +368,27 @@ // 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 marker = dataSource.icon.createIcon(); + // marker.style.marginLeft = null; + // marker.style.marginTop = null; + 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) { - li.innerHTML = `
    ${dataSource.icon.options.html}
    ${dataSource.table(record)}`; + headerLine.innerHTML = dataSource.table(record); } else { - const headerLine = document.createElement('p'); - headerLine.innerHTML = `
    ${dataSource.icon.options.html}
    ${dataSource.title(record)}`; - li.appendChild(headerLine); + headerLine.innerHTML = dataSource.title(record); } + li.appendChild(icon); + li.appendChild(headerLine); + parentList.appendChild(li); record.tableEl = li; From 8504a9fdef68052682eebc596543ae2ea557f21f Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 15 Mar 2017 18:09:59 -0400 Subject: [PATCH 5/8] Remove my experimental icon cloning --- main.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/main.js b/main.js index 0bdc840..04d8eae 100644 --- a/main.js +++ b/main.js @@ -370,9 +370,6 @@ const li = document.createElement('li'); const headerLine = document.createElement('p'); - // const marker = dataSource.icon.createIcon(); - // marker.style.marginLeft = null; - // marker.style.marginTop = null; const options = dataSource.icon.options; const icon = document.createElement('div'); icon.className = options.className; From 81858abe3b68754813c86a40d48568fb2e46f13b Mon Sep 17 00:00:00 2001 From: mbilker Date: Mon, 3 Apr 2017 17:52:49 -0400 Subject: [PATCH 6/8] Change title for the table sidebar to something more appropriate --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 7135930..098a48d 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@

    Legend

    -

    Invalid Entries

    +

    Unmapped Records

      From 9479bc453e09d00f64105ffc5ccfc54182373919 Mon Sep 17 00:00:00 2001 From: mbilker Date: Mon, 10 Apr 2017 20:05:35 -0400 Subject: [PATCH 7/8] Fix my screwup --- main.css | 40 ++++++++++++++++++++-------------------- main.js | 13 ------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/main.css b/main.css index 9bad8f2..c8a076e 100644 --- a/main.css +++ b/main.css @@ -272,26 +272,6 @@ html, body box-shadow: 2px 2px 10px #a3a3a3; } -#unmappedRecords .map-pin -{ - display: inline-block; -} - -#unmappedRecords .map-pin:after -{ - background: 0; -} - -#unmappedRecords p -{ - /* Set the height to height of icons */ - height: 32px; - - display: inline-block; - margin: 0 0 0 4px; - vertical-align: middle; -} - #dataArea { position: fixed; @@ -321,6 +301,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; +} + .shown { display: block; diff --git a/main.js b/main.js index 04d8eae..fc73b5e 100644 --- a/main.js +++ b/main.js @@ -140,11 +140,7 @@ if (elm.checked) { markers.forEach((marker) => { -<<<<<<< HEAD if (marker.type.toLowerCase() === type && marker.isMapped) { -======= - if (marker.type === type) { ->>>>>>> Precompute table data to allow for filtering if (marker.inDate) { if (marker.isMapped) { marker.pin.addTo(map); @@ -157,17 +153,8 @@ }); } else { markers.forEach((marker) => { -<<<<<<< HEAD if (marker.type.toLowerCase() === type && marker.isMapped) { map.removeLayer(marker.pin); -======= - if (marker.type === type) { - if (marker.isMapped) { - map.removeLayer(marker.pin); - } else if (marker.tableEl.parentElement) { - marker.tableEl.parentElement.removeChild(marker.tableEl); - } ->>>>>>> Precompute table data to allow for filtering marker.filtered = true; } }); From 83b94c6fe484893ffd81816feeccc4dd9ee0231c Mon Sep 17 00:00:00 2001 From: mbilker Date: Mon, 10 Apr 2017 20:27:16 -0400 Subject: [PATCH 8/8] Remove old unmapped records element --- index.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/index.html b/index.html index 098a48d..f269ce2 100644 --- a/index.html +++ b/index.html @@ -75,10 +75,6 @@

      Legend

      Logo: @alexandrabush. -
      -

      Unmapped Records

      -
        -