[
https://issues.apache.org/jira/browse/COUCHDB-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14318732#comment-14318732
]
ASF GitHub Bot commented on COUCHDB-2574:
-----------------------------------------
GitHub user robertkowalski opened a pull request:
https://github.com/apache/couchdb-fauxton/pull/267
Fix missing confirmation when leaving editor
To not render a property in React we need to pass `null` to it. If
we are passing `false` or `"false"` it gets rendered into the DOM.
This fixes a bug where you edited a document and then got no
confirmation dialog if you are really sure you want to leave the
page without saving if you clicked on the navigation bar on the
left.
Having `data-bypass="false"` will mean to the selector
`:not(["data-bypass"])` that there is a `data-bypass` - containing
a String! (which then matches the selector)
What we want is _no_ `data-bypass` if we don't want to bypass.
Looking at the old DOM a month ago shows how we used `data-bypass`:

Closes COUCHDB-2574
superseeds #263
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/robertkowalski/couchdb-fauxton
2574-save-editor-changed-confirmation-react-bug
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-fauxton/pull/267.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #267
----
commit cf03798402d7c02b1d124e15960e9e203ae73ff8
Author: Robert Kowalski <[email protected]>
Date: 2015-02-12T18:13:40Z
Fix coding style
commit 60dce889c5e0f950b948cb05811046f8eb4b93f6
Author: Robert Kowalski <[email protected]>
Date: 2015-02-12T18:14:58Z
Fix missing confirmation when leaving editor
Fix for passing false as a string with is evaluated truthy
This fixes a bug where you edited a document and then got no
confirmation dialog if you are really sure you want to leave the
page without saving if you clicked on the navigation bar on the
left.
To not render a property in React we need to pass `null` to it. If
we are passing `false` or `"false"` it gets rendered into the DOM.
Having `data-bypass="false"` will mean to the selector
`:not(["data-bypass"])` that there is a `data-bypass` - containing
a String! (which then matches the selector)
What we want is _no_ `data-bypass` if we don't want to bypass.
Closes COUCHDB-2574
----
> Clicking away from editor with unsaved changes should always show "do you
> want to save?" msg
> --------------------------------------------------------------------------------------------
>
> Key: COUCHDB-2574
> URL: https://issues.apache.org/jira/browse/COUCHDB-2574
> Project: CouchDB
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: Fauxton
> Reporter: Ben Keen
> Assignee: Ben Keen
>
> Any time the user has made changes to the content in an Ace Editor then tries
> navigating away from the page, it should confirm they don't want the
> information lost. We do this in a few places right now, but not everywhere.
> The core FauxtonAPI.navigate function checks any beforeUnload functions all
> pass prior to redirecting. The issue is that in main.js, the chief event
> delegation function running on all <a>'s checks for the existence of a
> data-bypass attribute, but not that the attribute is set to true.
> Once we change this:
> bq. $(document).on("click", "a:not([data-bypass])", function(evt) {
> ... to this ...
> bq. $(document).on("click", "a:not([data-bypass=true])", function(evt) {
> ... the FauxtonAPI.navigate() function will be properly called for all links
> that aren't explicitly bypassing event delegation, and thus the beforeUnload
> function containing the alert() will get called as we want.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)