mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Add "view on osmose" link to UI footer
This commit is contained in:
@@ -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
|
||||
|
||||
Vendored
+1
@@ -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",
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user