Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Moved autocomplete logic from LeftAndMain.js to LeftAndMain.Edi…

…tForm.js where it belongs
  • Loading branch information...
commit 0563018f520e8f800000ae2cf8b1d392bd8c8690 1 parent d3477cc
@chillu chillu authored
View
18 admin/javascript/LeftAndMain.EditForm.js
@@ -38,11 +38,27 @@
*/
onmatch: function() {
var self = this;
+
+ // Turn off autocomplete to fix the access tab randomly switching radio buttons in Firefox
+ // when refresh the page with an anchor tag in the URL. E.g: /admin#Root_Access.
+ // Autocomplete in the CMS also causes strangeness in other browsers,
+ // filling out sections of the form that the user does not want to be filled out,
+ // so this turns it off for all browsers.
+ // See the following page for demo and explanation of the Firefox bug:
+ // http://www.ryancramer.com/journal/entries/radio_buttons_firefox/
+ this.attr("autocomplete", "off");
this._setupChangeTracker();
// Can't bind this through jQuery
- window.onbeforeunload = function(e) {return self._checkChangeTracker(false);};
+ window.onbeforeunload = function(e) {
+ self.trigger('beforesave');
+ if(self.is('.changed')) return ss.i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
+ };
+
+ // Catch navigation events before they reach handleStateChange(),
+ // in order to avoid changing the menu state if the action is cancelled by the user
+ $('.cms-menu')
// focus input on first form element
this.find(':input:visible:not(:submit):first').focus();
View
11 admin/javascript/LeftAndMain.js
@@ -11,17 +11,6 @@
$.entwine('ss', function($){
/**
- * Turn off autocomplete to fix the access tab randomly switching radio buttons in Firefox
- * when refresh the page with an anchor tag in the URL. E.g: /admin#Root_Access.
- * Autocomplete in the CMS also causes strangeness in other browsers,
- * filling out sections of the form that the user does not want to be filled out,
- * so this turns it off for all browsers.
- * See the following page for demo and explanation of the Firefox bug:
- * http://www.ryancramer.com/journal/entries/radio_buttons_firefox/
- */
- $("#Form_EditForm").attr("autocomplete", "off");
-
- /**
* Position the loading spinner animation below the ss logo
*/
var positionLoadingSpinner = function() {
Please sign in to comment.
Something went wrong with that request. Please try again.