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
ac03cab9
Commit
ac03cab9
authored
Aug 24, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add saveOrigValue option for render()
now it's useful only for tests
parent
35492a16
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
jsonform.gadget.js
jsonform.gadget.js
+2
-0
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+15
-0
test/jsonform_test.js
test/jsonform_test.js
+2
-1
No files found.
jsonform.gadget.js
View file @
ac03cab9
...
...
@@ -599,6 +599,7 @@
key
:
options
.
key
,
value
:
JSON
.
stringify
(
options
.
value
)
||
'
""
'
,
schema
:
JSON
.
stringify
(
options
.
schema
),
saveOrigValue
:
options
.
saveOrigValue
,
schema_url
:
options
.
schema_url
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
});
...
...
@@ -677,6 +678,7 @@
schema
:
schema
,
schema_path
:
""
,
document
:
json_document
,
saveOrigValue
:
g
.
state
.
saveOrigValue
,
required
:
true
,
top
:
true
});
...
...
jsonform/gadget_json_generated_form_child.js
View file @
ac03cab9
...
...
@@ -274,6 +274,7 @@
schema_path
:
options
.
schema_path
,
document
:
options
.
default_dict
,
display_label
:
options
.
parent_type
!==
"
array
"
,
saveOrigValue
:
g
.
props
.
saveOrigValue
,
scope
:
scope
})
.
push
(
function
()
{
...
...
@@ -720,6 +721,19 @@
if
(
getDocumentType
(
json_field
.
type
)
===
"
string
"
)
{
type
=
json_field
.
type
;
}
// else json_field.type is array so we use type
if
([
"
object
"
,
"
array
"
].
indexOf
(
type
)
>=
0
&&
default_value
!==
undefined
&&
getDocumentType
(
default_value
)
!==
type
)
{
if
(
gadget
.
props
.
saveOrigValue
)
{
// XXX is not useful for user
// only for tests
json_field
=
{
const
:
default_value
};
}
else
{
gadget
.
props
.
changed
=
true
;
}
}
if
(
type
===
undefined
&&
default_value
!==
undefined
)
{
type
=
getDocumentType
(
default_value
);
}
...
...
@@ -1617,6 +1631,7 @@
schema
=
options
.
schema
,
root
;
g
.
props
.
change
=
false
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_custom_data
=
{};
...
...
test/jsonform_test.js
View file @
ac03cab9
...
...
@@ -178,7 +178,8 @@
.
push
(
function
(
g
)
{
var
opt
=
{
key
:
key
,
value
:
value
value
:
value
,
saveOrigValue
:
true
};
gadget
=
g
;
if
(
schema
!==
undefined
)
{
...
...
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