Skip to content

Commit

Permalink
Merge pull request #30 from guscatalano/snshanka/neighborEviction
Browse files Browse the repository at this point in the history
Fix UI + no 500s for same eviction
  • Loading branch information
snehashankar authored Jul 25, 2019
2 parents 531d7ad + 3268ebc commit c818402
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
9 changes: 7 additions & 2 deletions WlihaHackEviction/Controllers/TenantController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ public async Task NewTenantAsync([FromBody] CompleteTenantEvictionInfo info)
{ }

}
_dbContext.DBEvictionInfo.Add(evictionInfo);
await _dbContext.SaveChangesAsync();
try
{
_dbContext.DBEvictionInfo.Add(evictionInfo);
await _dbContext.SaveChangesAsync();
}
catch (Exception)
{ }
}

// PUT api/Tenant/5
Expand Down
19 changes: 11 additions & 8 deletions WlihaHackEviction/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@
background-color: #31302f;
}
.info {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
padding: 12px 12px;
background: white;
background: rgba(255,255,255,0.8);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
border-radius: 20px;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
font-size: 1.2rem;
font-weight: 400;
}
.info h4 {
margin: 0 0 5px;
margin: 0 0 0.3em;
padding-bottom: 5px;
color: #777;
}
.description {

h1 {
text-align: center;
color: white;
}
body {
background-color: #242321;
Expand Down Expand Up @@ -66,8 +70,7 @@
</div>
</nav>
<div class = "description">
<h1>Leaflet Example</h1>
<p>Here's an interactive map indicating the countries I've either lived in or travelled through for a month or more. </p>
<h1>Washington No-Cause Evictions</h1>
</div>
<div id = "background">
<div id="map"></div>
Expand Down
15 changes: 11 additions & 4 deletions WlihaHackEviction/wwwroot/maps/leaf-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
this._div.style.width= "200px";
this._div.style.height= "200px";
this.update({name: "s1", address: "a1"});
this.update({peopleAffected: "-1", address: "a1"});
return this._div;
};

// method that we will use to update the control based on feature properties passed
info.update = function (props) {
this._div.innerHTML = '<div>' + 'People Affected: ' + props.peopleAffected +'</div>' + '<div>' +'Address: ' + props.address + '</div>';
if (props.peopleAffected === "-1") {
this._div.innerHTML = 'Click on a marker to view eviction details.';

} else {
this._div.innerHTML = '<div><b>' + 'People Affected: </b>' + props.peopleAffected + '</div>'
+ '<div><b>' + 'Address: </b>' + props.address + '</div>'
+ '<div><b>' + 'Eviction Date: </b>' + props.evictionDate + '</div>';
}
};

info.addTo(map);
Expand All @@ -75,8 +82,8 @@ Http.onload = function() {
addressPoints = evictionInfo.map(function (p) {
L.marker( [p.addressInfo.latitude,
p.addressInfo.longitude],
{icon: myIcon, title: p.numberOfPpl, alt: p.addressInfo.streetAddress } )
.on('click', function(e) { info.update({peopleAffected: e.target.options.title, address: e.target.options.alt}) })
{ icon: myIcon, title: p.numberOfPpl, alt: p.addressInfo.streetAddress, pane: p.dateOfEviction } )
.on('click', function(e) { info.update({peopleAffected: e.target.options.title, address: e.target.options.alt, evictionDate: e.target.options.pane }) })
.addTo( map );
});

Expand Down

0 comments on commit c818402

Please sign in to comment.