add reset button to modified fields

this button only appears if a field's value
differs from the original osm value. Resetting
changes the value and adds a history entry.
It does not undo history.
This commit is contained in:
Ansis Brammanis
2013-03-21 21:33:24 -04:00
parent d57ad41256
commit 7ef2e65c4d
2 changed files with 23 additions and 1 deletions
+12
View File
@@ -918,6 +918,18 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;}
background: #eef0ff;
}
.preset-field h4 .modified-icon {
opacity: 0.2;
display: none;
pointer-events: all;
}
.preset-field h4 .modified-icon:hover {
opacity: 0.5;
}
.preset-field.modified h4 .modified-icon {
display: inline-block;
}
.preset-field h4[for*="input-"] {
border: 1px solid #cfcfcf;
padding: 5px 10px;
+11 -1
View File
@@ -70,7 +70,17 @@ iD.ui.preset = function(context, entity) {
sections.append('h4')
.attr('for', function(d) { return 'input-' + d.key; })
.text(function(d) { return d.label(); });
.text(function(d) { return d.label(); })
.append('button')
.attr('class', 'fr icon undo modified-icon')
.on('click', function(d) {
var original = context.graph().base().entities[entity.id];
var t = {};
(d.keys || [d.key]).forEach(function(key) {
t[key] = original ? original.tags[key] : undefined;
});
event.change(t);
});
sections.transition()
.style('opacity', 1);