Commit 8ec4ff25 authored by Boris Kocherov's avatar Boris Kocherov

cleanup rename not used code related to property rename feature

parent 3a2763c5
...@@ -861,12 +861,7 @@ ...@@ -861,12 +861,7 @@
div.appendChild(delete_button); div.appendChild(delete_button);
} }
} }
if (false) {
// XXX;
label = document.createElement("input");
label.value = key;
gadget.props.property_name_edit = label;
} else {
label_text = [key, json_field.title] label_text = [key, json_field.title]
.filter(function (v) { return v; }) .filter(function (v) { return v; })
.join(" ") .join(" ")
...@@ -884,7 +879,7 @@ ...@@ -884,7 +879,7 @@
} }
} }
}
div_input = document.createElement("div"); div_input = document.createElement("div");
div_input.setAttribute("id", gadget.element.getAttribute("data-gadget-scope") + first_path + '/'); div_input.setAttribute("id", gadget.element.getAttribute("data-gadget-scope") + first_path + '/');
div_input.setAttribute("class", "input"); div_input.setAttribute("class", "input");
...@@ -1603,42 +1598,6 @@ ...@@ -1603,42 +1598,6 @@
g.options = {}; g.options = {};
}) })
.declareAcquiredMethod("rootNotifyChange", "rootNotifyChange") .declareAcquiredMethod("rootNotifyChange", "rootNotifyChange")
.declareAcquiredMethod("renameChildrenParent", "renameChildren")
.allowPublicAcquisition("renameChildren", function (opt_arr, scope) {
var property_name,
objects = this.props.objects,
new_name = opt_arr[0],
element = getSubGadgetElement(this, scope),
parent = element.getAttribute('data-json-parent');
if (objects.hasOwnProperty(parent)) {
parent = objects[parent];
if (parent.hasOwnProperty(new_name)) {
throw new Error("property already exist");
}
// XXX validate property if property pattern
for (property_name in parent) {
if (parent.hasOwnProperty(property_name) && parent[property_name] === scope) {
delete parent[property_name];
parent[new_name] = scope;
return new_name;
}
}
throw new Error("gadget not found for renaming");
}
})
.declareMethod("rename", function (new_name, event) {
var g = this,
name = g.element.getAttribute('data-json-property-name');
return this.renameChildrenParent(new_name)
.push(function () {
return g.element.setAttribute('data-json-property-name', new_name);
})
.push(undefined, function () {
// XXX notify user
event.srcElement.value = name;
event.srcElement.focus();
});
})
.declareAcquiredMethod("selfRemove", "deleteChildren") .declareAcquiredMethod("selfRemove", "deleteChildren")
.allowPublicAcquisition("deleteChildren", function (arr, scope) { .allowPublicAcquisition("deleteChildren", function (arr, scope) {
var g = this, var g = this,
...@@ -1860,10 +1819,6 @@ ...@@ -1860,10 +1819,6 @@
}) })
.onEvent('input', function (evt) { .onEvent('input', function (evt) {
if (evt.target === this.props.property_name_edit) {
return this.rename(this.props.property_name_edit.value, evt);
}
var gadget = this, var gadget = this,
field_list = this.props.inputs, field_list = this.props.inputs,
i, i,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment