Files
iD/modules/ui/note_report.js
Quincy Morgan a1af118f0e Ensure locales and presets are loaded before the UI loads (close #7406)
Consolidate localization behavior and init to a coreLocalizer function and singleton
Explicitly support `en-US` locale
Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext
Add `apiConnections` property of coreContext to simplify adding a source switcher
Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions
Make coreContext itself load the UI if a container has been specified at init time
Fix code tests
2020-03-31 12:23:31 -07: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')
.text(t('note.report'));
}
noteReport.note = function(val) {
if (!arguments.length) return _note;
_note = val;
return noteReport;
};
return noteReport;
}