add 'modified' class to fields with changed values

This commit is contained in:
Ansis Brammanis
2013-03-21 16:19:37 -04:00
parent 22f43b810b
commit 88ae05f5b4
4 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -327,7 +327,7 @@
},
"structure": {
"type": "radio",
"options": [
"keys": [
"bridge",
"tunnel",
"embankment",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"type": "radio",
"options": [
"keys": [
"bridge",
"tunnel",
"embankment",
+8
View File
@@ -114,6 +114,14 @@ iD.ui.preset = function(context) {
}
});
formwrap.selectAll('div.preset-field')
.classed('modified', function(d) {
var original = context.graph().base().entities[entity.id];
return _.any(d.keys || [d.key], function(key) {
return original ? tags[key] !== original.tags[key] : tags[key];
});
});
event.setTags(tags);
return presets;
};
+1 -1
View File
@@ -9,7 +9,7 @@ iD.ui.preset.radio = function(field) {
var buttonwrap = selection.append('div').attr('class','radio-wrap');
buttons = buttonwrap.selectAll('button')
.data(field.options)
.data(field.keys || field.options)
.enter()
.append('button')
.text(function(d) { return field.t('options.' + d, { 'default': d }); })