climate-commits mailing list archives

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

URL: http://svn.apache.org/r1483172
Log:
Resolves CLIMATE-28. Update selection drop down box display.

- In selectObservation, when there are multiple options for a given
  parameter select box the default selection value is set to "Please
  select an option". This should alert the user to the presence of
  multiple options.

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

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js?rev=1483172&r1=1483171&r2=1483172&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js Thu May 16 03:01:35 2013
@@ -378,12 +378,19 @@ function ObservationSelectCtrl($rootScop
 				$scope.lats = [data.latname];
 				$scope.lons = [data.lonname];
 				$scope.latLonVals = [data.latMin, data.latMax, data.lonMin, data.lonMax];
+
+				// If there is more than one option for the user, tell them they need to pick one!
+				if ($scope.lats.length > 1) $scope.lats.splice(0, 0, "Please select an option");
+				if ($scope.lons.length > 1) $scope.lons.splice(0, 0, "Please select an option");
+				// Default the display to the first available option.
 				$scope.latsSelect = $scope.lats[0];
 				$scope.lonsSelect = $scope.lons[0];
 
 				// Handle time results
 				var data = arrayOfResults[2].data
 				$scope.times = [data.timename];
+
+				if ($scope.times.length > 1) $scope.times.splice(0, 0, "Please select an option");
 				$scope.timeSelect = $scope.times[0];
 
 				// Handle parameter results
@@ -392,9 +399,11 @@ function ObservationSelectCtrl($rootScop
 				$scope.params = $.grep($scope.params, 
 									function(val) {
 										return ($.inArray(val, $scope.lats)  != 0 && 
-											    $.inArray(val, $scope.lons)  != 0 && 
-											    $.inArray(val, $scope.times) != 0);
+												$.inArray(val, $scope.lons)  != 0 && 
+												$.inArray(val, $scope.times) != 0);
 									});
+				
+				if ($scope.params.length > 1) $scope.params.splice(0, 0, "Please select an option");
 				$scope.paramSelect = $scope.params[0];
 			},
 			// Uh oh! AT LEAST on of our fetches failed



Mime
View raw message