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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
e26beb3a
Commit
e26beb3a
authored
Feb 20, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Feb 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Protect page-tabs rendering with mutexes by moving it to changeState
parent
90ebcf01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
43 deletions
+63
-43
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
...lateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
+61
-41
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
View file @
e26beb3a
/*global window, rJS, RSVP, Handlebars, URI, calculatePageTitle */
/*global window, rJS, RSVP, Handlebars, URI, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/** Page for displaying Views, Jump and BreadCrumb navigation for a document.
*/
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
URI
,
calculatePageTitle
)
{
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
URI
,
calculatePageTitle
)
{
"
use strict
"
;
"
use strict
"
;
...
@@ -12,6 +16,38 @@
...
@@ -12,6 +16,38 @@
.
getElementById
(
"
table-template
"
)
.
getElementById
(
"
table-template
"
)
.
innerHTML
);
.
innerHTML
);
/** Go recursively up the parent-chain and insert breadcrumbs in the last argument.
*/
function
modifyBreadcrumbList
(
gadget
,
parent_link
,
breadcrumb_action_list
)
{
if
(
parent_link
===
undefined
)
{
return
;
}
var
uri
=
new
URI
(
parent_link
.
href
),
jio_key
=
uri
.
segment
(
2
);
if
((
uri
.
protocol
()
!==
'
urn
'
)
||
(
uri
.
segment
(
0
)
!==
'
jio
'
)
||
(
uri
.
segment
(
1
)
!==
"
get
"
))
{
// Parent is the ERP5 site thus recursive calling ends here
breadcrumb_action_list
.
unshift
({
title
:
"
ERP5
"
,
link
:
"
#
"
});
return
;
}
// Parent is an ERP5 document
return
gadget
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
jio_key
}})
.
push
(
function
(
parent_href
)
{
breadcrumb_action_list
.
unshift
({
title
:
parent_link
.
name
,
link
:
parent_href
});
return
gadget
.
jio_getAttachment
(
jio_key
,
"
links
"
);
})
.
push
(
function
(
result
)
{
return
modifyBreadcrumbList
(
gadget
,
result
.
_links
.
parent
||
"
#
"
,
breadcrumb_action_list
);
});
}
gadget_klass
gadget_klass
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
...
@@ -24,52 +60,33 @@
...
@@ -24,52 +60,33 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/** Render only transforms its arguments and passes them to mutex-protected onStateChange
options:
jio_key: {string} currently viewed document (e.g. foo/1)
page: {string} selected page (always "tab" for page_tab)
view: {string} always "view"
selection, history, selection_index
*/
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
view_list
,
return
this
.
changeState
({
jio_key
:
options
.
jio_key
});
})
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
view_list
=
[],
tab_list
=
[],
tab_list
=
[],
jump_action_list
=
[],
jump_action_list
=
[],
breadcrumb_action_list
=
[],
breadcrumb_action_list
=
[],
parent_queue
,
gadget
=
this
,
erp5_document
,
erp5_document
,
tab_title
=
"
Views
"
,
tab_title
=
"
Views
"
,
tab_icon
=
"
eye
"
,
tab_icon
=
"
eye
"
,
jump_list
;
jump_list
;
function
handleParent
(
parent_link
)
{
return
gadget
.
jio_getAttachment
(
modification_dict
.
jio_key
,
"
links
"
)
parent_queue
.
push
(
function
()
{
var
uri
,
jio_key
;
if
(
parent_link
!==
undefined
)
{
uri
=
new
URI
(
parent_link
.
href
);
jio_key
=
uri
.
segment
(
2
);
if
((
uri
.
protocol
()
!==
'
urn
'
)
||
(
uri
.
segment
(
0
)
!==
'
jio
'
)
||
(
uri
.
segment
(
1
)
!==
"
get
"
))
{
// Parent is the ERP5 site
breadcrumb_action_list
.
unshift
({
title
:
"
ERP5
"
,
link
:
"
#
"
});
}
else
{
// Parent is an ERP5 document
return
gadget
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
jio_key
}})
.
push
(
function
(
parent_href
)
{
breadcrumb_action_list
.
unshift
({
title
:
parent_link
.
name
,
link
:
parent_href
});
return
gadget
.
jio_getAttachment
(
jio_key
,
"
links
"
);
})
.
push
(
function
(
result
)
{
handleParent
(
result
.
_links
.
parent
||
"
#
"
);
});
}
}
});
}
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
links
"
)
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
var
i
,
var
i
,
promise_list
=
[];
promise_list
=
[];
...
@@ -88,7 +105,8 @@
...
@@ -88,7 +105,8 @@
for
(
i
=
0
;
i
<
view_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
view_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
promise_list
.
push
(
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
view_list
[
i
].
href
,
view
:
view_list
[
i
].
href
,
page
:
undefined
page
:
undefined
// Views in ERP5 must be forms but because of
// OfficeJS we keep it empty for different default
}}));
}}));
}
}
for
(
i
=
0
;
i
<
jump_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
jump_list
.
length
;
i
+=
1
)
{
...
@@ -97,9 +115,11 @@
...
@@ -97,9 +115,11 @@
page
:
'
search
'
page
:
'
search
'
}}));
}}));
}
}
parent_queue
=
new
RSVP
.
Queue
();
promise_list
.
push
(
handleParent
(
erp5_document
.
_links
.
parent
||
"
#
"
);
modifyBreadcrumbList
(
gadget
,
promise_list
.
push
(
parent_queue
);
erp5_document
.
_links
.
parent
||
"
#
"
,
breadcrumb_action_list
)
);
return
RSVP
.
all
(
promise_list
);
return
RSVP
.
all
(
promise_list
);
})
})
.
push
(
function
(
all_result
)
{
.
push
(
function
(
all_result
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
View file @
e26beb3a
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
58.28347.56387.25600
</string>
</value>
<value>
<string>
9
65.39422.59074.24098
</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>
1
491225418.18
</float>
<float>
1
519114113.71
</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