Commits

Christoffer Niska committed c49656c

Fixed a few minor issues with the jQuery UI widgets.

  • Participants
  • Parent commits 0e61b64

Comments (0)

Files changed (4)

File assets/js/jquery.ui.bootalert.js

 		name: 'alert',
 		/**
 		 * Widget options.
+		 * - keys: The valid alert types.
+		 * - template: The HTML template for displaying alerts.
+		 * - displayTime: The time to display each alert.
+		 * - closeTime: The duration for closing each alert.
 		 * @type Object
 		 */
 		options: {
 			keys: [ 'success', 'info', 'warning', 'error' ],
 			template: '<div class="alert-message {key}"><p>{message}</p></div>',
 			displayTime: 5000,
-			fadeOutTime: 350
+			closeTime: 350
 		},
 		/**
 		 * Creates the widget.
 		 */
 		_create: function() {
-			var alerts = this.element.find( '.alert-message' );
+			var self = this,
+				alerts = self.element.find( '.alert-message' );
 
 			for ( var i = 0, l = alerts.length; i < l; ++i ) {
-				var alert = $( alerts[ i ] );
-				this._appendCloseLink( alert );
+				var alert = $( alerts[ i ] ),
+					closeLink = self._createCloseLink( alert );
+
+				closeLink.prependTo( alert );
+
+				if ( self.options.closeTime > 0 ) {
+					setTimeout( function() {
+						self.close( alert );
+					}, self.options.displayTime );
+				}
 			}
 		},
 		/**
 				var alert = $( template )
 					.appendTo( this.element );
 
-				this._appendCloseLink( alert );
+				var closeLink = this._createCloseLink( alert );
+				closeLink.prependTo( alert );
 			}
 
 			return this;
 		},
 		/**
-		 * Closes the alert.
-		 * @param {HTMLElement} alert The alert element.
+		 * Closes a specific alert message.
+		 * @param {Object} alert The alert element.
 		 */
 		close: function( alert ) {
-			alert.fadeOut( this.options.fadeTime, function() {
-				alert.html( '' );
-			});
+			if (alert) {
+				alert.fadeOut( this.options.closeTime, function() {
+					$( this ).html( '' );
+				});
+			}
 
 			return this;
 		},
 		/**
-		 * Creates the close link for a specific alert message.
-		 * @param {HTMLElement} alert The alert element.
+		 * Creates the close link.
+		 * @param {Object} alert The alert element.
 		 */
-		_appendCloseLink: function( alert ) {
+		_createCloseLink: function( alert ) {
 			var self = this;
 
-			$( '<a class="close" href="#">x</a>' )
+			return $( '<a class="close" href="#">x</a>' )
 				.bind( 'click', function( event ) {
-					self.close( alert, self.options.fadeOutTime );
+					self.close( alert );
 					event.preventDefault();
 					return false;
-				} ).prependTo( self.element.children() );
-
-			if ( self.options.fadeOutTime > 0 ) {
-				setTimeout( function() {
-					self.close( alert, self.options.fadeOutTime );
-				}, self.options.displayTime );
-			}
+				} );
 		},
 		/**
 		 * Destructs this widget.

File assets/js/jquery.ui.bootmodal.js

 		 * Widget options.
 		 * - backdropClose: Indicates whether clicking on the backdrop closes the modal.
 		 * - buttons: Button configurations.
-		 * - closeTime: The delay for closing the modal.
+		 * - closeTime: The duration for closing the modal.
 		 * - escapeClose: Indicates whether pressing escape closes the modal.
 		 * - open: Indicates whether to open the modal on initialization.
+		 * - openTime: The duration for opening the modal.
 		 * - title: The modal title text.
 		 * @type Object
 		 */

File assets/js/jquery.ui.bootpopover.js

 		tooltipId: 'popover',
 		/**
 		 * Widget options.
+		 * - placement: The placement of the tooltip. Valid values are: "above", "right", "below" and "left".
+		 * - showEvent: The event for showing the tooltip.
+		 * - hideEvent: The event for hiding the tooltip.
+		 * - live: Indicates whether to use jQuery.live or jQuery.bind.
 		 * @type Object
 		 */
 		options: {

File assets/js/jquery.ui.boottwipsy.js

 		visible: false,
 		/**
 		 * Widget options.
+		 * - placement: The placement of the tooltip. Valid values are: "above", "right", "below" and "left".
+		 * - showEvent: The event for showing the tooltip.
+		 * - hideEvent: The event for hiding the tooltip.
+		 * - live: Indicates whether to use jQuery.live or jQuery.bind.
 		 * @type Object
 		 */
 		options: {