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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
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
Show 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,18 +156,16 @@
}
function
displayError
(
gadget
,
error
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
displayErrorContent
(
gadget
,
error
);
})
.
push
(
function
()
{
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
;
});
});
}
function
getSetting
(
gadget
,
key
,
default_value
)
{
...
...
@@ -449,41 +444,14 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
"
renderApplication
"
,
function
(
param_list
)
{
return
this
.
render
XXX
.
apply
(
this
,
param_list
);
return
this
.
render
.
apply
(
this
,
param_list
);
})
// Render the page
.
declareMethod
(
'
renderXXX
'
,
function
(
options
)
{
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
// (ERP5 title by default + sidebar)
initHeaderOptions
(
gadget
);
.
declareMethod
(
'
updateDOM
'
,
function
(
modification_dict
)
{
var
gadget
=
this
,
route_result
=
gadget
.
state
;
if
(
modification_dict
.
hasOwnProperty
(
'
url
'
))
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
increaseLoadingCounter
(
gadget
);
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
panel
'
);
})
.
push
(
function
(
panel_gadget
)
{
return
panel_gadget
.
close
();
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
editor_panel
'
);
})
.
push
(
function
(
editor_panel
)
{
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
,
...
...
@@ -517,6 +485,46 @@
// 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
'
,
function
(
route_result
)
{
var
gadget
=
this
;
// Reinitialize the loading counter
gadget
.
props
.
loading_counter
=
0
;
// By default, init the header options to be empty
// (ERP5 title by default + sidebar)
initHeaderOptions
(
gadget
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
increaseLoadingCounter
(
gadget
);
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
panel
'
);
})
.
push
(
function
(
panel_gadget
)
{
return
panel_gadget
.
close
();
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
editor_panel
'
);
})
.
push
(
function
(
editor_panel
)
{
return
editor_panel
.
close
();
})
.
push
(
function
()
{
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
);
}
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
);
}
return
routeMethodLess
(
gadget
);
result
=
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