Add "view on osmose" link to UI footer

This commit is contained in:
SilentSpike
2020-02-15 11:48:01 +00:00
parent c2493c4b46
commit af0e37f7c5
5 changed files with 58 additions and 0 deletions
+1
View File
@@ -547,6 +547,7 @@ en:
tooltip_issue: "Center and zoom the map to focus on this issue."
show_more: Show More
view_on_osm: View on openstreetmap.org
view_on_osmose: View on osmose.openstreetmap.fr
view_on_keepRight: View on keepright.at
feature_type: Feature Type
fields: Fields
+1
View File
@@ -692,6 +692,7 @@
},
"show_more": "Show More",
"view_on_osm": "View on openstreetmap.org",
"view_on_osmose": "View on osmose.openstreetmap.fr",
"view_on_keepRight": "View on keepright.at",
"feature_type": "Feature Type",
"fields": "Fields",
+4
View File
@@ -333,5 +333,9 @@ export default {
// Used to populate `closed:osmose:*` changeset tags
getClosedCounts() {
return _cache.closed;
},
itemURL(item) {
return `https://osmose.openstreetmap.fr/error/${item.id}`;
}
};
+10
View File
@@ -9,6 +9,7 @@ import { uiOsmoseDetails } from './osmose_details';
import { uiOsmoseHeader } from './osmose_header';
import { uiQuickLinks } from './quick_links';
import { uiTooltipHtml } from './tooltipHtml';
import { uiViewOnOsmose } from './view_on_osmose';
import { utilRebind } from '../util';
@@ -65,6 +66,15 @@ export function uiOsmoseEditor(context) {
.call(quickLinks.choices(choices))
.call(qaDetails.issue(_qaItem))
.call(osmoseSaveSection);
const footer = selection.selectAll('.footer')
.data([0]);
footer.enter()
.append('div')
.attr('class', 'footer')
.merge(footer)
.call(uiViewOnOsmose(context).what(_qaItem));
}
function osmoseSaveSection(selection) {
+42
View File
@@ -0,0 +1,42 @@
import { t } from '../util/locale';
import { services } from '../services';
import { svgIcon } from '../svg/icon';
import { QAItem } from '../osm';
export function uiViewOnOsmose() {
let _qaItem;
function viewOnOsmose(selection) {
let url;
if (services.osmose && (_qaItem instanceof QAItem)) {
url = services.osmose.itemURL(_qaItem);
}
const link = selection.selectAll('.view-on-osmose')
.data(url ? [url] : []);
// exit
link.exit()
.remove();
// enter
const linkEnter = link.enter()
.append('a')
.attr('class', 'view-on-osmose')
.attr('target', '_blank')
.attr('href', d => d)
.call(svgIcon('#iD-icon-out-link', 'inline'));
linkEnter
.append('span')
.text(t('inspector.view_on_osmose'));
}
viewOnOsmose.what = function(val) {
if (!arguments.length) return _qaItem;
_qaItem = val;
return viewOnOsmose;
};
return viewOnOsmose;
}