Skip to content

Commit

Permalink
Merge pull request #887 from ProjectSidewalk/develop
Browse files Browse the repository at this point in the history
v4.0.3
  • Loading branch information
Manaswi Saha authored Jul 20, 2017
2 parents ac59c13 + 09802f4 commit 58354b6
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 61 deletions.
57 changes: 32 additions & 25 deletions app/views/developer.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ <h1>Developer Zone</h1>
that support people with mobility impairments!
</p>
<p class="text-justify">
We serve the accessibility data in two formats: <span class="bold">Access Feature and Access Score.</span> Access Feature contains
point-level information on what accessibility feature exist and where (latitude-longitude). <a data-scroll href="#access-api-access-feature-row">See below for an example.</a>
Access Score is a numerical value that indicates how (in)accesible a given street/area is. <a data-scroll href="#access-api-access-score-street-row">See the Access Score APIs for examples.</a>
We serve our accessibility data in two formats: <span class="bold">Access Feature and Access Score.</span> Access Feature contains
point-level information on what accessibility features exist and where (latitude-longitude). <a data-scroll href="#access-api-access-feature-row">See below for an example.</a>
Access Score is a value that indicates how (in)accessible a given street/area is. <a data-scroll href="#access-api-access-score-street-row">See the Access Score APIs for examples.</a>
</p>
<p class="text-justify">
You can get the data either through the <a data-scroll href="#access-api-header">REST APIs</a> or <a data-scroll href="#access-dataset">download the zip file.</a>
You can get the data through the <a data-scroll href="#access-api-header">REST APIs</a>.
@*or <a data-scroll href="#access-dataset">download the zip file.</a>*@
You can also help <a data-scroll href="#contribute">contribute</a>! The code is available on
<a href="https://github.com/ProjectSidewalk/SidewalkWebpage" target="_blank">github</a>.
</p>

<div class="row">
Expand All @@ -36,9 +39,9 @@ <h3>Access Features</h3>
<table class="table">
<tr>
<td colspan="2">
This API serves point-level location data on accessibility features. The major categories of the features include:
"Curb Ramp," "Missing Curb Ramp," "Obstacles," and "Surface Problem."
You would occasionally find an accessibility feature like "No Sidewalk."
This API serves point-level location data on accessibility features. The major categories of features include:
"Curb Ramp", "Missing Curb Ramp", "Obstacle", and "Surface Problem".
The less common features are "No Sidewalk", "Occlusion", and "Other".
</td>
</tr>
<tr>
Expand Down Expand Up @@ -109,7 +112,7 @@ <h3>Access Score: Streets</h3>
<tr>
<td colspan="2">
This API serves Accessibility Scores of the streets within a specified region.
Accessibility Score is a numerical value between 0 and 1, where 0 means inaccessible and
Accessibility Score is a value between 0 and 1, where 0 means inaccessible and
1 means accessible.
</td>
</tr>
Expand Down Expand Up @@ -151,7 +154,7 @@ <h3>Access Score: Streets</h3>
<dl>
<dt>200</dt>
<dd>
The API returns the streets that has been audited at least once as a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">Feature Collection</a> of
The API returns the streets that have been audited at least once as a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">Feature Collection</a> of
<a href="http://geojson.org/geojson-spec.html#linestring">LineString features.</a> Each LineString feature
include street's geometry as well as the corresponding Access Score.
</dd>
Expand Down Expand Up @@ -182,7 +185,7 @@ <h3>Access Score: Neighborhood</h3>
<tr>
<td colspan="2">
This API serves Accessibility Scores of the neighborhoods within a specified region.
Accessibility Score is a numerical value between 0 and 1, where 0 means inaccessible and
Accessibility Score is a value between 0 and 1, where 0 means inaccessible and
1 means accessible.
</td>
</tr>
Expand Down Expand Up @@ -252,26 +255,28 @@ <h2 id="access-dataset">Access Dataset</h2>

