mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Merge branch 'master' of github.com:systemed/iD
This commit is contained in:
+54
-28
@@ -14,51 +14,77 @@ iD.commit = function() {
|
||||
.attr('class', 'changeset-comment')
|
||||
.attr('placeholder', 'Brief Description of your contributions');
|
||||
|
||||
var buttonwrap = commit.append('div')
|
||||
.attr('class', 'buttons');
|
||||
var buttonwrap = commit.append('div')
|
||||
.attr('class', 'buttons');
|
||||
|
||||
var savebutton = buttonwrap.append('button')
|
||||
.attr('class', 'action wide')
|
||||
.on('click.save', function() {
|
||||
event.save({
|
||||
comment: d3.select('textarea.changeset-comment').node().value
|
||||
});
|
||||
});
|
||||
savebutton.append('span').attr('class','icon save icon-pre-text');
|
||||
savebutton.append('span').attr('class','label').text('Save');
|
||||
var cancelbutton = buttonwrap.append('button')
|
||||
.attr('class', 'cancel wide')
|
||||
.on('click.cancel', function() {
|
||||
event.cancel();
|
||||
});
|
||||
cancelbutton.append('span').attr('class','icon close icon-pre-text');
|
||||
cancelbutton.append('span').attr('class','label').text('Cancel');
|
||||
var savebutton = buttonwrap.append('button')
|
||||
.attr('class', 'action wide')
|
||||
.on('click.save', function() {
|
||||
event.save({
|
||||
comment: d3.select('textarea.changeset-comment').node().value
|
||||
});
|
||||
});
|
||||
savebutton.append('span').attr('class','icon save icon-pre-text');
|
||||
savebutton.append('span').attr('class','label').text('Save');
|
||||
|
||||
var cancelbutton = buttonwrap.append('button')
|
||||
.attr('class', 'cancel wide')
|
||||
.on('click.cancel', function() {
|
||||
event.cancel();
|
||||
});
|
||||
cancelbutton.append('span').attr('class','icon close icon-pre-text');
|
||||
cancelbutton.append('span').attr('class','label').text('Cancel');
|
||||
|
||||
function changesLength(d) { return changes[d].length; }
|
||||
|
||||
var section = body.selectAll('div.commit-section')
|
||||
.data(['modified', 'deleted', 'created'].filter(function(d) {
|
||||
return changes[d].length;
|
||||
}))
|
||||
.data(['modified', 'deleted', 'created'].filter(changesLength))
|
||||
.enter()
|
||||
.append('div').attr('class', 'commit-section modal-section fillL2');
|
||||
|
||||
section.append('h3').text(String)
|
||||
.append('small')
|
||||
.attr('class', 'count')
|
||||
.text(function(d) { return changes[d].length; });
|
||||
.text(changesLength);
|
||||
|
||||
function zipSame(d) {
|
||||
var c = [], n = -1;
|
||||
for (var i = 0; i < d.length; i++) {
|
||||
var desc = {
|
||||
name: d[i].friendlyName(),
|
||||
type: d[i].type,
|
||||
count: 1,
|
||||
tagText: iD.util.tagText(d[i])
|
||||
};
|
||||
if (c[n] &&
|
||||
c[n].name == desc.name &&
|
||||
c[n].tagText == desc.tagText) {
|
||||
c[n].count++;
|
||||
} else {
|
||||
c[++n] = desc;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
var li = section.append('ul')
|
||||
.attr('class','changeset-list')
|
||||
.selectAll('li')
|
||||
.data(function(d) { return changes[d]; })
|
||||
.data(function(d) { return zipSame(changes[d]); })
|
||||
.enter()
|
||||
.append('li');
|
||||
|
||||
li.append('strong').text(function(d) { return d.type + ' '; });
|
||||
li.append('strong').text(function(d) {
|
||||
return (d.count > 1) ? d.type + 's ' : d.type + ' ';
|
||||
});
|
||||
li.append('span')
|
||||
.text(function(d) {
|
||||
return iD.util.friendlyName(d);
|
||||
})
|
||||
.attr('title', iD.util.tagText);
|
||||
.text(function(d) { return d.name; })
|
||||
.attr('title', function(d) { return d.tagText; });
|
||||
|
||||
li.filter(function(d) { return d.count > 1; })
|
||||
.append('span')
|
||||
.attr('class', 'count')
|
||||
.text(function(d) { return d.count; });
|
||||
}
|
||||
|
||||
return d3.rebind(commit, event, 'on');
|
||||
|
||||
Reference in New Issue
Block a user