resolved conflict.

This commit is contained in:
Saman Bemel-Benrud
2013-03-21 19:25:29 -04:00
9 changed files with 1909 additions and 119 deletions

View File

@@ -914,18 +914,8 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;}
.tag-wrap .grid-button-wrap .grid-entry .label {
background: #eef0ff;
}
.inspector-body .name {
padding-bottom: 0;
}
.name input.major {
padding-top: 35px;
height: 70px;
}
.inspector-body .name h4,
.preset-field h4[for*="input-"] {
border: 1px solid #cfcfcf;
padding: 5px 10px;
@@ -953,7 +943,15 @@ h4 + .preset-input input:first-child {
.preset-field h4[for="input-building:levels"],
.preset-field h4[for="input-ele"],
.preset-field.checkselect h4 {
right: 50%;}
right: 50%;
}
.preset-field-name h4 + input {
padding-top: 35px;
height: 70px;
font-size: 18px;
font-weight: bold;
}
/* adding additional preset fields */

View File

@@ -136,10 +136,7 @@ en:
no_documentation_key: There is no documentation available for this key
show_more: Show More
new_tag: New tag
edit_tags: Edit tags
okay: Okay
view_on_osm: View on OSM
name: Name
editing_feature: "Editing {feature}"
additional: Additional tags
choose: Select feature type

File diff suppressed because it is too large Load Diff

View File

@@ -76,6 +76,8 @@ en:
label: Type
maxspeed:
label: Speed Limit
name:
label: Name
natural:
label: Natural
network:

View File

@@ -196,6 +196,11 @@
"type": "combo",
"label": "Speed Limit"
},
"name": {
"key": "name",
"type": "text",
"label": "Name"
},
"natural": {
"key": "natural",
"type": "combo",

View File

@@ -0,0 +1,5 @@
{
"key": "name",
"type": "text",
"label": "Name"
}

View File

@@ -52,6 +52,10 @@ iD.presets = function(context) {
return all;
};
all.field = function(id) {
return fields[id];
};
all.universal = function() {
return universal;
};
@@ -69,6 +73,5 @@ iD.presets = function(context) {
return all;
};
return all;
};

View File