<div class="row">
<div class="col-sm-12">
<h2>Warning</h2>
<h2>Disclaimer</h2>
<p class="text-justify">
We are still in the experimental stage of the project, and so we want you to keep in mind a few things, for example:
We are still in the experimental stage of the project, so we want you to keep in mind a few things,
for example:
</p>
<ol>
<li>APIs' design (e.g., URL, response formats) could change</li>
<li>we are focusing on collecting data only from Washington, D.C. at the moment</li>
<li>since we have only covered @("%.0f".format(StreetEdgeTable.streetDistanceCompletionRate(1) * 100))% of the entire area of DC,
you would find neighborhoods where we don't have the accessibility data yet
(note you can help us by <a href='@routes.AuditController.audit'>contributing to data collection too ;)</a>).</li>
<li>APIs' design (e.g., URL, response formats) could change.</li>
<li>We are focusing on collecting data only from Washington, D.C. at the moment.</li>
<li>Since we have only covered @("%.0f".format(StreetEdgeTable.streetDistanceCompletionRate(1) * 100))% of DC,
there are neighborhoods where we currently have very little accessibility data.
Note: You can help us by <a href='@routes.AuditController.audit'>contributing to data collection</a> too ;-).</li>
</ol>
</div>
</div>

<div class="row">
<div class="col-sm-12">
<h2>Contribute</h2>
<h2 id="contribute">Contribute</h2>
<p class="text-justify">
All the code for Project Sidewalk is open source. You can find it in our <a href="https://github.com/ProjectSidewalk/SidewalkWebpage">GitHub repo</a>.
We welcome your help in advancing the project. If you make enhancement, fix a bug, etc, send a pull request!
All the code for Project Sidewalk is open source. You can find it in our
<a href="https://github.com/ProjectSidewalk/SidewalkWebpage" target="_blank">GitHub repo</a>.
We welcome your help in advancing the project. If you make an enhancement or fix a bug, send a pull request!
</p>
</div>
</div>
Expand All @@ -280,9 +285,11 @@ <h2>Contribute</h2>
<div class="col-sm-12">
<h2>Contact Us</h2>
<p class="text-justify">
Questions? Bugs? Feature requests and suggestions? Or anything else? Email us (sidewalk@@umiacs.umd.edu),
post a <a href="https://github.com/ProjectSidewalk/SidewalkWebpage/issues">GitHub issue</a>, or follow and talk to us
on <a href="https://twitter.com/umd_sidewalk">Twitter (@@umd_sidewalk)!</a>
Questions? Bugs? Feature requests and suggestions? Or anything else? Email us
(<a href="mailto:sidewalk@@umiacs.umd.edu">sidewalk@@umiacs.umd.edu</a>), post a
<a href="https://github.com/ProjectSidewalk/SidewalkWebpage/issues" target="_blank">GitHub issue</a>,
or follow and talk to us on <a href="https://twitter.com/projsidewalk" target="_blank">Twitter
@@projsidewalk</a>!
</p>
</div>
</div>
Expand All @@ -291,8 +298,8 @@ <h2>Contact Us</h2>
<div class="col-sm-12">
<h2>License</h2>
<p>
We are working on this! We'll choose a license that gives as much flexibilities as possible for
developers and researchers to use the data ;)
We are working on this! We plan to choose a license that gives as much flexibility as possible for
developers and researchers to use the data.
</p>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions app/views/main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
// Column is 'Connect'
// log is of form: "Click_module=Footer_section=connect_platform=<"github", "twitter", or "email">"
$("#footer-container").on('click', 'a', function(e){
var currentRoute = window.location.pathname;
var id = e.currentTarget.id.split("-");
var column = id[0];
var link = id[1];
Expand All @@ -160,6 +161,7 @@
else{
activity = activity+"platform="+link;
}
activity = activity + "_route="+currentRoute;

var url = "/userapi/logWebpageActivity";
var async = true;
Expand All @@ -178,10 +180,11 @@
});

