mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 01:33:03 +00:00
Show local editing users
This commit is contained in:
31
js/id/id.js
31
js/id/id.js
@@ -36,14 +36,36 @@ window.iD = function(container) {
|
||||
.call(bootstrap.tooltip().placement('bottom'))
|
||||
.on('click', function (mode) { controller.enter(mode); });
|
||||
|
||||
map.on('move.disable-buttons', function() {
|
||||
function disableTooHigh() {
|
||||
if (map.zoom() < 16) {
|
||||
buttons.attr('disabled', 'disabled');
|
||||
controller.enter(iD.modes.Browse());
|
||||
} else {
|
||||
buttons.attr('disabled', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var showUsers = _.debounce(function() {
|
||||
var users = {},
|
||||
entities = map.history().graph().entities;
|
||||
for (var i in entities) {
|
||||
users[entities[i].user] = true;
|
||||
if (Object.keys(users).length > 10) break;
|
||||
}
|
||||
var u = Object.keys(users);
|
||||
var l = d3.select('#user-list')
|
||||
.selectAll('a.user-link').data(u);
|
||||
l.enter().append('a')
|
||||
.attr('class', 'user-link')
|
||||
.attr('href', function(d) {
|
||||
return 'http://api06.dev.openstreetmap.org/user/' + d;
|
||||
})
|
||||
.text(String);
|
||||
l.exit().remove();
|
||||
}, 1000);
|
||||
|
||||
map.on('move.disable-buttons', disableTooHigh)
|
||||
.on('move.show-users', showUsers);
|
||||
|
||||
buttons.append('span')
|
||||
.attr('class', function(d) {
|
||||
@@ -143,12 +165,15 @@ window.iD = function(container) {
|
||||
.attr('class', 'inspector-wrap fillL')
|
||||
.style('display', 'none');
|
||||
|
||||
this.append('div')
|
||||
var about = this.append('div')
|
||||
.attr('id', 'about')
|
||||
.html("<a href='http://github.com/systemed/iD'>code</a> " +
|
||||
"<a href='http://github.com/systemed/iD/issues'>report a bug</a>" +
|
||||
" <a href='http://opengeodata.org/microsoft-imagery-details'><img src='img/bing.png' /></a>");
|
||||
|
||||
about.append('div')
|
||||
.attr('id', 'user-list');
|
||||
|
||||
history.on('change.buttons', function() {
|
||||
var undo = history.undoAnnotation(),
|
||||
redo = history.redoAnnotation();
|
||||
|
||||
@@ -137,14 +137,16 @@ iD.Inspector = function() {
|
||||
selection.append('div')
|
||||
.attr('class', 'inspector-buttons').call(drawbuttons);
|
||||
|
||||
function apply(entity) {
|
||||
event.changeTags(entity, unentries(grabtags()));
|
||||
event.close(entity);
|
||||
}
|
||||
|
||||
function drawbuttons(selection) {
|
||||
selection.append('button')
|
||||
.attr('class', 'apply wide action')
|
||||
.html("<span class='icon icon-pre-text apply'></span><span class='label'>Apply</span>")
|
||||
.on('click', function(entity) {
|
||||
event.changeTags(entity, unentries(grabtags()));
|
||||
event.close(entity);
|
||||
});
|
||||
.on('click', apply);
|
||||
selection.append('button')
|
||||
.attr('class', 'delete wide action fr')
|
||||
.html("<span class='icon icon-pre-text delete'></span><span class='label'>Delete</span>")
|
||||
|
||||
Reference in New Issue
Block a user