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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
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 @@
...
@@ -67,25 +67,45 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
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
,
var
i
,
erp5_document
=
options
.
erp5_document
,
erp5_document
=
this
.
state
.
erp5_document
,
form_definition
=
options
.
form_definition
,
form_definition
=
this
.
state
.
form_definition
,
rendered_form
=
erp5_document
.
_embedded
.
_view
,
rendered_form
=
erp5_document
.
_embedded
.
_view
,
group_list
=
form_definition
.
group_list
,
group_list
=
form_definition
.
group_list
,
queue
=
new
RSVP
.
Queue
(),
queue
=
new
RSVP
.
Queue
(),
form_gadget
=
this
,
form_gadget
=
this
,
suboption_dict
=
{},
parent_element
=
document
.
createElement
(
"
div
"
);
parent_element
=
document
.
createElement
(
"
div
"
);
form_gadget
.
state_parameter_dict
=
options
.
form_gadget
||
{};
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
// 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
;
form_gadget
.
props
.
gadget_list
=
[];
form_gadget
.
props
.
gadget_list
=
[];
}
function
addGroup
(
group
)
{
function
addGroup
(
group
)
{
queue
queue
...
@@ -104,11 +124,20 @@
...
@@ -104,11 +124,20 @@
sandbox
=
"
public
"
,
sandbox
=
"
public
"
,
field_element
=
document
.
createElement
(
"
div
"
),
field_element
=
document
.
createElement
(
"
div
"
),
renderered_field
=
rendered_form
[
field
[
0
]],
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
.
field_url
=
getFieldTypeGadgetUrl
(
renderered_field
.
type
);
suboptions
.
label
=
false
;
suboptions
.
label
=
false
;
suboptions
.
field_json
=
renderered_field
;
suboptions
.
field_json
=
renderered_field
;
suboptions
.
field_json
.
view
=
options
.
view
;
suboptions
.
field_json
.
view
=
form_gadget
.
state
.
view
;
if
(
group
[
0
]
!==
"
bottom
"
)
{
if
(
group
[
0
]
!==
"
bottom
"
)
{
suboptions
.
label
=
true
;
suboptions
.
label
=
true
;
...
@@ -116,13 +145,18 @@
...
@@ -116,13 +145,18 @@
return
field_queue
return
field_queue
.
push
(
function
()
{
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
return
form_gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
return
form_gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
scope
:
renderered_field
.
key
,
scope
:
renderered_field
.
key
,
element
:
field_element
,
element
:
field_element
,
sandbox
:
sandbox
sandbox
:
sandbox
});
});
}
return
form_gadget
.
getDeclaredGadget
(
renderered_field
.
key
);
})
})
.
push
(
function
(
label_gadget
)
{
.
push
(
function
(
label_gadget
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
//XXXXX Hardcoded to get one listbox gadget
//XXXXX Hardcoded to get one listbox gadget
//pt form list gadget will get this listbox's info
//pt form list gadget will get this listbox's info
//then pass to search field gadget
//then pass to search field gadget
...
@@ -130,6 +164,7 @@
...
@@ -130,6 +164,7 @@
form_gadget
.
props
.
listbox_gadget
=
label_gadget
;
form_gadget
.
props
.
listbox_gadget
=
label_gadget
;
}
}
form_gadget
.
props
.
gadget_list
.
push
(
label_gadget
);
form_gadget
.
props
.
gadget_list
.
push
(
label_gadget
);
}
return
label_gadget
.
render
(
suboptions
);
return
label_gadget
.
render
(
suboptions
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -155,19 +190,17 @@
...
@@ -155,19 +190,17 @@
return
queue
return
queue
.
push
(
function
()
{
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
var
dom_element
=
form_gadget
.
element
var
dom_element
=
form_gadget
.
element
.
querySelector
(
"
.field_container
"
);
.
querySelector
(
"
.field_container
"
);
while
(
dom_element
.
firstChild
)
{
while
(
dom_element
.
firstChild
)
{
dom_element
.
removeChild
(
dom_element
.
firstChild
);
dom_element
.
removeChild
(
dom_element
.
firstChild
);
}
}
dom_element
.
appendChild
(
parent_element
);
dom_element
.
appendChild
(
parent_element
);
// return $(parent_element).trigger("create");
}
});
});
})
})
.
declareMethod
(
"
getListboxInfo
"
,
function
()
{
.
declareMethod
(
"
getListboxInfo
"
,
function
()
{
//XXXXX get listbox gadget's info
//XXXXX get listbox gadget's info
var
gadget
=
this
;
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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
1475
681076.93
</float>
<float>
1475
762090.29
</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