Skip to content
This repository
5  admin/javascript/LeftAndMain.EditForm.js
@@ -88,6 +88,11 @@
88 88
 				if(this.hasClass('validationerror')) {
89 89
 					// TODO validation shouldnt need a special case
90 90
 					statusMessage(ss.i18n._t('ModelAdmin.VALIDATIONERROR', 'Validation Error'), 'bad');
  91
+
  92
+					// Ensure the first validation error is visible
  93
+					var firstTabWithErrors = this.find('.message.validation:first').closest('.tab');
  94
+					$('.cms-container').clearCurrentTabState(); // clear state to avoid override later on
  95
+					firstTabWithErrors.closest('.tabset').tabs('select', firstTabWithErrors.attr('id'));
91 96
 				}
92 97
 				
93 98
 				// Move navigator to preview if one is available.
24  admin/javascript/LeftAndMain.js
@@ -473,6 +473,30 @@ jQuery.noConflict();
473 473
 				}
474 474
 			},
475 475
 
  476
+			/**
  477
+			 * Remove any previously saved state.
  478
+			 *
  479
+			 * Parameters:
  480
+			 *  (String) url Optional (sanitized) URL to clear a specific state.
  481
+			 */
  482
+			clearTabState: function(url) {
  483
+				if(typeof(window.sessionStorage)=="undefined") return;
  484
+
  485
+				var s = window.sessionStorage;
  486
+				if(url) {
  487
+					s.removeItem('tabs-' + url);	
  488
+				} else {
  489
+					for(var i=0;i<s.length;i++) s.removeItem(s.key(i));
  490
+				}
  491
+			},
  492
+
  493
+			/**
  494
+			 * Remove tab state for the current URL.
  495
+			 */
  496
+			clearCurrentTabState: function() {
  497
+				this.clearTabState(this._tabStateUrl());
  498
+			},
  499
+
476 500
 			_tabStateUrl: function() {
477 501
 				return History.getState().url
478 502
 					.replace(/\?.*/, '')

0 notes on commit 09067cc

Please sign in to comment.
Something went wrong with that request. Please try again.