Merge lp:~therp-nl/web-addons/7.0-web_confirm_window_close into lp:~webaddons-core-editors/web-addons/7.0

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 5
Proposed branch: lp:~therp-nl/web-addons/7.0-web_confirm_window_close
Merge into: lp:~webaddons-core-editors/web-addons/7.0
Diff against target: 100 lines (+86/-0)
2 files modified
web_confirm_window_close/__openerp__.py (+44/-0)
web_confirm_window_close/static/src/js/web_confirm_window_close.js (+42/-0)
To merge this branch: bzr merge lp:~therp-nl/web-addons/7.0-web_confirm_window_close
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Approve
Review via email: mp+183187@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

With the last change i tested on Safari, Chrome and Mozilla. It works perfectly as expected, i will proceed with the merge.

Good job dude.

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for testing and the review! I think we agreed on a minimum review time of 5 calendar days (aka. 3 business days) on the community mailing list after our last discussion about this, so I am less happy with the quick merge. If anyone still wants to comment on this code, then let me at least promise to respond as if this proposal has not been merged yet.

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

Ups, I didn't see the date, i jus clean the web-addons branch of mergeable
branches, if somebody is not happy i can revert it.

REgards.

2013/9/1 Stefan Rijnhart (Therp) <email address hidden>

> Thanks for testing and the review! I think we agreed on a minimum review
> time of 5 calendar days (aka. 3 business days) on the community mailing
> list after our last discussion about this, so I am less happy with the
> quick merge. If anyone still wants to comment on this code, then let me at
> least promise to respond as if this proposal has not been merged yet.
> --
>
> https://code.launchpad.net/~therp-nl/web-addons/7.0-web_confirm_window_close/+merge/183187
> You are reviewing the proposed merge of
> lp:~therp-nl/web-addons/7.0-web_confirm_window_close into lp:web-addons.
>

--
--------------------
Saludos Cordiales

Nhomar G. Hernandez M.
+58-414-4110269
Skype: nhomar00
Web-Blog: http://geronimo.com.ve
Servicios IT: http://vauxoo.com
Linux-Counter: 467724
Correos:
<email address hidden>
<email address hidden>
twitter @nhomar

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'web_confirm_window_close'
2=== added file 'web_confirm_window_close/__init__.py'
3=== added file 'web_confirm_window_close/__openerp__.py'
4--- web_confirm_window_close/__openerp__.py 1970-01-01 00:00:00 +0000
5+++ web_confirm_window_close/__openerp__.py 2013-08-30 14:17:43 +0000
6@@ -0,0 +1,44 @@
7+# -*- coding: utf-8 -*-
8+##############################################################################
9+#
10+# OpenERP, Open Source Management Solution
11+# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+{
29+ 'name': 'Check for unsaved data when closing browser window',
30+ 'description': '''
31+This addon will show a confirmation dialog when the user closes
32+a window with an OpenERP form containing unsaved data.
33+
34+This functionality is browser dependent. Opera ignores it at all,
35+while Firefox displays a generic confirmation message.
36+
37+This module is compatible with OpenERP 7.0.
38+''',
39+ 'version': '7.0.1',
40+ 'author': 'Therp BV',
41+ 'category': 'Usability',
42+ 'website': 'https://launchpad.net/web-addons',
43+ 'license': 'AGPL-3',
44+ 'depends': [
45+ 'web',
46+ ],
47+ 'js': [
48+ 'static/src/js/web_confirm_window_close.js'
49+ ],
50+}
51
52=== added directory 'web_confirm_window_close/static'
53=== added directory 'web_confirm_window_close/static/src'
54=== added directory 'web_confirm_window_close/static/src/js'
55=== added file 'web_confirm_window_close/static/src/js/web_confirm_window_close.js'
56--- web_confirm_window_close/static/src/js/web_confirm_window_close.js 1970-01-01 00:00:00 +0000
57+++ web_confirm_window_close/static/src/js/web_confirm_window_close.js 2013-08-30 14:17:43 +0000
58@@ -0,0 +1,42 @@
59+/*
60+
61+ Copyright (C) 2013 Therp BV
62+ License: GNU AFFERO GENERAL PUBLIC LICENSE
63+ Version 3 or any later version
64+
65+*/
66+
67+openerp.web_confirm_window_close = function(instance) {
68+
69+ instance.web.FormView.include({
70+ init: function(parent, dataset, view_id, options) {
71+ res = this._super(parent, dataset, view_id, options);
72+ instance.web.bus.on('report_uncommitted_changes', this, function(e) {
73+ if (this.$el.is('.oe_form_dirty')) {
74+ e.preventDefault();
75+ }
76+ });
77+ return res;
78+ }
79+ }),
80+
81+ instance.web.WebClient.include({
82+ warning_on_close: function() {
83+ var $e = $.Event('report_uncommitted_changes');
84+ instance.web.bus.trigger('report_uncommitted_changes', $e);
85+ if ($e.isDefaultPrevented()) {
86+ return instance.web._t(
87+ "You have unsaved data in this window. " +
88+ "Do you really want to leave?");
89+ }
90+ },
91+
92+ start: function() {
93+ res = this._super();
94+ $(window).on("beforeunload", _.bind(
95+ this.warning_on_close, this));
96+ return res;
97+ }
98+
99+ });
100+}

Subscribers

People subscribed via source and target branches