Rename field function

This commit is contained in:
Bryan Housel
2016-05-25 21:46:14 -04:00
parent 669cad74f6
commit 0446275091
2 changed files with 11 additions and 9 deletions
+7 -5
View File
@@ -4,7 +4,7 @@ iD.ui.preset.localized = function(field, context) {
input, localizedInputs, wikiTitles,
entity;
function i(selection) {
function localized(selection) {
input = selection.selectAll('.localized-main')
.data([0]);
@@ -203,7 +203,7 @@ iD.ui.preset.localized = function(field, context) {
.value(function(d) { return d.value; });
}
i.tags = function(tags) {
localized.tags = function(tags) {
// Fetch translations from wikipedia
if (tags.wikipedia && !wikiTitles) {
wikiTitles = {};
@@ -228,13 +228,15 @@ iD.ui.preset.localized = function(field, context) {
localizedInputs.call(render, postfixed.reverse());
};
i.focus = function() {
localized.focus = function() {
input.node().focus();
};
i.entity = function(_) {
localized.entity = function(_) {
if (!arguments.length) return entity;
entity = _;
return localized;
};
return d3.rebind(i, dispatch, 'on');
return d3.rebind(localized, dispatch, 'on');
};
+4 -4
View File
@@ -2,7 +2,7 @@ iD.ui.preset.textarea = function(field) {
var dispatch = d3.dispatch('change'),
input;
function i(selection) {
function textarea(selection) {
input = selection.selectAll('textarea')
.data([0]);
@@ -25,13 +25,13 @@ iD.ui.preset.textarea = function(field) {
};
}
i.tags = function(tags) {
textarea.tags = function(tags) {
input.value(tags[field.key] || '');
};
i.focus = function() {
textarea.focus = function() {
input.node().focus();
};
return d3.rebind(i, dispatch, 'on');
return d3.rebind(textarea, dispatch, 'on');
};