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
0
Issues
0
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
Frederic Thoma
erp5
Commits
4234b52a
Commit
4234b52a
authored
May 14, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Add getUrlForList acquired method
Reduce the number of acquired method calls by grouping them.
parent
954f9dee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
34 deletions
+46
-34
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
...mplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
+3
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
...plateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
...TemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
+38
-29
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
...emplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
+3
-3
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
View file @
4234b52a
...
...
@@ -397,6 +397,9 @@
.
allowPublicAcquisition
(
"
getUrlFor
"
,
function
(
param_list
)
{
return
route
(
this
,
'
router
'
,
'
getCommandUrlFor
'
,
param_list
);
})
.
allowPublicAcquisition
(
"
getUrlForList
"
,
function
(
param_list
)
{
return
route
(
this
,
'
router
'
,
'
getCommandUrlForList
'
,
param_list
);
})
.
allowPublicAcquisition
(
"
updateHeader
"
,
function
(
param_list
)
{
var
gadget
=
this
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
View file @
4234b52a
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
967.30869.
341.45038
</string>
</value>
<value>
<string>
967.30869.
54828.19677
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1526
055710.14
</float>
<float>
1526
293842.78
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
View file @
4234b52a
...
...
@@ -169,10 +169,7 @@
return
options
.
url
;
}
if
(
command
===
COMMAND_CHANGE_LANGUAGE
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
website_url_set
"
);
})
return
gadget
.
getSetting
(
"
website_url_set
"
)
.
push
(
function
(
result
)
{
var
param_list
=
window
.
location
.
hash
.
split
(
'
#
'
)[
1
],
new_url
=
JSON
.
parse
(
result
)[
options
.
language
];
...
...
@@ -220,6 +217,34 @@
return
result
;
}
function
getCommandUrlForMethod
(
gadget
,
options
)
{
var
command
=
options
.
command
,
absolute_url
=
options
.
absolute_url
,
hash
,
args
=
options
.
options
,
valid
=
true
,
key
;
// Only authorize 'command', 'options', 'absolute_url' keys
// Drop all other kind of parameters, to detect issue more easily
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
((
key
!==
'
command
'
)
&&
(
key
!==
'
options
'
)
&&
(
key
!==
'
absolute_url
'
))
{
valid
=
false
;
}
}
}
if
(
valid
&&
(
options
.
command
)
&&
(
VALID_URL_COMMAND_DICT
.
hasOwnProperty
(
options
.
command
)))
{
hash
=
getCommandUrlFor
(
gadget
,
command
,
args
);
}
else
{
hash
=
getCommandUrlFor
(
gadget
,
'
error
'
,
options
);
}
if
(
absolute_url
)
{
hash
=
new
URL
(
hash
,
window
.
location
.
href
).
href
;
}
return
hash
;
}
function
getDisplayUrlFor
(
jio_key
,
options
)
{
var
prefix
=
'
?
'
,
result
,
...
...
@@ -946,32 +971,16 @@
});
})
.
declareMethod
(
'
getCommandUrlFor
'
,
function
(
options
)
{
var
command
=
options
.
command
,
absolute_url
=
options
.
absolute_url
,
hash
,
args
=
options
.
options
,
valid
=
true
,
key
;
// Only authorize 'command', 'options', 'absolute_url' keys
// Drop all other kind of parameters, to detect issue more easily
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
((
key
!==
'
command
'
)
&&
(
key
!==
'
options
'
)
&&
(
key
!==
'
absolute_url
'
))
{
valid
=
false
;
}
}
}
if
(
valid
&&
(
options
.
command
)
&&
(
VALID_URL_COMMAND_DICT
.
hasOwnProperty
(
options
.
command
)))
{
hash
=
getCommandUrlFor
(
this
,
command
,
args
);
}
else
{
hash
=
getCommandUrlFor
(
this
,
'
error
'
,
options
);
}
if
(
absolute_url
)
{
hash
=
new
URL
(
hash
,
window
.
location
.
href
).
href
;
.
declareMethod
(
'
getCommandUrlForList
'
,
function
(
options_list
)
{
var
i
,
result_list
=
[];
for
(
i
=
0
;
i
<
options_list
.
length
;
i
+=
1
)
{
result_list
.
push
(
getCommandUrlForMethod
(
this
,
options_list
[
i
]));
}
return
hash
;
return
result_list
;
})
.
declareMethod
(
'
getCommandUrlFor
'
,
function
(
options
)
{
return
getCommandUrlForMethod
(
this
,
options
);
})
.
declareMethod
(
'
redirect
'
,
function
(
options
,
push_history
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
View file @
4234b52a
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
6.2649.17362.11178
</string>
</value>
<value>
<string>
96
7.34846.62513.42240
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,8 +250,8 @@
</tuple>
<state>
<tuple>
<float>
152
0516819.75
</float>
<string>
GMT+1
</string>
<float>
152
6294815.82
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
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