Ticket #10656 (closed enhancement: fixed)

Opened 6 months ago

Last modified 3 months ago

Prompt with a warning dialog when navigating away from a page with unsaved changes to an enum list

Reported by: rjollos Assigned to: rjollos
Priority: normal Component: AdminEnumListPlugin
Severity: normal Keywords:
Cc: jun66j5 Trac Release:

Description

When items in the list have been reordered, but the changes haven't yet be saved, a warning should be issued when navigating away from the page. As an example, the BacklogPlugin has this behavior.

Attachments

t10656-beforeunload-jquery1.2-r12424.diff (1.6 kB) - added by jun66j5 on 12/10/12 13:53:56.

Change History

12/08/12 08:58:41 changed by rjollos

  • status changed from new to assigned.
  • cc set to jun66j5.
  • owner changed from nonplus to rjollos.

12/09/12 10:00:56 changed by rjollos

  • summary changed from Add a warning when navigating away from a page that has unsaved changes to Prompt with a warning dialog when navigating away from a page with unsaved changes to an enum list.

12/09/12 11:06:16 changed by rjollos

I'd like to prompt with the dialog when Remove selected items is pressed, but not when Apply changes is pressed. I'm currently following the guidance in the first reply here.

12/09/12 11:20:08 changed by rjollos

(In [12419]) Refs #10656:

  • Prompt user with a dialog when navigating away from a page with unsaved changes to a list.
  • Added a changelog.

(follow-up: ↓ 6 ) 12/09/12 14:15:46 changed by rjollos

[12419] doesn't seem to be working correctly with Trac 0.11.

12/10/12 13:53:56 changed by jun66j5

  • attachment t10656-beforeunload-jquery1.2-r12424.diff added.

(in reply to: ↑ 5 ; follow-up: ↓ 7 ) 12/10/12 13:59:36 changed by jun66j5

Replying to rjollos:

[12419] doesn't seem to be working correctly with Trac 0.11.

Yes, beforeunload event doesn't work on jQuery 1.2. It works on 1.4. See http://bugs.jquery.com/ticket/4106.

Proposal patch is here, t10656-beforeunload-jquery1.2-r12424.diff. It checks existence of jQuery.event.special.beforeunload. See http://benalman.com/news/2010/03/jquery-special-events/#version-compatibility and http://docs.jquery.com/Events/jQuery.Event#Special_Events.

(in reply to: ↑ 6 ; follow-up: ↓ 9 ) 12/11/12 12:38:08 changed by rjollos

Replying to jun66j5:

Proposal patch is here, t10656-beforeunload-jquery1.2-r12424.diff.

Thanks! Supporting these older versions of jQuery is a pain.

I was trying, but could not understand the need for:

$(window).bind('unload', function() { window.onbeforeunload = null; });

Any hints as to why that is needed?

12/11/12 12:50:01 changed by rjollos

(In [12436]) Refs #10656: beforeunload event is not supported in jQuery < 1.4, so some special handling is needed to directly utilize the window.onbeforeunload event in the cases that the jQuery special event is not supported. Patch by Jun Omae (jun66j5).

(in reply to: ↑ 7 ; follow-up: ↓ 10 ) 12/11/12 12:51:17 changed by jun66j5

Replying to rjollos:

I was trying, but could not understand the need for: $(window).bind('unload', function() { window.onbeforeunload = null; });

This code is avoiding memory leak risk on Internet Explorer.

(in reply to: ↑ 9 ) 12/21/12 15:12:03 changed by rjollos

Replying to jun66j5:

This code is avoiding memory leak risk on Internet Explorer.

In [12458] I added a note to the source code about this.

02/17/13 03:51:16 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

Add/Change #10656 (Prompt with a warning dialog when navigating away from a page with unsaved changes to an enum list)




Change Properties
Action