mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 16:19:48 +02:00
Move tag reference to its own file
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
<script src='js/id/ui/layerswitcher.js'></script>
|
||||
<script src='js/id/ui/geocoder.js'></script>
|
||||
<script src='js/id/ui/notice.js'></script>
|
||||
<script src='js/id/ui/tag_reference.js'></script>
|
||||
|
||||
<script src='js/id/actions.js'></script>
|
||||
<script src='js/id/actions/add_node.js'></script>
|
||||
|
||||
+4
-21
@@ -109,32 +109,15 @@ iD.Inspector = function() {
|
||||
return d.lang == 'en';
|
||||
});
|
||||
if (en) {
|
||||
var mod = iD.modal();
|
||||
var types = [];
|
||||
if (en.on_area) types.push('area');
|
||||
if (en.on_node) types.push('point');
|
||||
if (en.on_way) types.push('line');
|
||||
en.types = types;
|
||||
var mod = iD.modal();
|
||||
mod.select('.content')
|
||||
.append('h3')
|
||||
.text(en.title);
|
||||
mod.select('.content')
|
||||
.append('div')
|
||||
.selectAll('span.icon')
|
||||
.data(types).enter()
|
||||
.append('span')
|
||||
.attr('title', function(d) {
|
||||
return 'used with ' + d;
|
||||
})
|
||||
.attr('class', function(d) {
|
||||
return 'icon add-' + d;
|
||||
});
|
||||
mod.select('.content')
|
||||
.append('a')
|
||||
.attr('href', 'http://wiki.openstreetmap.org/wiki/' + en.title)
|
||||
.text('→ ' + en.title + ' on wiki.osm.org');
|
||||
mod.select('.content')
|
||||
.append('p')
|
||||
.text(en.description);
|
||||
.datum(en)
|
||||
.call(iD.tagReference);
|
||||
}
|
||||
});
|
||||
d3.event.preventDefault();
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
iD.tagReference = function(selection) {
|
||||
selection.each(function() {
|
||||
function g(x) { return function(d) { return d[x]; }; }
|
||||
var selection = d3.select(this);
|
||||
selection
|
||||
.append('h3')
|
||||
.text(g('title'));
|
||||
var icon_row = selection.append('div');
|
||||
var icons = icon_row.selectAll('span.icon')
|
||||
.data(g('types'))
|
||||
.enter()
|
||||
.append('span')
|
||||
.attr('title', function(d) {
|
||||
return 'used with ' + d;
|
||||
})
|
||||
.attr('class', function(d) {
|
||||
return 'icon add-' + d;
|
||||
});
|
||||
selection
|
||||
.append('a')
|
||||
.attr('href', function(d) {
|
||||
return 'http://wiki.openstreetmap.org/wiki/' + d.title;
|
||||
})
|
||||
.text(function(d) {
|
||||
return '→ ' + d.title + ' on wiki.osm.org';
|
||||
});
|
||||
selection
|
||||
.append('p')
|
||||
.text(g('description'));
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user