Commit f6fb8ee4 authored by Boris Kocherov's avatar Boris Kocherov

fix jslint

parent 1d9d6f60
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
(function (window, document, rJS, RSVP) { (function (window, document, rJS, RSVP) {
"use strict"; "use strict";
var render_object;
function decodeJsonPointer(_str) { function decodeJsonPointer(_str) {
// https://tools.ietf.org/html/rfc6901#section-5 // https://tools.ietf.org/html/rfc6901#section-5
...@@ -321,7 +322,7 @@ ...@@ -321,7 +322,7 @@
}); });
} }
function render_object(g, json_field, default_dict, root, path) { render_object = function (g, json_field, default_dict, root, path) {
var additionalProperties, var additionalProperties,
key, key,
required = json_field.required || [], required = json_field.required || [],
...@@ -511,7 +512,7 @@ ...@@ -511,7 +512,7 @@
} }
} }
return queue; return queue;
} };
function getFormValuesAsJSONDict(g) { function getFormValuesAsJSONDict(g) {
var multi_level_dict = {"": {}}, var multi_level_dict = {"": {}},
...@@ -656,23 +657,23 @@ ...@@ -656,23 +657,23 @@
}) })
.declareAcquiredMethod("renameChildrenParent", "renameChildren") .declareAcquiredMethod("renameChildrenParent", "renameChildren")
.allowPublicAcquisition("renameChildren", function (opt) { .allowPublicAcquisition("renameChildren", function (opt_arr, scope) {
var property_name, var property_name,
objects = this.props.objects, objects = this.props.objects,
options = opt[0], // TODO strange rjs behavior new_name = opt_arr[0],
element = getSubGadgetElement(this, options.scope), element = getSubGadgetElement(this, scope),
parent = element.getAttribute('data-json-parent'); parent = element.getAttribute('data-json-parent');
if (objects.hasOwnProperty(parent)) { if (objects.hasOwnProperty(parent)) {
parent = objects[parent]; parent = objects[parent];
if (parent.hasOwnProperty(options.new_name)) { if (parent.hasOwnProperty(new_name)) {
throw new Error("property already exist"); throw new Error("property already exist");
} }
// XXX validate property if property pattern // XXX validate property if property pattern
for (property_name in parent) { for (property_name in parent) {
if (parent.hasOwnProperty(property_name) && parent[property_name] === options.scope) { if (parent.hasOwnProperty(property_name) && parent[property_name] === scope) {
delete parent[property_name]; delete parent[property_name];
parent[options.new_name] = options.scope; parent[new_name] = scope;
return options.new_name; return new_name;
} }
} }
throw new Error("gadget not found for renaming"); throw new Error("gadget not found for renaming");
...@@ -681,12 +682,7 @@ ...@@ -681,12 +682,7 @@
.declareMethod("rename", function (new_name, event) { .declareMethod("rename", function (new_name, event) {
var g = this, var g = this,
name = g.element.getAttribute('data-json-property-name'); name = g.element.getAttribute('data-json-property-name');
return this.renameChildrenParent({ return this.renameChildrenParent(new_name)
scope: g.element.getAttribute('data-gadget-scope'),
// parent: g.element.getAttribute('data-json-parent'),
// name: g.element.getAttribute('data-json-property-name'),
new_name: new_name
})
.push(function () { .push(function () {
return g.element.setAttribute('data-json-property-name', new_name); return g.element.setAttribute('data-json-property-name', new_name);
}) })
...@@ -793,6 +789,7 @@ ...@@ -793,6 +789,7 @@
}) })
.allowPublicAcquisition("notifyValid", function (arr, sub_scope) { .allowPublicAcquisition("notifyValid", function (arr, sub_scope) {
return true;
}) })
.allowPublicAcquisition("notifyChange", function (arr, sub_scope) { .allowPublicAcquisition("notifyChange", function (arr, sub_scope) {
var g = this, var g = this,
......
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