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
1
Issues
1
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
Roque
erp5
Commits
28ede9e2
Commit
28ede9e2
authored
Apr 17, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: action code move to configuration side (WIP)
- test fix
parent
ad421ed4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
57 deletions
+9
-57
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+7
-55
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
...web_page_module/gadget_officejs_page_handle_action_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
28ede9e2
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
var
gadget
=
this
,
var
gadget
=
this
,
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
portal_type
,
parent_portal_type
,
portal_type
,
parent_portal_type
,
parent_relative_url
,
form_definition
,
custom
_code
;
parent_relative_url
,
form_definition
,
action
_code
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
gadget
.
getUrlParameter
(
"
parent_portal_type
"
),
gadget
.
getUrlParameter
(
"
parent_portal_type
"
),
gadget
.
getUrlParameter
(
"
parent_relative_url
"
),
gadget
.
getUrlParameter
(
"
parent_relative_url
"
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
parent_portal_type
'
),
gadget
.
getSetting
(
'
parent_portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
)
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
)
]);
]);
})
})
...
@@ -58,8 +58,8 @@
...
@@ -58,8 +58,8 @@
// custom code will come from configuration side (action form)
// custom code will come from configuration side (action form)
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
custom
_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
action
_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
eval
(
custom
_code
[
0
]);
eval
(
action
_code
[
0
]);
}
}
}
}
return
gadget_utils
.
createDocument
(
options
);
return
gadget_utils
.
createDocument
(
options
);
...
@@ -89,29 +89,10 @@
...
@@ -89,29 +89,10 @@
// custom code will come from configuration side (action form)
// custom code will come from configuration side (action form)
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
custom_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
action_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
// move this to form configuration
custom_code
=
[
"
return gadget.jio_get(options.jio_key)
\
.push(function (result) {
\
parent_document = result;
\
var title = parent_document.title;
\
if (!title.startsWith('Re: ')) { title = 'Re: ' + parent_document.title; }
\
console.log(title);
\
return gadget.changeState({
\
doc: {title: title},
\
submit_code: submit_code,
\
parent_document: parent_document,
\
child_gadget_url: child_gadget_url,
\
form_definition: form_definition,
\
view: action_reference,
\
editable: true,
\
has_more_views: false,
\
has_more_actions: false,
\
is_form_list: false
\
}); });
"
,
"
console.log('some submit code')
"
];
return
window
.
eval
.
call
(
window
,
'
(function (gadget, options, action_reference, form_definition, child_gadget_url, submit_code)
\
return
window
.
eval
.
call
(
window
,
'
(function (gadget, options, action_reference, form_definition, child_gadget_url, submit_code)
\
{
'
+
custom
_code
[
0
]
+
'
})
'
)
{
'
+
action
_code
[
0
]
+
'
})
'
)
(
gadget
,
options
,
action_reference
,
form_definition
,
child_gadget_url
,
custom
_code
[
1
]);
(
gadget
,
options
,
action_reference
,
form_definition
,
child_gadget_url
,
action
_code
[
1
]);
}
}
}
}
});
});
...
@@ -143,35 +124,6 @@
...
@@ -143,35 +124,6 @@
if
(
action_reference
===
"
reply
"
)
{
if
(
action_reference
===
"
reply
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
var
submit_code
=
gadget
.
state
.
submit_code
;
var
submit_code
=
gadget
.
state
.
submit_code
;
// move this to form configuration
submit_code
=
"
var document = {
\
my_title: gadget.state.doc.title,
\
portal_type: gadget.state.parent_document.portal_type,
\
parent_relative_url: gadget.state.parent_document.parent_relative_url,
\
my_source_reference: gadget.state.parent_document.source_reference
\
}, property;
\
for (property in content_dict) {
\
if (content_dict.hasOwnProperty(property)) {
\
document['my_' + property] = content_dict[property];
\
}
\
}
\
return gadget_utils.createDocument(document)
\
.push(function (id) {
\
jio_key = id;
\
return gadget.notifySubmitting();
\
})
\
.push(function () {
\
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
\
})
\
.push(function () {
\
return gadget.redirect({
\
command: 'display',
\
options: {
\
jio_key: jio_key,
\
editable: true
\
}
\
});
\
});
"
;
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, content_dict)
\
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, content_dict)
\
{
'
+
submit_code
+
'
})
'
)(
gadget
,
gadget_utils
,
content_dict
);
{
'
+
submit_code
+
'
})
'
)(
gadget
,
gadget_utils
,
content_dict
);
}
}
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
28ede9e2
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
5092.42049.34269
</string>
</value>
<value>
<string>
975.
6084.56587.64580
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1555
447984.11
</float>
<float>
1555
507949.33
</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