// Log clicks on links in the information footer to WebpageActivityTable
// Log is of form: "Click_module=InfoFooter_target=<link>"
// Log is of form: "Click_module=InfoFooter_target=<link>_route=</|/audit|/faq|...>"
$('#info-footer').on('click','a', function(e){
var currentRoute = window.location.pathname;
var link = e.currentTarget.id.split("-")[0];
var activity = "Click_module=InfoFooter_"+"target="+link;
var activity = "Click_module=InfoFooter_"+"target="+link + "_route="+currentRoute;
var url = "/userapi/logWebpageActivity";
var async = true;
$.ajax({
Expand Down
97 changes: 67 additions & 30 deletions app/views/navbar.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,71 @@
<!-- /.container -->
</nav>
<!-- /.navbar -->

<!-- Script loads regardless of whether user is registered or not -->
<script>
$(document).ready(function () {
function logWebpageActivity(activity){
var currentRoute = window.location.pathname;
var url = "/userapi/logWebpageActivity";
var async = true;
var activityToSend = activity + "_location=Navbar_route=" + currentRoute;
$.ajax({
async: async,
contentType: 'application/json; charset=utf-8',
url: url,
type: 'post',
data: JSON.stringify(activityToSend),
dataType: 'json',
success: function(result){},
error: function (result) {
console.error(result);
}
});
}

// Triggered when 'Sign In' in navbar is clicked
// Logs "Click_module=SignIn_location=Navbar_route=</|/audit|/faq|...>"
$("#sign-in-button").on('click', function(){
logWebpageActivity("Click_module=SignIn");
});

// Triggered when 'Start Mapping' in navbar is clicked
// Logs "Click_module=StartMapping_location=Index"
$(".navbarStartBtn").on('click', function(){
logWebpageActivity("Click_module=StartMapping");
});

// Triggered when links in the navbar are pressed when on the Audit page
// Logs "Click_module=<RetakeTutorial|FAQ>_location=Navbar_route=</|/audit|/faq|...>"
$(".navbarLink").on('click', function(e){
var activity = "Click_module=RetakeTutorial";
if(e.currentTarget.innerHTML.includes("FAQ")){
activity = "Click_module=FAQ";
}
logWebpageActivity(activity);
});

// Triggered when Project Sidewalk logo on navbar is clicked
// Logs "Click_module=PSLogo_location=Navbar_route=</|/audit|/faq|...>"
$("#brand").on('click', function(){
logWebpageActivity("Click_module=PSLogo");
});

// Triggered when items in the user menu are clicked
// Logs "Click_module=<SignOut|ToDashboard|ToAdmin>_location=Navbar_route=</|/audit|/faq|...>""
$("#nav-user-menu").on('click', function(e){
var activity = "Click_module=SignOut";
if(e.target.innerText.includes("Admin")){
activity = "Click_module=ToAdmin";
}else if(e.target.innerText.includes("dashboard")){
activity = "Click_module=ToDashboard";
}
logWebpageActivity(activity);
});
});
</script>

@if(!user) {
<script type="text/javascript">
$(document).ready(function () {
Expand All @@ -99,35 +164,6 @@
$("#sign-up-modal").addClass("hidden");
$("#sign-in-modal").removeClass("hidden");
});

function logWebpageActivity(activity){
var url = "/userapi/logWebpageActivity";
var async = true;
$.ajax({
async: async,
contentType: 'application/json; charset=utf-8',
url: url,
type: 'post',
data: JSON.stringify(activity),
dataType: 'json',
success: function(result){},
error: function (result) {
console.error(result);
}
});
}

// Triggered when 'Sign In' in navbar is clicked
// Logs "Click_module=SignIn"
$("#sign-in-button").on('click', function(){
logWebpageActivity("Click_module=SignIn");
});

// Triggered when 'Start Mapping' in navbar is clicked
// Logs "Click_module=StartMapping_location=Index"
$(".navbarStartBtn").on('click', function(){
logWebpageActivity("Click_module=StartMapping_location=Navbar");
});
});
</script>
<div class="modal fade" id="sign-in-modal-container" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
Expand Down Expand Up @@ -206,6 +242,7 @@ <h4 class="modal-title" id="sign-up-label">Sign up</h4>
// $(this).closest("." + $(this).attr("data-hide")).hide();
});
});