@@ -1,39 +1,25 @@
iD.ui.preset = function(context) {
iD.ui.preset = function(context, entity) {
var event = d3.dispatch('change', 'setTags', 'close'),
entity,
tags,
keys,
preset,
formwrap,
formbuttonwrap;
function input(d) {
var i = iD.ui.preset[d.type](d, context)
.on('close', event.close)
.on('change', event.change);
event.on('setTags.' + d.key || d.type, function(tags) {
i.tags(_.clone(tags));
});
if (d.type === 'address') i.entity(entity);
keys = keys.concat(d.key ? [d.key] : d.keys);
d3.select(this).call(i);
}
function presets(selection) {
selection.html('');
keys = [];
keys = [];
formwrap = selection.append('div');
var geometry = entity.geometry(context.graph());
draw(formwrap, preset.fields.filter(function(f) {
return f.matchGeometry(geometry);
}));
var geometry = entity.geometry(context.graph()),
fields = preset.fields.filter(function(f) {
return f.matchGeometry(geometry);
});
fields.unshift(context.presets().field('name'));
draw(formwrap, fields);
var wrap = selection.append('div')
.attr('class', 'col12 more-buttons inspector-inner');
@@ -45,32 +31,31 @@ iD.ui.preset = function(context) {
.data(context.presets().universal().filter(notInForm))
.enter()
.append('button')
.attr('class', 'preset-add-field')
.on('click', addForm)
.each(tooltip)
.append('span')
.attr('class', function(d) { return 'icon ' + d.icon; });
.attr('class', 'preset-add-field')
.on('click', addForm)
.call(bootstrap.tooltip()
.placement('top')
.title(function(d) { return d.label(); }))
.append('span')
.attr('class', function(d) { return 'icon ' + d.icon; });
function notInForm(p) {
return preset.fields.indexOf(p) < 0;
}
function tooltip(d) {
d3.select(this).call(bootstrap.tooltip()
.placement('top')
.title(d.label()));
}
function addForm(d) {
draw(formwrap, [d]);
d3.select(this)
.style('opacity', 1)
.transition().style('opacity', 0).each('end', function() {
d3.select(this).remove();
});
if (!wrap.selectAll('button').node()) wrap.remove();
}
.transition()
.style('opacity', 0)
.remove();
if (!wrap.selectAll('button').node()) {
wrap.remove();
}
}
}
function draw(selection, fields) {
@@ -87,9 +72,24 @@ iD.ui.preset = function(context) {
.attr('for', function(d) { return 'input-' + d.key; })
.text(function(d) { return d.label(); });
sections.transition().style('opacity', 1);
sections.transition()
.style('opacity', 1);
sections.each(input);
sections.each(function(field) {
var i = iD.ui.preset[field.type](field, context)
.on('close', event.close)
.on('change', event.change);
event.on('setTags.' + field.key || field.type, function (tags) {
i.tags(_.clone(tags));
});
if (field.type === 'address') i.entity(entity);
keys = keys.concat(field.key ? [field.key] : field.keys);
d3.select(this).call(i);
});
}
presets.rendered = function() {
@@ -126,11 +126,5 @@ iD.ui.preset = function(context) {
return presets;
};
presets.entity = function(_) {
if (!arguments.length) return entity;
entity = _;
return presets;
};
return d3.rebind(presets, event, 'on');
};

View File

@@ -2,14 +2,12 @@ iD.ui.TagEditor = function(context, entity) {
var event = d3.dispatch('changeTags', 'choose', 'close'),
presets = context.presets(),
tags,
name,
preset,
selection_,
presetUI,
tagList;
function tageditor(selection, newpreset) {
selection_ = selection;
var geometry = entity.geometry(context.graph());
@@ -17,7 +15,6 @@ iD.ui.TagEditor = function(context, entity) {
// preset was explicitly chosen
if (newpreset) {
tags = preset.removeTags(tags, geometry);
newpreset.applyTags(tags, geometry);
@@ -35,12 +32,12 @@ iD.ui.TagEditor = function(context, entity) {
event.choose(preset);
});
var fallbackIcon = geometry === 'line' ? 'other-line' : 'marker-stroked';
var icon = preset.icon || (geometry === 'line' ? 'other-line' : 'marker-stroked');
back.append('div')
.attr('class', 'col12')
.append('span')
.attr('class', 'preset-icon icon' + (preset ? ' feature-' + (preset.icon || fallbackIcon) : ''));
.attr('class', 'preset-icon icon feature-' + icon);
back.append('div')
.attr('class', 'col12')
@@ -58,25 +55,10 @@ iD.ui.TagEditor = function(context, entity) {
.attr('class', 'icon close');
var editorwrap = selection.append('div')
.attr('class', 'tag-wrap inspector-body fillL2 inspector-body-' + entity.geometry(context.graph()));
.attr('class', 'tag-wrap inspector-body fillL2 inspector-body-' + geometry);
var namewrap = editorwrap.append('div')
.attr('class', 'name fillL inspector-inner col12');
namewrap.append('h4')
.text(t('inspector.name'));
name = namewrap.append('input')
.attr('placeholder', 'unknown')
.attr('class', 'major')
.attr('type', 'text')
.property('value', entity.tags.name || '')
.on('blur', function() {
changeTags({ name: name.property('value') });
});
presetUI = iD.ui.preset(context)
.entity(entity)
presetUI = iD.ui.preset(context, entity)
.preset(preset)
.on('change', changeTags)
.on('close', event.close);
@@ -84,25 +66,20 @@ iD.ui.TagEditor = function(context, entity) {
.on('change', changeTags);
var tageditorpreset = editorwrap.append('div')
.attr('class', 'inspector-preset cf fillL col12');
if (preset) {
tageditorpreset.call(presetUI
.preset(preset));
}
.attr('class', 'inspector-preset cf fillL col12')
.call(presetUI);
editorwrap.append('div')
.attr('class','inspector-inner col12 fillL2 additional-tags')
.attr('class', 'inspector-inner col12 fillL2 additional-tags')
.call(tagList, preset.id === 'other');
// Don't add for created entities
if (entity.osmId() > 0) {
if (!entity.isNew()) {
tageditorpreset.append('div')
.attr('class','inspector-inner')
.attr('class', 'view-on-osm')
.append('a')
.attr('href', 'http://www.openstreetmap.org/browse/' + entity.type + '/' + entity.osmId())
.attr('target', '_blank')
.text(t('inspector.view_on_osm'));
.attr('href', 'http://www.openstreetmap.org/browse/' + entity.type + '/' + entity.osmId())
.attr('target', '_blank')
.text(t('inspector.view_on_osm'));
}
tageditor.tags(tags);
@@ -134,9 +111,8 @@ iD.ui.TagEditor = function(context, entity) {
return tageditor(selection_, newmatch);
}
name.property('value', tags.name || '');
presetUI.change(tags);
var rendered = ['name']
var rendered = []
.concat(Object.keys(preset.tags))
.concat(presetUI.rendered());
tagList.tags(_.omit(tags, rendered));