Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
d572f60b
Commit
d572f60b
authored
Dec 29, 2017
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: show warning when leave page with unsaved data
parent
96f37c2c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
19 deletions
+59
-19
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
+6
-3
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
+3
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_notification_js.js
...teItem/web_page_module/rjs_gadget_erp5_notification_js.js
+1
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_notification_js.xml
...eItem/web_page_module/rjs_gadget_erp5_notification_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
...b_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
+3
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
..._page_module/rjs_gadget_erp5_pt_form_view_editable_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
+3
-0
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
+35
-3
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_js.js
View file @
d572f60b
...
...
@@ -335,13 +335,15 @@
.
allowPublicAcquisition
(
'
notifySubmitted
'
,
function
(
argument_list
)
{
return
RSVP
.
all
([
route
(
this
,
"
header
"
,
'
notifySubmitted
'
),
route
(
this
,
"
notification
"
,
'
notify
'
,
argument_list
)
route
(
this
,
"
notification
"
,
'
notify
'
,
argument_list
),
route
(
this
,
"
router
"
,
'
notify
'
,
argument_list
)
]);
})
.
allowPublicAcquisition
(
'
notifyChange
'
,
function
(
argument_list
)
{
return
RSVP
.
all
([
route
(
this
,
"
header
"
,
'
notifyChange
'
),
route
(
this
,
"
notification
"
,
'
notify
'
,
argument_list
)
route
(
this
,
"
notification
"
,
'
notify
'
,
argument_list
),
route
(
this
,
"
router
"
,
'
notify
'
,
argument_list
)
]);
})
...
...
@@ -578,7 +580,8 @@
.
push
(
function
()
{
var
promise_list
=
[
route
(
gadget
,
'
panel
'
,
'
close
'
),
route
(
gadget
,
'
editor_panel
'
,
'
close
'
)
route
(
gadget
,
'
editor_panel
'
,
'
close
'
),
route
(
gadget
,
'
router
'
,
'
notify
'
,
[{
modified
:
false
}])
];
if
(
keep_message
!==
true
)
{
promise_list
.
push
(
route
(
gadget
,
'
notification
'
,
'
close
'
));
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
View file @
d572f60b
...
...
@@ -216,7 +216,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
vincent
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
964.
8140.54108.1245
</string>
</value>
<value>
<string>
964.
29808.29957.65314
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
151
3245928.9
</float>
<float>
151
4543212.43
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_notification_js.js
View file @
d572f60b
...
...
@@ -19,7 +19,7 @@
/////////////////////////////////////////////////////////////////
gadget_klass
.
declareMethod
(
'
notify
'
,
function
(
options
)
{
if
(
options
)
{
if
(
options
&&
options
.
message
)
{
return
this
.
changeState
({
visible
:
true
,
message
:
options
.
message
,
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_notification_js.xml
View file @
d572f60b
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
1.59536.21138.61354
</string>
</value>
<value>
<string>
96
2.4168.39270.46967
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
15
04769866.21
</float>
<float>
15
14542276.66
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
View file @
d572f60b
...
...
@@ -15,7 +15,9 @@
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareAcquiredMethod
(
"
displayFormulatorValidationError
"
,
"
displayFormulatorValidationError
"
)
.
allowPublicAcquisition
(
"
notifyChange
"
,
function
()
{
return
this
.
notifyChange
({
modified
:
true
});
})
/////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget
/////////////////////////////////////////////////////////////////
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
View file @
d572f60b
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
1.59393.42745.39918
</string>
</value>
<value>
<string>
96
2.4168.39270.46967
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
15
04701066.63
</float>
<float>
15
14542029.91
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_html.html
View file @
d572f60b
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=This page contains unsaved changes, do you really want to leave the page ?
-->
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Router Gadget
</title>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_html.xml
View file @
d572f60b
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
54.45675.44850.53452
</string>
</value>
<value>
<string>
9
64.35847.42197.53026
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
1
476956546.79
</float>
<float>
1
514969789.88
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
View file @
d572f60b
...
...
@@ -812,6 +812,19 @@
}
}
//execute an url command without saving
if
(
gadget
.
props
.
modified
&&
command
[
0
]
===
PREFIX_COMMAND
)
{
if
(
!
window
.
confirm
(
gadget
.
props
.
warning_message
))
{
//back to previous hash
gadget
.
props
.
hasUnsaved
=
true
;
return
synchronousChangeState
(
evt
.
oldURL
);
}
}
//don't rerender old page when back to the previous hash
if
(
gadget
.
props
.
hasUnsaved
)
{
gadget
.
props
.
hasUnsaved
=
false
;
return
;
}
return
gadget
.
route
({
method
:
command
[
0
],
path
:
command
.
substr
(
1
),
...
...
@@ -974,7 +987,8 @@
return
RSVP
.
all
([
gadget
.
getSetting
(
"
selected_language
"
),
gadget
.
getSetting
(
"
default_selected_language
"
),
gadget
.
getSetting
(
"
language_map
"
)
gadget
.
getSetting
(
"
language_map
"
),
gadget
.
translate
(
"
This page contains unsaved changes, do you really want to leave the page ?
"
)
]);
})
.
push
(
function
(
results
)
{
...
...
@@ -986,6 +1000,7 @@
}
});
}
gadget
.
props
.
warning_message
=
results
[
3
];
return
gadget
.
listenHashChange
();
})
.
push
(
undefined
,
function
(
error
)
{
...
...
@@ -995,6 +1010,9 @@
throw
error
;
});
})
.
declareMethod
(
'
notify
'
,
function
(
options
)
{
this
.
props
.
modified
=
(
options
&&
options
.
modified
);
})
.
declareAcquiredMethod
(
'
renderApplication
'
,
'
renderApplication
'
)
.
declareAcquiredMethod
(
'
jio_allDocs
'
,
'
jio_allDocs
'
)
...
...
@@ -1002,9 +1020,23 @@
.
declareAcquiredMethod
(
'
setSetting
'
,
'
setSetting
'
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
'
renderError
'
,
'
reportServiceError
'
)
.
declareAcquiredMethod
(
'
translate
'
,
'
translate
'
)
.
declareJob
(
'
listenHashChange
'
,
function
()
{
return
listenHashChange
(
this
);
})
.
declareService
(
function
()
{
var
gadget
=
this
;
return
loopEventListener
(
window
,
'
beforeunload
'
,
false
,
function
(
event
)
{
if
(
gadget
.
props
.
modified
)
{
event
.
returnValue
=
'
fake
'
;
}
return
'
fake
'
;
}
);
});
}(
window
,
rJS
,
RSVP
,
loopEventListener
,
document
,
jIO
,
URI
,
URL
,
Blob
));
}(
window
,
rJS
,
RSVP
,
loopEventListener
,
document
,
jIO
,
URI
,
URL
,
Blob
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
View file @
d572f60b
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
964.
29820.17700.38587
</string>
</value>
<value>
<string>
964.
36966.42383.29030
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>
1514
542054.97
</float>
<float>
1514
970793.49
</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