Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
rjs_json_form
Commits
8ec4ff25
Commit
8ec4ff25
authored
Sep 06, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup rename not used code related to property rename feature
parent
3a2763c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
62 deletions
+17
-62
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+17
-62
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
8ec4ff25
...
@@ -861,30 +861,25 @@
...
@@ -861,30 +861,25 @@
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
]
.
filter
(
function
(
v
)
{
return
v
;
})
.
join
(
"
"
)
// use non-breaking hyphen
.
replace
(
/-/g
,
"
‑
"
);
if
(
label_text
)
{
if
(
options
.
top
)
{
label
=
document
.
createElement
(
"
span
"
);
label
.
textContent
=
label_text
;
root
.
appendChild
(
label
);
}
else
{
label
=
document
.
createElement
(
"
label
"
);
label
.
textContent
=
label_text
;
div
.
appendChild
(
label
);
}
label_text
=
[
key
,
json_field
.
title
]
.
filter
(
function
(
v
)
{
return
v
;
})
.
join
(
"
"
)
// use non-breaking hyphen
.
replace
(
/-/g
,
"
‑
"
);
if
(
label_text
)
{
if
(
options
.
top
)
{
label
=
document
.
createElement
(
"
span
"
);
label
.
textContent
=
label_text
;
root
.
appendChild
(
label
);
}
else
{
label
=
document
.
createElement
(
"
label
"
);
label
.
textContent
=
label_text
;
div
.
appendChild
(
label
);
}
}
}
}
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
"
);
...
@@ -1374,7 +1369,7 @@
...
@@ -1374,7 +1369,7 @@
schema_path
+
'
/patternProperties/
'
+
key
,
schema_path
+
'
/patternProperties/
'
+
key
,
used_properties
,
used_properties
,
element_append
element_append
))
))
.
push
(
root_append
);
.
push
(
root_append
);
}
}
}
}
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment