climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1483168 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js
Date Thu, 16 May 2013 03:01:25 GMT
Author: joyce
Date: Thu May 16 03:01:25 2013
New Revision: 1483168

URL: http://svn.apache.org/r1483168
Log:
Resolves CLIMATE-23. Clean up bootstrap-modal and bootstrap-modal-open.

- Updates keyboard toggle attribute to be in line with the attribute
  that is set on the modal toggle.
- Fixes the 'trigger' call that activates the modal to pass parameters
  properly.
- Sets parameters in the modal call for toggling the background and
  esc-exit.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js?rev=1483168&r1=1483167&r2=1483168&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js Thu May 16 03:01:25 2013
@@ -32,14 +32,18 @@ directive('bootstrapModal', function($ti
 				closeModal();
 		}
 
-		openModal = function(event, hasBackground, hasEscapeExit) {
+		openModal = function(event, toggleBackground, toggleKeyboardEscape) {
 			// Grab the current modal tag based on the modalId attribute in the bootstrapModal tag
 			var modal = $('#' + attrs.modalId);
 
 			// Make all the modal's children of class "close" call the appropriate function for closing!
 			$('.close', modal).bind('click', closeModal);
 
-			modal.modal('show');
+			modal.modal({
+				show: true,
+				backdrop: toggleBackground,
+				keyboard: toggleKeyboardEscape,
+			});
 		};
 
 		closeModal = function(event) {
@@ -76,11 +80,11 @@ directive('bootstrapModalOpen', function
 		link: function(scope, elem, attrs) {
 			// Default to showing the background if the user didn't specify a value for this.
 			var hasBackground = (attrs.background === undefined ? true : attrs.background);
-			// Default to allowing an exit on escape if the user didn't provide a value for this.
-			var hasEscapeExit = (attrs.escapeExit === undefined ? true : attrs.escapeExit);
+			// Enable keyboard closing of modal with escape key.
+			var hasKeyboardEscape = (attrs.keyboard === undefined ? true : attrs.keyboard);
 
 			$(elem).bind('click', function() {
-				$('#' + attrs.bootstrapModalOpen).trigger('modalOpen', hasBackground, hasEscapeExit);
+				$('#' + attrs.bootstrapModalOpen).trigger('modalOpen', [hasBackground, hasKeyboardEscape]);
 			});
 		}
 	};



Mime
View raw message