@@ -53,14 +53,15 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
5353 $timeout ( function ( ) {
5454 qmService . rootScope . setShowActionSheetMenu ( function ( ) {
5555 // Show the action sheet
56+ var allButtons = qmService . actionSheets . actionSheetButtons ;
5657 var hideSheet = $ionicActionSheet . show ( {
5758 buttons : [
58- qmService . actionSheets . actionSheetButtons . refresh ,
59- qmService . actionSheets . actionSheetButtons . settings ,
60- qmService . actionSheets . actionSheetButtons . sortDescendingValue ,
61- qmService . actionSheets . actionSheetButtons . sortAscendingValue ,
62- qmService . actionSheets . actionSheetButtons . sortDescendingTime ,
63- qmService . actionSheets . actionSheetButtons . sortAscendingTime
59+ allButtons . refresh ,
60+ allButtons . settings ,
61+ allButtons . sortDescendingValue ,
62+ allButtons . sortAscendingValue ,
63+ allButtons . sortDescendingTime ,
64+ allButtons . sortAscendingTime
6465 ] ,
6566 cancelText : '<i class="icon ion-ios-close"></i>Cancel' ,
6667 cancel : function ( ) {
@@ -73,16 +74,16 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
7374 if ( index === 1 ) {
7475 qmService . goToState ( qm . stateNames . settings ) ;
7576 }
76- if ( button . text === qmService . actionSheets . actionSheetButtons . sortDescendingValue . text ) {
77+ if ( button . text === allButtons . sortDescendingValue . text ) {
7778 changeSortAndGetHistory ( '-value' ) ;
7879 }
79- if ( button . text === qmService . actionSheets . actionSheetButtons . sortAscendingValue . text ) {
80+ if ( button . text === allButtons . sortAscendingValue . text ) {
8081 changeSortAndGetHistory ( 'value' ) ;
8182 }
82- if ( button . text === qmService . actionSheets . actionSheetButtons . sortDescendingTime . text ) {
83+ if ( button . text === allButtons . sortDescendingTime . text ) {
8384 changeSortAndGetHistory ( '-startTime' ) ;
8485 }
85- if ( button . text === qmService . actionSheets . actionSheetButtons . sortAscendingTime . text ) {
86+ if ( button . text === allButtons . sortAscendingTime . text ) {
8687 changeSortAndGetHistory ( 'startTime' ) ;
8788 }
8889 return true ;
@@ -277,26 +278,27 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
277278 } , 20000 ) ;
278279 } ) ;
279280 }
280- $scope . deleteMeasurement = function ( measurement ) {
281- measurement . hide = true ;
282- qmService . deleteMeasurementFromServer ( measurement ) ;
281+ $scope . deleteMeasurement = function ( m ) {
282+ m . hide = true ;
283+ qmService . deleteMeasurementFromServer ( m ) ;
283284 } ;
284285 qmService . navBar . setFilterBarSearchIcon ( false ) ;
285- $scope . showActionSheetForMeasurement = function ( measurement ) {
286- $scope . state . measurement = measurement ;
287- var variableObject = JSON . parse ( JSON . stringify ( measurement ) ) ;
288- variableObject . variableId = measurement . variableId ;
289- variableObject . name = measurement . variableName ;
286+ $scope . showActionSheetForMeasurement = function ( m ) {
287+ $scope . state . measurement = m ;
288+ var variableObject = JSON . parse ( JSON . stringify ( m ) ) ;
289+ variableObject . variableId = m . variableId ;
290+ variableObject . name = m . variableName ;
291+ var allButtons = qmService . actionSheets . actionSheetButtons ;
290292 var buttons = [
291293 { text : '<i class="icon ion-edit"></i>Edit Measurement' } ,
292- qmService . actionSheets . actionSheetButtons . reminderAdd ,
293- qmService . actionSheets . actionSheetButtons . charts ,
294- qmService . actionSheets . actionSheetButtons . historyAllVariable ,
295- qmService . actionSheets . actionSheetButtons . variableSettings ,
296- qmService . actionSheets . actionSheetButtons . relationships
294+ allButtons . reminderAdd ,
295+ allButtons . charts ,
296+ allButtons . historyAllVariable ,
297+ allButtons . variableSettings ,
298+ allButtons . relationships
297299 ] ;
298- if ( measurement . url ) {
299- buttons . push ( qmService . actionSheets . actionSheetButtons . openUrl ) ;
300+ if ( m . url ) {
301+ buttons . push ( allButtons . openUrl ) ;
300302 }
301303 var hideSheet = $ionicActionSheet . show ( {
302304 buttons : buttons ,
@@ -327,12 +329,12 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
327329 qmService . goToCorrelationsListForVariable ( $scope . state . measurement . variableName ) ;
328330 }
329331 if ( index === 6 ) {
330- qm . urlHelper . openUrlInNewTab ( measurement . url ) ;
332+ qm . urlHelper . openUrlInNewTab ( m . url ) ;
331333 }
332334 return true ;
333335 } ,
334336 destructiveButtonClicked : function ( ) {
335- $scope . deleteMeasurement ( measurement ) ;
337+ $scope . deleteMeasurement ( m ) ;
336338 return true ;
337339 }
338340 } ) ;
0 commit comments