Changeset 29cb681 in osmose-frontend


Ignore:
Timestamp:
Mar 22, 2014 5:22:54 PM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
1aca881
Parents:
7b50d3e
Message:

Ask before change page when editor have change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • static/map/Osmose.Editor.js

    r3859df0 r29cb681  
    4848    }); 
    4949 
     50    $(window).on('beforeunload', this._beforeunload.bind(this)); 
     51 
    5052    L.Control.Sidebar.prototype.initialize.call(this, placeholder, options); 
    5153  }, 
     
    9092      self._$container.html("readyState: " + xhr.readyState + "\nstatus: " + xhr.status); 
    9193    }); 
     94  }, 
     95 
     96  _beforeunload: function () { 
     97    var n = Object.keys(this._modifiyObjectStack).length + Object.keys(this._deleteObjectStack).length; 
     98    if (n > 0) { 
     99      return "Quit ?"; 
     100    } 
    92101  }, 
    93102 
Note: See TracChangeset for help on using the changeset viewer.