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
0a710f86
Commit
0a710f86
authored
Oct 08, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change code order for better understanding
parent
92e64283
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
50 deletions
+49
-50
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+49
-50
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
0a710f86
...
...
@@ -921,55 +921,7 @@
typeof
json_document
!==
type
;
}
div
=
document
.
createElement
(
"
div
"
);
div
.
setAttribute
(
"
class
"
,
"
jsonformfield ui-field-contain
"
);
if
(
schema
.
description
)
{
div
.
title
=
schema
.
description
;
}
// if (property_name && !first_path) {
if
(
options
.
delete_button
===
true
)
{
delete_button
=
createElement
(
"
span
"
,
{
"
class
"
:
"
ui-btn-icon-top ui-icon-trash-o
"
}
);
gadget
.
props
.
delete_button
=
delete_button
;
div
.
appendChild
(
delete_button
);
}
else
if
(
options
.
top
!==
true
)
{
if
(
options
.
required
)
{
delete_button
=
createElement
(
"
span
"
,
{
"
class
"
:
"
ui-btn-icon-top ui-icon-circle
"
}
);
div
.
appendChild
(
delete_button
);
}
else
{
delete_button
=
createElement
(
"
span
"
);
delete_button
.
innerHTML
=
"
 
"
;
div
.
appendChild
(
delete_button
);
}
}
label_text
=
[
property_name
,
schema_ob
.
title
]
.
filter
(
function
(
v
)
{
return
v
;
})
.
join
(
"
"
)
// use non-breaking hyphen
.
replace
(
/-/g
,
"
‑
"
);
if
(
property_name
||
options
.
top
)
{
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
.
setAttribute
(
"
id
"
,
gadget
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
first_path
+
'
/
'
);
div_input
.
setAttribute
(
"
class
"
,
"
input
"
);
// render input begin
if
(
!
input
&&
schema_arr
[
0
].
is_arr_of_const
&&
schema_arr
.
length
>
1
)
{
input
=
render_enum_with_title
(
gadget
,
schema_arr
,
json_document
,
options
.
selected_schema
);
}
...
...
@@ -1061,6 +1013,54 @@
}
}
}
// render input end
// html layout render begin
div
=
document
.
createElement
(
"
div
"
);
div
.
setAttribute
(
"
class
"
,
"
jsonformfield ui-field-contain
"
);
if
(
schema
.
description
)
{
div
.
title
=
schema
.
description
;
}
// if (property_name && !first_path) {
if
(
options
.
delete_button
===
true
)
{
delete_button
=
createElement
(
"
span
"
,
{
"
class
"
:
"
ui-btn-icon-top ui-icon-trash-o
"
}
);
gadget
.
props
.
delete_button
=
delete_button
;
div
.
appendChild
(
delete_button
);
}
else
if
(
options
.
top
!==
true
)
{
if
(
options
.
required
)
{
delete_button
=
createElement
(
"
span
"
,
{
"
class
"
:
"
ui-btn-icon-top ui-icon-circle
"
}
);
div
.
appendChild
(
delete_button
);
}
else
{
delete_button
=
createElement
(
"
span
"
);
delete_button
.
innerHTML
=
"
 
"
;
div
.
appendChild
(
delete_button
);
}
}
label_text
=
[
property_name
,
schema_ob
.
title
]
.
filter
(
function
(
v
)
{
return
v
;
})
.
join
(
"
"
)
// use non-breaking hyphen
.
replace
(
/-/g
,
"
‑
"
);
if
(
property_name
||
options
.
top
)
{
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
.
setAttribute
(
"
id
"
,
gadget
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
first_path
+
'
/
'
);
div_input
.
setAttribute
(
"
class
"
,
"
input
"
);
if
(
!
input
&&
type
===
"
array
"
)
{
queue
=
render_array
(
...
...
@@ -1104,8 +1104,6 @@
div
.
setAttribute
(
"
data-json-type
"
,
type
);
}
// render input end
if
(
schema
.
info
!==
undefined
)
{
span_info
=
document
.
createElement
(
"
span
"
);
span_info
.
textContent
=
schema
.
info
;
...
...
@@ -1116,6 +1114,7 @@
error_message
.
hidden
=
true
;
div_input
.
appendChild
(
error_message
);
div
.
appendChild
(
div_input
);
// html layout render end
return
queue
.
push
(
function
()
{
...
...
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