From e5ea656f3bdbced3614e83bb4c1c7dea3ae08001 Mon Sep 17 00:00:00 2001 From: kingsman142 Date: Mon, 29 May 2017 23:00:19 -0400 Subject: [PATCH 1/5] Added functionality so users can choose the default ticked checkboxes --- contributors.md | 2 ++ map.js | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/contributors.md b/contributors.md index 495b758..dc4d000 100644 --- a/contributors.md +++ b/contributors.md @@ -45,3 +45,5 @@ Franklin Ty Kyle Amoroso Benjamin Muscato + +James Hahn diff --git a/map.js b/map.js index 4b8a8cf..d8b3e48 100644 --- a/map.js +++ b/map.js @@ -8,7 +8,8 @@ WPRDC_QUERY_PREFIX, WPRDC_QUERY_SUFFIX, PITT_LAUNDRY, - PITT_LABS; + PITT_LABS, + DEFAULT_CHECKS; // await those values window.addEventListener("dataready", function handler(event) { @@ -23,6 +24,10 @@ PITT_LABS } = event.detail); + // select the default checkmarked boxes + // true = turned on by default; false = turned off by default + DEFAULT_CHECKS = { "library": true, "arrest": true, "police": true, "code violation": true, "non-traffic violation": true, "311": true, "labs": true, "laundry": true }; + // wait for these values before fetching dependant data fetchAllData(); @@ -330,7 +335,9 @@ const filter = document.createElement("input"); filter.id = dataSourceName.toLowerCase() + "Check"; filter.type = "checkbox"; - filter.checked = true; + if (DEFAULT_CHECKS[dataSourceName.toLowerCase()] == true) { + filter.checked = true; + } const filterLabelDec = document.createElement("label"); filterLabelDec.htmlFor = dataSourceName.toLowerCase() + "Check"; @@ -373,7 +380,12 @@ }); record.pin.bindPopup(dataSource.popup(record)); - record.pin.addTo(map); + + record.filtered = true; + if (filter.checked == true) { + record.pin.addTo(map); + record.filtered = false; + } record.isMapped = true; } else { @@ -472,7 +484,9 @@ var filter = document.createElement("input"); filter.id = dataSection.toLowerCase() + "Check"; filter.type = "checkbox"; - filter.checked = true; + if (DEFAULT_CHECKS[dataSection.toLowerCase()] == true) { + filter.checked = true; + } var filterLabelDec = document.createElement("label"); filterLabelDec.htmlFor = dataSection.toLowerCase() + "Check"; @@ -519,8 +533,11 @@ //labRecord.popup = pup; //Bind popup to pin thePin.bindPopup(pup); - //Add pin to map - thePin.addTo(map); + //Add pin to map if Labs checkbox is ticked + var filter = document.getElementById("labsCheck"); + if (filter.checked == true) { + thePin.addTo(map); + } pup.isMapped = true; //Push pin (haha, get it?) markers.push({ //Push the following object onto the markers array @@ -565,7 +582,10 @@ //Bind popup to pin thePin.bindPopup(pup); //Add pin to map - thePin.addTo(map); + var filter = document.getElementById("laundryCheck"); + if (filter.checked == true) { + thePin.addTo(map); + } pup.isMapped = true; //Push pin (haha, get it?) markers.push({ //Push the following object onto the markers array @@ -591,7 +611,7 @@ }); retryDiv.appendChild(retryButton); })); - }//End fetchPittData() + } function fetchAllData() { Promise.all([ From c7959d611b2b5a0b466d033cdae689b78233b377 Mon Sep 17 00:00:00 2001 From: kingsman142 Date: Mon, 29 May 2017 23:12:21 -0400 Subject: [PATCH 2/5] Added to documentation about changing default checkboxes for including in an external site --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5c8ff92..77ee91f 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ to the `head` tag, as well as ``` somewhere in the `body`. +In order to turn on or off default checkboxes, open up `map.js`, CTRL+F 'DEFAULT_CHECKS', and change a value to `false` to turn it off by default and `true` to turn it on by default. + ## Getting started: 1. Fork the project 2. Add your name to `contributors.md` From a928b28ad53febb0d6fb8820cd94081f9dcafa44 Mon Sep 17 00:00:00 2001 From: kingsman142 Date: Mon, 29 May 2017 23:53:41 -0400 Subject: [PATCH 3/5] Added functionality to allow users to change the default view of the application to month, week, or day; shipped with week as default --- README.md | 2 ++ map.js | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 77ee91f..c3edc7e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ somewhere in the `body`. In order to turn on or off default checkboxes, open up `map.js`, CTRL+F 'DEFAULT_CHECKS', and change a value to `false` to turn it off by default and `true` to turn it on by default. +In order to change the default view (currently shipped with weekly data as default) to the past month, week, or day, open `map.js`, CTRL+F 'DEFAULT_VIEW', and read the documentation. You can change the value to "month", "week", or "day"; anything else will default to weekly data. + ## Getting started: 1. Fork the project 2. Add your name to `contributors.md` diff --git a/map.js b/map.js index d8b3e48..89fb9c0 100644 --- a/map.js +++ b/map.js @@ -9,7 +9,8 @@ WPRDC_QUERY_SUFFIX, PITT_LAUNDRY, PITT_LABS, - DEFAULT_CHECKS; + DEFAULT_CHECKS, + DEFAULT_VIEW; // await those values window.addEventListener("dataready", function handler(event) { @@ -28,6 +29,12 @@ // true = turned on by default; false = turned off by default DEFAULT_CHECKS = { "library": true, "arrest": true, "police": true, "code violation": true, "non-traffic violation": true, "311": true, "labs": true, "laundry": true }; + // choose the default data shown in the map; can hold 1 of 3 strings: + // "month" = show data from the previous 30 days + // "week" = show data from the previous 7 days + // "day" = show data from the previous day + DEFAULT_VIEW = "week"; + // wait for these values before fetching dependant data fetchAllData(); @@ -383,7 +390,6 @@ record.filtered = true; if (filter.checked == true) { - record.pin.addTo(map); record.filtered = false; } @@ -652,8 +658,19 @@ retryDiv.appendChild(retryButton); }); }).then(() => { - //display past week map as default - displayPastWeek(); + switch (DEFAULT_VIEW) { + case "month": + displayPastMonth(); + break; + case "week": + displayPastWeek(); + break; + case "day": + displayPastDay(); + break; + default: + displayPastWeek(); + } displayMapMode(); generateDataTable(); }); From b17d883775e29cdbbdee0fe5596e5e5dede4682a Mon Sep 17 00:00:00 2001 From: kingsman142 Date: Tue, 30 May 2017 00:10:46 -0400 Subject: [PATCH 4/5] Added extra statement to enforce the 'month' button changes to white --- map.js | 1 + 1 file changed, 1 insertion(+) diff --git a/map.js b/map.js index 89fb9c0..232db32 100644 --- a/map.js +++ b/map.js @@ -112,6 +112,7 @@ document.getElementById("radioDay").style.backgroundColor = "#fff"; document.getElementById("radioWeek").style.backgroundColor = "lightgrey"; document.getElementById("radioMonth").style.backrgoundColor = "#fff"; + document.getElementById("radioMonth").style.backgroundColor = "#fff"; // NOTE: when switching from month to week data, the month button is stuck on "lightgrey" so this statement makes sure it is "#fff" instead markers.forEach((marker, i) => { if (!marker.incidentYear || !marker.isMapped) { return; From 779adf53ef1e057def89133f47b37bd7b237318d Mon Sep 17 00:00:00 2001 From: kingsman142 Date: Tue, 30 May 2017 00:44:24 -0400 Subject: [PATCH 5/5] Jumpstarted the about page for issue #65 --- about.html | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 about.html diff --git a/about.html b/about.html new file mode 100644 index 0000000..b17b085 --- /dev/null +++ b/about.html @@ -0,0 +1,68 @@ + + + + + + + + PantherView + + + + + + + + + + + + + + + + + + + + + + + + +

Contributors


+

JJ Naughton

+

John Linahan - CSC President

+

Alexis John Aquiatan

+

Matt Bilker me@mbilker.us

+

Chandler Yocca

+

Kai Dawkins

+

Simon Cao

+

Matthew Duing

+

Daniel Zheng - CSC Business Manager

+

Chris Seifried

+

Colton Blake

+

Austin Marcus

+

Sriram Iyer

+

Sai Xu

+

Benjamin Lodi

+

Jeffrey Willis

+

Chris Skowronski

+

Brandon Palonis

+

Neha Abraham

+

Sam Nigh - CSC Events Coordinator

+

Franklin Ty

+

Kyle Amoroso

+

Benjamin Muscato

+

James Hahn - CSC Vice-President


+ +

University of Pittsburgh Computer Science Club (Pitt CSC)


+

...Insert description of the club and what we do here...

+
+ +

About this Project


+

...Insert description of this project, its motivation, where we plan to take it, who can contribute, what it adds, where it pulls data from...

+
+ + +