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
Boris Kocherov
rjs_json_form
Commits
fea39d15
Commit
fea39d15
authored
Apr 24, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make code better understandable
parent
ada8e633
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
gadget_json_generated_form.js
gadget_json_generated_form.js
+10
-10
No files found.
gadget_json_generated_form.js
View file @
fea39d15
...
...
@@ -601,17 +601,17 @@
});
}
function
render_array
(
gadget
,
json_field
,
default_array
,
root
,
path
,
schema_path
)
{
function
render_array
(
gadget
,
schema
,
json_document
,
root
,
path
,
schema_path
)
{
var
queue
=
RSVP
.
Queue
(),
div
,
div_input
,
input
,
item_schema
,
i
,
maxItems
=
json_field
.
maxItems
;
maxItems
=
schema
.
maxItems
;
div
=
document
.
createElement
(
"
div
"
);
div
.
setAttribute
(
"
class
"
,
"
subfield
"
);
div
.
title
=
json_field
.
description
;
div
.
title
=
schema
.
description
;
div_input
=
document
.
createElement
(
"
div
"
);
div_input
.
setAttribute
(
"
class
"
,
"
input
"
);
...
...
@@ -622,7 +622,7 @@
}
}
item_schema
=
json_field
.
items
;
item_schema
=
schema
.
items
;
queue
.
push
(
function
()
{
return
expandSchema
(
gadget
,
item_schema
,
schema_path
+
'
/items
'
);
...
...
@@ -643,15 +643,15 @@
.
push
(
function
(
element
)
{
input
=
element
;
// XXX update on every add/delete item
input
.
hidden
=
maxItems
!==
undefined
&&
default_array
.
length
>=
maxItems
;
input
.
hidden
=
maxItems
!==
undefined
&&
json_document
.
length
>=
maxItems
;
div_input
.
appendChild
(
input
);
div
.
appendChild
(
div_input
);
root
.
appendChild
(
div
);
});
// XXX rewrite loading document for anyOf schema
if
(
default_array
)
{
for
(
i
=
0
;
i
<
default_array
.
length
;
i
=
i
+
1
)
{
if
(
json_document
)
{
for
(
i
=
0
;
i
<
json_document
.
length
;
i
=
i
+
1
)
{
queue
.
push
(
addSubForm
.
bind
(
gadget
,
{
...
...
@@ -659,14 +659,14 @@
parent_type
:
'
array
'
,
schema_path
:
schema_path
+
'
/items
'
,
schema_part
:
item_schema
,
default_dict
:
default_array
[
i
]
default_dict
:
json_document
[
i
]
})
)
.
push
(
element_append
);
}
}
// XXX add failback rendering if
default_array
not array
// input = render_textarea(
json_field
, default_value, "array");
// XXX add failback rendering if
json_document
not array
// input = render_textarea(
schema
, default_value, "array");
return
queue
;
}
...
...
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