Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
87788944
Commit
87788944
authored
Dec 28, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Jan 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Form saves dynamic content only of (editable)fields
parent
4d7695f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
26 deletions
+10
-26
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
...plateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
+8
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
...teItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
+0
-23
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
View file @
87788944
...
@@ -3,12 +3,19 @@
...
@@ -3,12 +3,19 @@
(
function
(
window
,
rJS
,
URI
,
RSVP
)
{
(
function
(
window
,
rJS
,
URI
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
/** Return local modifications to editable form fields after leaving the form
for a while - for example selecting a related object.
@argument result is possible current field value
*/
function
loadFormContent
(
gadget
,
result
)
{
function
loadFormContent
(
gadget
,
result
)
{
var
key
;
var
key
;
if
(
gadget
.
state
.
options
.
form_content
)
{
if
(
gadget
.
state
.
options
.
form_content
)
{
for
(
key
in
result
)
{
for
(
key
in
result
)
{
if
(
result
.
hasOwnProperty
(
key
))
{
if
(
result
.
hasOwnProperty
(
key
))
{
if
(
gadget
.
state
.
options
.
form_content
[
result
[
key
].
key
])
{
if
(
typeof
result
[
key
]
===
"
object
"
&&
result
[
key
].
hasOwnProperty
(
"
key
"
)
&&
gadget
.
state
.
options
.
form_content
[
result
[
key
].
key
])
{
result
[
key
].
default
=
gadget
.
state
.
options
.
form_content
[
result
[
key
].
key
];
result
[
key
].
default
=
gadget
.
state
.
options
.
form_content
[
result
[
key
].
key
];
}
}
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.js
View file @
87788944
...
@@ -3,20 +3,6 @@
...
@@ -3,20 +3,6 @@
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
function
isGoodNonEditableField
(
field
)
{
// ListBox and FormBox should always get a chance to render
if
(
field
.
type
===
"
ListBox
"
)
{
return
true
;
}
if
(
field
.
type
===
"
FormBox
"
)
{
return
true
;
}
// hidden fields should not be obviously rendered
if
(
field
.
hidden
===
1
)
{
return
false
;
}
// field without default
if
(
!
field
.
default
)
{
return
false
;
}
if
(
field
.
default
.
length
===
0
)
{
return
false
;
}
if
(
field
.
default
.
length
===
1
&&
(
!
field
.
default
[
0
]))
{
return
false
;
}
return
true
;
}
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
...
@@ -64,15 +50,6 @@
...
@@ -64,15 +50,6 @@
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
key
;
key
;
// Remove all empty or otherwise bad non-editable fields
for
(
key
in
rendered_form
)
{
if
(
rendered_form
.
hasOwnProperty
(
key
)
&&
(
key
[
0
]
!==
"
_
"
))
{
if
(
!
isGoodNonEditableField
(
rendered_form
[
key
]))
{
delete
rendered_form
[
key
];
}
}
}
form_options
.
erp5_document
=
gadget
.
state
.
erp5_document
;
form_options
.
erp5_document
=
gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
view
=
gadget
.
state
.
view
;
form_options
.
view
=
gadget
.
state
.
view
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml
View file @
87788944
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
2.35930.39344.6741
</string>
</value>
<value>
<string>
96
4.25532.35708.31044
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
07809117.8
</float>
<float>
15
14478835.97
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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