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

more UI improvements #49

Merged
merged 2 commits into from
Dec 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions mbgl-photomap.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class PhotoMapControl {
a.textContent = "Open Editor for this feature";
a.addEventListener('click', (e) => {
e.preventDefault();
location.replace(this.editorUrl+"/edit?disable_features=date_range&start_date="+this.getYear()+"&way="+footprintId);
const year = parseInt(this.getYear());
location.replace(this.editorUrl+"/edit?disable_features=date_range&start_date="+year+"&end_date="+(year+1)+"&way="+footprintId);
});
commonP.appendChild(a);

Expand Down Expand Up @@ -184,13 +185,15 @@ class PhotoMapControl {
}

getFeatureType(feature, wayId) {
// Ignore type/building values of "yes"
if (feature.properties.type) {
return feature.properties.type;
return feature.properties.type != "yes" ? feature.properties.type : null;
}
if (!(wayId in this.elements['way'])) {
return null;
}
return this.elements['way'][wayId]['tags']['building'];
const building = this.elements['way'][wayId]['tags']['building'];
return building != "yes" ? building : null;
}

getFeatureStartDate(feature, wayId) {
Expand Down Expand Up @@ -259,12 +262,12 @@ class PhotoMapControl {
const table = document.createElement("table");
table.classList.add("building-info");
this.maybeAddBuildingInfoTableRow(table, "name", this.getFeatureName(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "type", this.getFeatureType(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "start_date", this.getFeatureStartDate(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "end_date", this.getFeatureEndDate(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "addr:housenumber", this.getFeatureHouseNumber(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "addr:street", this.getFeatureStreet(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "addr:postcode", this.getFeaturePostCode(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "start_date", this.getFeatureStartDate(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "end_date", this.getFeatureEndDate(feature, footprintId));
this.maybeAddBuildingInfoTableRow(table, "type", this.getFeatureType(feature, footprintId));
buildingDiv.appendChild(table);

return buildingDiv;
Expand Down