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
776fe66e
Commit
776fe66e
authored
May 09, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: refactoring - moving code to utils gadget
parent
67c7345e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
65 deletions
+47
-65
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+24
-0
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_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+8
-30
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+9
-29
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_common_utils_js.js
View file @
776fe66e
...
@@ -27,6 +27,30 @@
...
@@ -27,6 +27,30 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getFormInfo
"
,
function
(
form_definition
)
{
var
child_gadget_url
,
form_type
,
action_category
=
form_definition
.
action_type
;
switch
(
action_category
)
{
case
'
object_list
'
:
form_type
=
'
list
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_list.html
'
;
break
;
case
'
object_dialog
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
case
'
object_jio_js_script
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
default
:
form_type
=
'
page
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
}
return
[
form_type
,
child_gadget_url
];
})
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
doc
=
{
doc
=
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
View file @
776fe66e
...
@@ -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.396
69.47531.23961
</string>
</value>
<value>
<string>
975.396
73.49091.10956
</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>
1557436
424.93
</float>
<float>
1557436
563.26
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
View file @
776fe66e
...
@@ -3,31 +3,6 @@
...
@@ -3,31 +3,6 @@
(
function
(
window
,
rJS
,
document
)
{
(
function
(
window
,
rJS
,
document
)
{
"
use strict
"
;
"
use strict
"
;
// TODO: move this to common utils
function
getFormInfo
(
form_definition
)
{
var
child_gadget_url
,
form_type
,
action_category
=
form_definition
.
action_type
;
switch
(
action_category
)
{
case
'
object_list
'
:
form_type
=
'
list
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_list.html
'
;
break
;
case
'
object_dialog
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
case
'
object_jio_js_script
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
default
:
form_type
=
'
page
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
}
return
[
form_type
,
child_gadget_url
];
}
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -54,6 +29,7 @@
...
@@ -54,6 +29,7 @@
var
gadget
=
this
,
var
gadget
=
this
,
default_view
=
"
jio_view
"
,
default_view
=
"
jio_view
"
,
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
form_definition
,
gadget_utils
,
gadget_utils
,
jio_document
,
jio_document
,
portal_type
,
portal_type
,
...
@@ -83,9 +59,12 @@
...
@@ -83,9 +59,12 @@
front_page
=
portal_type
===
parent_portal_type
;
front_page
=
portal_type
===
parent_portal_type
;
return
gadget_utils
.
getFormDefinition
(
portal_type
,
default_view
);
return
gadget_utils
.
getFormDefinition
(
portal_type
,
default_view
);
})
})
.
push
(
function
(
form_definition
)
{
.
push
(
function
(
result
)
{
var
form_info
=
getFormInfo
(
form_definition
),
form_definition
=
result
;
form_type
=
form_info
[
0
],
return
gadget_utils
.
getFormInfo
(
form_definition
);
})
.
push
(
function
(
form_info
)
{
var
form_type
=
form_info
[
0
],
child_gadget_url
=
form_info
[
1
];
child_gadget_url
=
form_info
[
1
];
return
gadget
.
changeState
({
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
jio_key
:
options
.
jio_key
,
...
@@ -103,8 +82,7 @@
...
@@ -103,8 +82,7 @@
.
onStateChange
(
function
()
{
.
onStateChange
(
function
()
{
var
fragment
=
document
.
createElement
(
'
div
'
),
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
,
gadget
=
this
;
options
;
while
(
this
.
element
.
firstChild
)
{
while
(
this
.
element
.
firstChild
)
{
this
.
element
.
removeChild
(
this
.
element
.
firstChild
);
this
.
element
.
removeChild
(
this
.
element
.
firstChild
);
}
}
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
776fe66e
...
@@ -225,7 +225,7 @@
...
@@ -225,7 +225,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.39
482.5501.59630
</string>
</value>
<value>
<string>
975.39
691.34802.60091
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -243,7 +243,7 @@
...
@@ -243,7 +243,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15574
25018.64
</float>
<float>
15574
37553.02
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
776fe66e
...
@@ -4,31 +4,6 @@
...
@@ -4,31 +4,6 @@
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
// TODO: move this to common utils
function
getFormInfo
(
form_definition
)
{
var
child_gadget_url
,
form_type
,
action_category
=
form_definition
.
action_type
;
switch
(
action_category
)
{
case
'
object_list
'
:
form_type
=
'
list
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_list.html
'
;
break
;
case
'
object_dialog
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
case
'
object_jio_js_script
'
:
form_type
=
'
dialog
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_dialog.html
'
;
break
;
default
:
form_type
=
'
page
'
;
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
}
return
[
form_type
,
child_gadget_url
];
}
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
...
@@ -60,7 +35,7 @@
...
@@ -60,7 +35,7 @@
})
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
action_reference
;
var
gadget
=
this
,
action_reference
,
gadget_utils
,
form_definition
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
...
@@ -68,19 +43,24 @@
...
@@ -68,19 +43,24 @@
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_relative_url
'
),
gadget
.
getUrlParameter
(
"
action
"
)
gadget
.
getUrlParameter
(
"
action
"
),
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
)
]);
]);
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
action_reference
=
result
[
4
];
action_reference
=
result
[
4
];
if
(
result
[
0
]
!==
undefined
)
{
options
.
portal_type
=
result
[
0
];
}
else
{
options
.
portal_type
=
result
[
2
];
}
if
(
result
[
0
]
!==
undefined
)
{
options
.
portal_type
=
result
[
0
];
}
else
{
options
.
portal_type
=
result
[
2
];
}
if
(
result
[
1
]
!==
undefined
)
{
options
.
parent_relative_url
=
result
[
1
];
}
else
{
options
.
parent_relative_url
=
result
[
3
];
}
if
(
result
[
1
]
!==
undefined
)
{
options
.
parent_relative_url
=
result
[
1
];
}
else
{
options
.
parent_relative_url
=
result
[
3
];
}
gadget_utils
=
result
[
5
];
return
gadget
.
getActionFormDefinition
(
action_reference
);
return
gadget
.
getActionFormDefinition
(
action_reference
);
})
})
.
push
(
function
(
form_definition
)
{
.
push
(
function
(
result
)
{
form_definition
=
result
;
return
gadget_utils
.
getFormInfo
(
form_definition
);
})
.
push
(
function
(
form_info
)
{
var
fragment
=
document
.
createElement
(
'
div
'
),
var
fragment
=
document
.
createElement
(
'
div
'
),
action_gadget_url
,
action_gadget_url
,
form_info
=
getFormInfo
(
form_definition
),
form_type
=
form_info
[
0
],
form_type
=
form_info
[
0
],
child_gadget_url
=
form_info
[
1
],
child_gadget_url
=
form_info
[
1
],
valid_action
=
form_definition
.
action_type
===
"
object_jio_js_script
"
&&
valid_action
=
form_definition
.
action_type
===
"
object_jio_js_script
"
&&
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
776fe66e
...
@@ -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.396
68.29926.39628
</string>
</value>
<value>
<string>
975.396
92.31170.31266
</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>
155743
6203.22
</float>
<float>
155743
7551.19
</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