You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/02/10 20:09:13 UTC

[jira] [Commented] (COUCHDB-2574) Clicking away from editor with unsaved changes should always show "do you want to save?" msg

    [ https://issues.apache.org/jira/browse/COUCHDB-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14314690#comment-14314690 ] 

ASF GitHub Bot commented on COUCHDB-2574:
-----------------------------------------

GitHub user benkeen opened a pull request:

    https://github.com/apache/couchdb-fauxton/pull/263

    Ensure save changes conf appears

    Extra eyes on this ticket are appreciated! Bit of explanation
    needed.
    
    Whenever you make a change to content in an Ace editor then
    navigate away, you should see a confirmation alert saying "Are you
    sure you don't want to save these changes?". Right now this
    appears sometimes, but not always. This ticket makes a small
    change to the main event delegation function in main.js that runs
    on all <a> tags. Before, as long as the <a> didn't contain a
    data-bypass attribute, it did a FauxtonAPI.navigate call, which
    meant that all beforeUnload functions got ran prior to redirecting
    - and that was where the confirmation alert appeared.
    
    This has now been changed to only NOT run when the data-bypass
    attribute is set to true, which I think is what was originally
    intended. This small change will ensure any pages containing the
    Ace editor will have their beforeUnload functions ran prior to
    redirecting from any link.
    
    Closes COUCHDB-2574

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/benkeen/couchdb-fauxton 2574-save-editor-changed-confirmation

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fauxton/pull/263.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 #263
    
----
commit c29562a2da382b15ba4c59f487835fdd6974c435
Author: Ben Keen <be...@gmail.com>
Date:   2015-02-10T18:59:41Z

    Ensure save changes conf appears
    
    Extra eyes on this ticket are appreciated! Bit of explanation
    needed.
    
    Whenever you make a change to content in an Ace editor then
    navigate away, you should see a confirmation alert saying "Are you
    sure you don't want to save these changes?". Right now this
    appears sometimes, but not always. This ticket makes a small
    change to the main event delegation function in main.js that runs
    on all <a> tags. Before, as long as the <a> didn't contain a
    data-bypass attribute, it did a FauxtonAPI.navigate call, which
    meant that all beforeUnload functions got ran prior to redirecting
    - and that was where the confirmation alert appeared.
    
    This has now been changed to only NOT run when the data-bypass
    attribute is set to true, which I think is what was originally
    intended. This small change will ensure any pages containing the
    Ace editor will have their beforeUnload functions ran prior to
    redirecting from any link.
    
    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)