function validateEmail(email) {
var regex = /\S+@@\S+\.\S+/;
Expand Down Expand Up @@ -255,7 +292,7 @@ <h4 class="modal-title" id="sign-up-label">Sign up</h4>

// Append the link to the admin interface if it the user is admin
if (data.roles && data.roles.indexOf("Administrator") >= 0) {
var adminLi = '<li role="presentation"><a href="/admin" role="menuitem">Admin</a></li>';
var adminLi = '<li role="presentation"><a href="@routes.AdminController.index" role="menuitem">Admin</a></li>';
$('#nav-user-menu').children('#dashboard-link').after(adminLi);
}

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scalariform.formatter.preferences._

name := """sidewalk-webpage"""

version := "4.0.2"
version := "4.0.3"

scalaVersion := "2.10.4"

Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/Admin/src/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ function Admin(_, $, c3, turf, difficultRegionIds) {
var combinedChart = {"hconcat": [allChart, regChart, anonChart]};
var combinedChartFiltered = {"hconcat": [allFilteredChart, regFilteredChart, anonChart]};

vega.embed("#mission-count-chart", combinedChart, opt, function(error, results) {});
vega.embed("#mission-count-chart", combinedChartFiltered, opt, function(error, results) {});

var checkbox = document.getElementById("mission-count-include-researchers-checkbox").addEventListener("click", function(cb) {
if (cb.srcElement.checked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function ContextMenu (uiContextMenu) {
var clicked_out = !(context_menu_el.contains(event.target));
if (isOpen()){
hide();
wasOpen = true;
if (clicked_out) _handleSeverityPopup();
}
}); //handles clicking outside of context menu holder
Expand Down
11 changes: 9 additions & 2 deletions public/javascripts/SVLabel/src/SVLabel/navigation/MapService.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function MapService (canvas, neighborhoodModel, uiMap, params) {
beforeJumpListenerHandle: undefined
},
jumpLocation = undefined,
missionJump = undefined;
missionJump = undefined,
wasOpen = false;

var initialPositionUpdate = true,
panoramaOptions,
Expand Down Expand Up @@ -1088,6 +1089,7 @@ function MapService (canvas, neighborhoodModel, uiMap, params) {
// setViewControlLayerCursor('ZoomOut');
//}


currTime = new Date().getTime();

var point = _canvas.isOn(mouseStatus.currX, mouseStatus.currY);
Expand All @@ -1098,10 +1100,14 @@ function MapService (canvas, neighborhoodModel, uiMap, params) {

_canvas.setCurrentLabel(selectedLabel);
if ('contextMenu' in svl) {
if(wasOpen){
svl.contextMenu.hide();
} else{
svl.contextMenu.show(canvasCoordinate.x, canvasCoordinate.y, {
targetLabel: selectedLabel,
targetLabelColor: selectedLabel.getProperty("labelFillStyle")
});
});}
wasOpen = false;
}
} else if (currTime - mouseStatus.prevMouseUpTime < 300) {
// Double click
Expand Down Expand Up @@ -1158,6 +1164,7 @@ function MapService (canvas, neighborhoodModel, uiMap, params) {
}


setViewControlLayerCursor('OpenHand');
mouseStatus.prevMouseUpTime = currTime;
}

Expand Down

0 comments on commit 58354b6

Please sign in to comment.