Files
iD/modules/ui/note_report.js
Martin Raifer 9f3f8e1366 rename method
2021-11-29 19:26:18 +01:00

45 lines
1.1 KiB
JavaScript

import { t } from '../core/localizer';
import { osmNote } from '../osm';
import { services } from '../services';
import { svgIcon } from '../svg/icon';
export function uiNoteReport() {
var _note;
function noteReport(selection) {
var url;
if (services.osm && (_note instanceof osmNote) && (!_note.isNew())) {
url = services.osm.noteReportURL(_note);
}
var link = selection.selectAll('.note-report')
.data(url ? [url] : []);
// exit
link.exit()
.remove();
// enter
var linkEnter = link.enter()
.append('a')
.attr('class', 'note-report')
.attr('target', '_blank')
.attr('href', function(d) { return d; })
.call(svgIcon('#iD-icon-out-link', 'inline'));
linkEnter
.append('span')
.call(t.append('note.report'));
}
noteReport.note = function(val) {
if (!arguments.length) return _note;
_note = val;
return noteReport;
};
return noteReport;
}