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
Léo-Paul Géneau
erp5
Commits
8a7d32de
Commit
8a7d32de
authored
Oct 03, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Do not clear the page if not needed
parent
3e1c3ce2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
113 additions
and
126 deletions
+113
-126
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_html.html
...teItem/web_page_module/rjs_gadget_erp5_launcher_html.html
+0
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_html.xml
...ateItem/web_page_module/rjs_gadget_erp5_launcher_html.xml
+2
-2
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
+70
-80
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_html.html
...lateItem/web_page_module/rjs_gadget_erp5_router_html.html
+1
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_html.xml
...plateItem/web_page_module/rjs_gadget_erp5_router_html.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
+34
-36
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
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_html.html
View file @
8a7d32de
...
...
@@ -18,7 +18,6 @@
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_global.js"
></script>
<script
src=
"erp5_launcher_nojqm.js"
></script>
</head>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_html.xml
View file @
8a7d32de
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
952.
57378.47936.4725
7
</string>
</value>
<value>
<string>
952.
64761.25287.1839
7
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
14
69799227.55
</float>
<float>
14
75507009.62
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
View file @
8a7d32de
/*globals window, document, RSVP, rJS,
loopEventListener,
URI, location, XMLHttpRequest, console*/
URI, location, XMLHttpRequest, console*/
/*jslint indent: 2, maxlen: 80*/
(
function
(
window
,
document
,
RSVP
,
rJS
,
loopEventListener
,
(
function
(
window
,
document
,
RSVP
,
rJS
,
XMLHttpRequest
,
location
,
console
)
{
"
use strict
"
;
...
...
@@ -131,9 +131,6 @@
// Display it to the user for now,
// and allow user to go back to the frontpage
var
error_text
=
""
;
if
(
error
instanceof
RSVP
.
CancellationError
)
{
return
;
}
if
(
error
.
target
instanceof
XMLHttpRequest
)
{
error_text
=
error
.
target
.
toString
()
+
"
"
+
...
...
@@ -159,17 +156,15 @@
}
function
displayError
(
gadget
,
error
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
displayErrorContent
(
gadget
,
error
);
})
.
push
(
function
()
{
return
gadget
.
dropGadget
(
MAIN_SCOPE
)
.
push
(
undefined
,
function
()
{
// Do not crash the app if the pg gadget in not defined
// ie, keep the original error on screen
return
;
});
if
(
error
instanceof
RSVP
.
CancellationError
)
{
return
;
}
displayErrorContent
(
gadget
,
error
);
return
gadget
.
dropGadget
(
MAIN_SCOPE
)
.
push
(
undefined
,
function
()
{
// Do not crash the app if the pg gadget in not defined
// ie, keep the original error on screen
return
;
});
}
...
...
@@ -449,13 +444,63 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
"
renderApplication
"
,
function
(
param_list
)
{
return
this
.
renderXXX
.
apply
(
this
,
param_list
);
return
this
.
render
.
apply
(
this
,
param_list
);
})
.
declareMethod
(
'
updateDOM
'
,
function
(
modification_dict
)
{
var
gadget
=
this
,
route_result
=
gadget
.
state
;
if
(
modification_dict
.
hasOwnProperty
(
'
url
'
))
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
renderMainGadget
(
gadget
,
route_result
.
url
,
route_result
.
options
);
})
.
push
(
function
(
main_gadget
)
{
// Append loaded gadget in the page
if
(
main_gadget
!==
undefined
)
{
return
main_gadget
.
getElement
()
.
push
(
function
(
fragment
)
{
var
element
=
gadget
.
props
.
content_element
,
content_container
=
document
.
createElement
(
"
div
"
);
content_container
.
className
=
"
ui-content
"
+
(
gadget
.
props
.
sub_header_class
||
""
);
// reset subheader indicator
delete
gadget
.
props
.
sub_header_class
;
// go to the top of the page
window
.
scrollTo
(
0
,
0
);
// Clear first to DOM, append after to reduce flickering/manip
while
(
element
.
firstChild
)
{
element
.
removeChild
(
element
.
firstChild
);
}
content_container
.
appendChild
(
fragment
);
element
.
appendChild
(
content_container
);
return
updateHeader
(
gadget
);
// XXX Drop notification
// return header_gadget.notifyLoaded();
});
}
});
}
// Same subgadget
return
gadget
.
getDeclaredGadget
(
MAIN_SCOPE
)
.
push
(
function
(
page_gadget
)
{
return
page_gadget
.
render
(
gadget
.
state
.
options
);
})
.
push
(
function
()
{
return
updateHeader
(
gadget
);
});
})
// Render the page
.
declareMethod
(
'
render
XXX
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
route_result
)
{
var
gadget
=
this
;
gadget
.
props
.
options
=
options
;
// Reinitialize the loading counter
gadget
.
props
.
loading_counter
=
0
;
// By default, init the header options to be empty
...
...
@@ -478,45 +523,8 @@
return
editor_panel
.
close
();
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
router
'
);
})
.
push
(
function
(
router_gadget
)
{
return
router_gadget
.
route
(
options
);
})
.
push
(
function
(
route_result
)
{
return
renderMainGadget
(
gadget
,
route_result
.
url
,
route_result
.
options
);
})
.
push
(
function
(
main_gadget
)
{
// Append loaded gadget in the page
if
(
main_gadget
!==
undefined
)
{
return
main_gadget
.
getElement
()
.
push
(
function
(
fragment
)
{
var
element
=
gadget
.
props
.
content_element
,
content_container
=
document
.
createElement
(
"
div
"
);
content_container
.
className
=
"
ui-content
"
+
(
gadget
.
props
.
sub_header_class
||
""
);
// reset subheader indicator
delete
gadget
.
props
.
sub_header_class
;
// go to the top of the page
window
.
scrollTo
(
0
,
0
);
// Clear first to DOM, append after to reduce flickering/manip
while
(
element
.
firstChild
)
{
element
.
removeChild
(
element
.
firstChild
);
}
content_container
.
appendChild
(
fragment
);
element
.
appendChild
(
content_container
);
return
updateHeader
(
gadget
);
// XXX Drop notification
// return header_gadget.notifyLoaded();
});
}
return
gadget
.
changeState
({
url
:
route_result
.
url
,
options
:
route_result
.
options
});
})
.
push
(
function
()
{
return
decreaseLoadingCounter
(
gadget
);
...
...
@@ -525,9 +533,6 @@
.
push
(
function
()
{
throw
error
;
});
})
.
push
(
undefined
,
function
(
error
)
{
return
displayError
(
gadget
,
error
);
});
})
...
...
@@ -540,28 +545,13 @@
// don't fail in case of dropped subgadget (like previous page)
return
;
}
return
displayError
(
this
,
param_list
[
0
]);
})
.
declareService
(
function
()
{
////////////////////////////////////
// Form submit listening. Prevent browser to automatically
// handle the form submit in case of a bug
////////////////////////////////////
var
gadget
=
this
;
function
catchFormSubmit
()
{
return
displayError
(
gadget
,
new
Error
(
"
Unexpected form submit
"
));
}
// Listen to form submit
return
loopEventListener
(
gadget
.
props
.
element
,
'
submit
'
,
false
,
catchFormSubmit
);
.
onEvent
(
'
submit
'
,
function
()
{
return
displayError
(
this
,
new
Error
(
"
Unexpected form submit
"
));
});
}(
window
,
document
,
RSVP
,
rJS
,
loopEventListener
,
}(
window
,
document
,
RSVP
,
rJS
,
XMLHttpRequest
,
location
,
console
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
View file @
8a7d32de
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.40892.47649.37836
</string>
</value>
<value>
<string>
95
4.23080.38606.35464
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
147
2730123.87
</float>
<float>
147
5507095.45
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_html.html
View file @
8a7d32de
...
...
@@ -8,7 +8,7 @@
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_router.js"
type=
"text/javascript"
></script>
</head>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_html.xml
View file @
8a7d32de
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
1.59695.16580.9642
</string>
</value>
<value>
<string>
95
2.64761.25287.18397
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
14
67045550.43
</float>
<float>
14
75507751.57
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
View file @
8a7d32de
...
...
@@ -27,7 +27,6 @@
COMMAND_SELECTION_NEXT
=
"
selection_next
"
,
COMMAND_HISTORY_PREVIOUS
=
"
history_previous
"
,
COMMAND_PUSH_HISTORY
=
"
push_history
"
,
REDIRECT_TIMEOUT
=
5055
,
VALID_URL_COMMAND_DICT
=
{};
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STORED_STATE
]
=
null
;
...
...
@@ -55,26 +54,8 @@
return
window
.
location
.
replace
(
hash
);
}
function
timeoutUrlChange
(
from_hash
,
to_hash
)
{
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
timeout
(
REDIRECT_TIMEOUT
);
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
===
'
Timed out after
'
+
REDIRECT_TIMEOUT
+
'
ms
'
)
{
throw
new
Error
(
'
URL handling timeout. From: "
'
+
from_hash
+
'
" to: "
'
+
to_hash
+
'
" and current: "
'
+
window
.
location
.
hash
+
'
"
'
);
}
throw
error
;
});
}
function
synchronousChangeState
(
hash
)
{
var
from_hash
=
window
.
location
.
hash
;
changeState
(
hash
);
return
timeoutUrlChange
(
from_hash
,
hash
);
return
changeState
(
hash
);
}
//////////////////////////////////////////////////////////////////
...
...
@@ -309,7 +290,6 @@
queue
=
new
RSVP
.
Queue
();
}
return
queue
.
push
(
function
()
{
return
synchronousChangeState
(
...
...
@@ -732,15 +712,25 @@
}
}
return
gadget
.
r
enderApplication
({
return
gadget
.
r
oute
({
method
:
command
[
0
],
path
:
command
.
substr
(
1
),
args
:
args
});
}
function
catchError
(
evt
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
extractHashAndDispatch
(
evt
);
})
.
push
(
undefined
,
function
(
error
)
{
return
gadget
.
renderError
(
error
);
});
}
var
result
=
loopEventListener
(
window
,
'
hashchange
'
,
false
,
extractHashAndDispatch
),
catchError
),
event
=
document
.
createEvent
(
"
Event
"
);
event
.
initEvent
(
'
hashchange
'
,
true
,
true
);
event
.
newURL
=
window
.
location
.
toString
();
...
...
@@ -839,9 +829,7 @@
delete
options
.
form_content
;
return
this
.
getCommandUrlFor
(
options
)
.
push
(
function
(
hash
)
{
var
from_hash
=
window
.
location
.
hash
;
window
.
location
.
replace
(
hash
);
return
timeoutUrlChange
(
from_hash
,
hash
);
return
synchronousChangeState
(
hash
);
});
})
...
...
@@ -850,18 +838,28 @@
})
.
declareMethod
(
'
route
'
,
function
(
command_options
)
{
var
gadget
=
this
;
var
gadget
=
this
,
result
;
if
(
command_options
.
method
===
PREFIX_DISPLAY
)
{
return
routeDisplay
(
gadget
,
command_options
);
}
if
(
command_options
.
method
===
PREFIX_COMMAND
)
{
return
routeCommand
(
gadget
,
command_options
);
}
if
(
command_options
.
method
)
{
throw
new
Error
(
'
Unsupported hash method:
'
+
command_options
.
method
);
result
=
routeDisplay
(
gadget
,
command_options
);
}
else
if
(
command_options
.
method
===
PREFIX_COMMAND
)
{
result
=
routeCommand
(
gadget
,
command_options
);
}
else
{
if
(
command_options
.
method
)
{
throw
new
Error
(
'
Unsupported hash method:
'
+
command_options
.
method
);
}
result
=
routeMethodLess
(
gadget
);
}
return
routeMethodLess
(
gadget
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
result
;
})
.
push
(
function
(
route_result
)
{
if
((
route_result
!==
undefined
)
&&
(
route_result
.
url
!==
undefined
))
{
return
gadget
.
renderApplication
(
route_result
);
}
});
})
.
declareMethod
(
'
start
'
,
function
()
{
...
...
@@ -873,6 +871,7 @@
.
declareAcquiredMethod
(
'
jio_getAttachment
'
,
'
jio_getAttachment
'
)
.
declareAcquiredMethod
(
'
setSetting
'
,
'
setSetting
'
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
'
renderError
'
,
'
reportServiceError
'
)
.
declareService
(
function
()
{
var
gadget
=
this
;
...
...
@@ -881,7 +880,6 @@
return
gadget
.
props
.
start_deferred
.
promise
;
})
.
push
(
function
()
{
// console.info('router service: listen to hash change');
return
listenHashChange
(
gadget
);
});
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
View file @
8a7d32de
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
2.11450.4967.32904
</string>
</value>
<value>
<string>
95
4.23085.57259.2628
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>
14
67212877.23
</float>
<float>
14
75507467.96
</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