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
f785a2aa
Commit
f785a2aa
authored
Jun 06, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make compatible with gadget api
parent
d99d9f2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
gadget_json_generated_form.js
gadget_json_generated_form.js
+28
-1
No files found.
gadget_json_generated_form.js
View file @
f785a2aa
...
@@ -498,6 +498,15 @@
...
@@ -498,6 +498,15 @@
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
key
:
options
.
key
,
value
:
options
.
value
||
""
,
schema
:
options
.
schema
,
schema_url
:
options
.
schema_url
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
});
})
.
onStateChange
(
function
(
options
)
{
var
g
=
this
;
var
g
=
this
;
g
.
props
.
toplevel
=
true
;
g
.
props
.
toplevel
=
true
;
// contain map of current normalized schema
// contain map of current normalized schema
...
@@ -586,7 +595,25 @@
...
@@ -586,7 +595,25 @@
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
return
this
.
props
.
form_gadget
.
getContent
();
var
g
=
this
;
if
(
g
.
state
.
editable
)
{
return
g
.
props
.
form_gadget
.
getContent
()
.
push
(
function
(
value
)
{
// Change the value state in place
// This will prevent the gadget to be changed if
// its parent call render with the same value
// (as ERP5 does in case of formulator error)
g
.
state
.
value
=
value
;
if
(
g
.
state
.
key
)
{
var
form_data
=
{};
value
=
JSON
.
stringify
(
value
);
form_data
[
g
.
state
.
key
]
=
value
;
return
form_data
;
}
return
value
;
});
}
return
{};
});
});
}(
window
,
document
,
location
,
rJS
,
RSVP
,
jIO
,
tv4
));
}(
window
,
document
,
location
,
rJS
,
RSVP
,
jIO
,
tv4
));
\ No newline at end of file
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