Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
13c77d52
Commit
13c77d52
authored
Oct 06, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Rerender the existing form if possible
parent
d00a76b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
35 deletions
+68
-35
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
...thTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
+66
-33
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
...hTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
View file @
13c77d52
...
...
@@ -67,25 +67,45 @@
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
group_list
=
options
.
form_definition
.
group_list
,
rendered_form
=
options
.
erp5_document
.
_embedded
.
_view
,
i
,
j
,
hash
=
""
;
// Check the list of field to render
// If the list is different, DOM content will be dropped
// and recreated
for
(
i
=
0
;
i
<
group_list
.
length
;
i
+=
1
)
{
hash
+=
group_list
[
i
][
0
];
for
(
j
=
0
;
j
<
group_list
[
i
][
1
].
length
;
j
+=
1
)
{
if
(
rendered_form
.
hasOwnProperty
(
group_list
[
i
][
1
][
j
][
0
]))
{
hash
+=
group_list
[
i
][
1
][
j
][
0
];
}
}
}
return
this
.
changeState
({
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
hash
:
hash
,
view
:
options
.
view
});
})
.
declareMethod
(
'
updateDOM
'
,
function
(
modification_dict
)
{
var
i
,
erp5_document
=
options
.
erp5_document
,
form_definition
=
options
.
form_definition
,
erp5_document
=
this
.
state
.
erp5_document
,
form_definition
=
this
.
state
.
form_definition
,
rendered_form
=
erp5_document
.
_embedded
.
_view
,
group_list
=
form_definition
.
group_list
,
queue
=
new
RSVP
.
Queue
(),
form_gadget
=
this
,
suboption_dict
=
{},
parent_element
=
document
.
createElement
(
"
div
"
);
form_gadget
.
state_parameter_dict
=
options
.
form_gadget
||
{};
// XXX Hardcoded for searchfield - remove later!
if
(
form_definition
.
extended_search
)
{
suboption_dict
.
extended_search
=
form_definition
.
extended_search
;
}
// XXX Hardcoded for listbox's hide functionality
suboption_dict
.
hide_enabled
=
form_definition
.
hide_enabled
;
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
form_gadget
.
props
.
gadget_list
=
[];
}
function
addGroup
(
group
)
{
queue
...
...
@@ -104,11 +124,20 @@
sandbox
=
"
public
"
,
field_element
=
document
.
createElement
(
"
div
"
),
renderered_field
=
rendered_form
[
field
[
0
]],
suboptions
=
options
[
renderered_field
.
key
]
||
suboption_dict
;
// suboptions = options[renderered_field.key] || suboption_dict;
suboptions
=
{};
// XXX Hardcoded for searchfield - remove later!
if
(
form_definition
.
extended_search
)
{
suboptions
.
extended_search
=
form_definition
.
extended_search
;
}
// XXX Hardcoded for listbox's hide functionality
suboptions
.
hide_enabled
=
form_definition
.
hide_enabled
;
suboptions
.
field_url
=
getFieldTypeGadgetUrl
(
renderered_field
.
type
);
suboptions
.
label
=
false
;
suboptions
.
field_json
=
renderered_field
;
suboptions
.
field_json
.
view
=
options
.
view
;
suboptions
.
field_json
.
view
=
form_gadget
.
state
.
view
;
if
(
group
[
0
]
!==
"
bottom
"
)
{
suboptions
.
label
=
true
;
...
...
@@ -116,13 +145,18 @@
return
field_queue
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
return
form_gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
scope
:
renderered_field
.
key
,
element
:
field_element
,
sandbox
:
sandbox
});
}
return
form_gadget
.
getDeclaredGadget
(
renderered_field
.
key
);
})
.
push
(
function
(
label_gadget
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
//XXXXX Hardcoded to get one listbox gadget
//pt form list gadget will get this listbox's info
//then pass to search field gadget
...
...
@@ -130,6 +164,7 @@
form_gadget
.
props
.
listbox_gadget
=
label_gadget
;
}
form_gadget
.
props
.
gadget_list
.
push
(
label_gadget
);
}
return
label_gadget
.
render
(
suboptions
);
})
.
push
(
function
()
{
...
...
@@ -155,19 +190,17 @@
return
queue
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
var
dom_element
=
form_gadget
.
element
.
querySelector
(
"
.field_container
"
);
while
(
dom_element
.
firstChild
)
{
dom_element
.
removeChild
(
dom_element
.
firstChild
);
}
dom_element
.
appendChild
(
parent_element
);
// return $(parent_element).trigger("create");
}
});
})
.
declareMethod
(
"
getListboxInfo
"
,
function
()
{
//XXXXX get listbox gadget's info
var
gadget
=
this
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
View file @
13c77d52
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.2
4492.61471.3703
</string>
</value>
<value>
<string>
954.2
7320.12986.51029
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1475
681076.93
</float>
<float>
1475
762090.29
</float>
<string>
UTC
</string>
</tuple>
</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