mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-03 09:53:40 +00:00
- ES6ify (now using class syntax to define QAItem objects) - Fix bug with KeepRight marker rendering not updating properly - Use `qa-` prefix for the UI element classes to differentiate from iD validation error related UI element classes - Move away from "error" where possible in source - Move away from snake_case naming where possible Note that some function/method names have been untouched to make life easier for v3 development. Have added note comments where appropriate.
43 lines
1016 B
JavaScript
43 lines
1016 B
JavaScript
import { t } from '../util/locale';
|
|
import { services } from '../services';
|
|
import { svgIcon } from '../svg/icon';
|
|
import { QAItem } from '../osm';
|
|
|
|
export function uiViewOnKeepRight() {
|
|
let _qaItem;
|
|
|
|
function viewOnKeepRight(selection) {
|
|
let url;
|
|
if (services.keepRight && (_qaItem instanceof QAItem)) {
|
|
url = services.keepRight.issueURL(_qaItem);
|
|
}
|
|
|
|
const link = selection.selectAll('.view-on-keepRight')
|
|
.data(url ? [url] : []);
|
|
|
|
// exit
|
|
link.exit()
|
|
.remove();
|
|
|
|
// enter
|
|
const linkEnter = link.enter()
|
|
.append('a')
|
|
.attr('class', 'view-on-keepRight')
|
|
.attr('target', '_blank')
|
|
.attr('href', function(d) { return d; })
|
|
.call(svgIcon('#iD-icon-out-link', 'inline'));
|
|
|
|
linkEnter
|
|
.append('span')
|
|
.text(t('inspector.view_on_keepRight'));
|
|
}
|
|
|
|
viewOnKeepRight.what = function(val) {
|
|
if (!arguments.length) return _qaItem;
|
|
_qaItem = val;
|
|
return viewOnKeepRight;
|
|
};
|
|
|
|
return viewOnKeepRight;
|
|
}
|