Skip to:
Content

BuddyPress.org

Changeset 7252


Ignore:
Timestamp:
07/09/2013 03:46:58 PM (12 years ago)
Author:
boonebgorges
Message:

Ports "Are you sure you want to leave page" dialog to bp-default.

Originally implemented in bp-legacy in r7151.

Fixes #5091

Props imath

Location:
trunk/bp-themes/bp-default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/global.js

    r7162 r7252  
    874874    } );
    875875
     876    jq("#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select").change( function() {
     877        var shouldconfirm = true;
     878
     879        jq('#profile-edit-form input:submit, #signup_form input:submit').on( 'click', function() {
     880            shouldconfirm = false;
     881        });
     882       
     883        window.onbeforeunload = function(e) {
     884            if ( shouldconfirm ) {
     885                return BP_DTheme.unsaved_changes;
     886            }
     887        };
     888    });
    876889
    877890    /** Friendship Requests **************************************/
  • trunk/bp-themes/bp-default/functions.php

    r7228 r7252  
    166166        'view'              => __( 'View', 'buddypress' ),
    167167        'mark_as_fav'       => __( 'Favorite', 'buddypress' ),
    168         'remove_fav'        => __( 'Remove Favorite', 'buddypress' )
     168        'remove_fav'        => __( 'Remove Favorite', 'buddypress' ),
     169        'unsaved_changes'   => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
    169170    );
    170171    wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
Note: See TracChangeset for help on using the changeset viewer.