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
138
Merge Requests
138
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
c77f68fc
Commit
c77f68fc
authored
May 07, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: turning custom code into generic
parent
39043dbc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
19 deletions
+26
-19
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+15
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
...eItem/web_page_module/gadget_officejs_common_utils_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
...web_page_module/gadget_officejs_erp5_page_post_list_js.js
+7
-14
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.xml
...eb_page_module/gadget_officejs_erp5_page_post_list_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
View file @
c77f68fc
...
...
@@ -43,11 +43,13 @@
return
gadget
.
jio_post
(
doc
);
})
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
)
{
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
,
extra_params
)
{
var
gadget
=
this
,
parent
=
"
portal_types/
"
+
portal_type
,
query
=
'
portal_type: "Action Information" AND reference: "
'
+
action_reference
+
'
" AND parent_relative_url: "
'
+
parent
+
'
"
'
,
action_type
,
action_title
;
//TODO: check all actions to set has_more_views and has_more_actions flags in form def
//also check if there is a "new" action for object_list.action_info
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
data
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
...
...
@@ -63,6 +65,18 @@
.
push
(
function
(
form_result
)
{
form_result
.
form_definition
.
action_type
=
action_type
;
form_result
.
form_definition
.
title
=
action_title
;
if
(
action_type
===
"
object_list
"
)
{
//TODO: get child_portal_type from form_definition (listbox->portal_type).
var
child_portal_type
=
"
HTML Post
"
,
action_info
=
{
page
:
"
handle_action
"
,
action
:
"
new
"
,
portal_type
:
child_portal_type
,
parent_portal_type
:
portal_type
,
my_source_reference
:
extra_params
.
source_reference
};
form_result
.
form_definition
.
_links
.
action_object_new_content_action
=
action_info
;
}
return
form_result
.
form_definition
;
});
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
View file @
c77f68fc
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
23763.60402.39680
</string>
</value>
<value>
<string>
975.
35539.1795.20002
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
155
6568356.85
</float>
<float>
155
7188582.39
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
View file @
c77f68fc
...
...
@@ -22,15 +22,8 @@
default_view
=
"
jio_view
"
,
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
child_gadget_url
=
'
gadget_erp5_pt_form_list.html
'
,
//HARDCODED NEW ACTION INFORMATION - TODO: get like in action_offline gadget (refactor/reuse code)
fake_thread_uid
=
"
thread-
"
+
(
"
0000
"
+
((
Math
.
random
()
*
Math
.
pow
(
36
,
4
))
|
0
).
toString
(
36
)).
slice
(
-
4
),
action_info
=
{
page
:
"
handle_action
"
,
action
:
"
new
"
,
portal_type
:
"
HTML Post
"
,
parent_portal_type
:
"
Post Module
"
,
my_source_reference
:
fake_thread_uid
};
//In a future, the post list will be within a thread. For now:
fake_thread_uid
=
"
thread-
"
+
(
"
0000
"
+
((
Math
.
random
()
*
Math
.
pow
(
36
,
4
))
|
0
).
toString
(
36
)).
slice
(
-
4
);
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
...
...
@@ -39,21 +32,21 @@
]);
})
.
push
(
function
(
result
)
{
return
result
[
1
].
getFormDefinition
(
result
[
0
],
default_view
);
return
result
[
1
].
getFormDefinition
(
result
[
0
],
default_view
,
{
source_reference
:
fake_thread_uid
}
);
})
.
push
(
function
(
form_definition
)
{
//HARDCODED ACTION INFORMATION
form_definition
.
_links
.
action_object_new_content_action
=
action_info
;
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
//TODO child_gadget_url should be decided in utils.getFormDefinition based on form type
child_gadget_url
:
child_gadget_url
,
form_definition
:
form_definition
,
form_type
:
'
list
'
,
editable
:
false
,
view
:
default_view
,
front_page
:
true
,
has_more_views
:
false
,
//this should come from form_def
has_more_actions
:
false
//this should come from form_def
//TODO: get following 2 values from form_def in utils.getFormDefinition
has_more_views
:
false
,
has_more_actions
:
false
});
});
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.xml
View file @
c77f68fc
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.35
049.45064.43076
</string>
</value>
<value>
<string>
975.35
544.63874.25224
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15571
58988.51
</float>
<float>
15571
88776.18
</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