@@ -53,14 +53,15 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
53
53
$timeout ( function ( ) {
54
54
qmService . rootScope . setShowActionSheetMenu ( function ( ) {
55
55
// Show the action sheet
56
+ var allButtons = qmService . actionSheets . actionSheetButtons ;
56
57
var hideSheet = $ionicActionSheet . show ( {
57
58
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
64
65
] ,
65
66
cancelText : '<i class="icon ion-ios-close"></i>Cancel' ,
66
67
cancel : function ( ) {
@@ -73,16 +74,16 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
73
74
if ( index === 1 ) {
74
75
qmService . goToState ( qm . stateNames . settings ) ;
75
76
}
76
- if ( button . text === qmService . actionSheets . actionSheetButtons . sortDescendingValue . text ) {
77
+ if ( button . text === allButtons . sortDescendingValue . text ) {
77
78
changeSortAndGetHistory ( '-value' ) ;
78
79
}
79
- if ( button . text === qmService . actionSheets . actionSheetButtons . sortAscendingValue . text ) {
80
+ if ( button . text === allButtons . sortAscendingValue . text ) {
80
81
changeSortAndGetHistory ( 'value' ) ;
81
82
}
82
- if ( button . text === qmService . actionSheets . actionSheetButtons . sortDescendingTime . text ) {
83
+ if ( button . text === allButtons . sortDescendingTime . text ) {
83
84
changeSortAndGetHistory ( '-startTime' ) ;
84
85
}
85
- if ( button . text === qmService . actionSheets . actionSheetButtons . sortAscendingTime . text ) {
86
+ if ( button . text === allButtons . sortAscendingTime . text ) {
86
87
changeSortAndGetHistory ( 'startTime' ) ;
87
88
}
88
89
return true ;
@@ -277,26 +278,27 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
277
278
} , 20000 ) ;
278
279
} ) ;
279
280
}
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 ) ;
283
284
} ;
284
285
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 ;
290
292
var buttons = [
291
293
{ 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
297
299
] ;
298
- if ( measurement . url ) {
299
- buttons . push ( qmService . actionSheets . actionSheetButtons . openUrl ) ;
300
+ if ( m . url ) {
301
+ buttons . push ( allButtons . openUrl ) ;
300
302
}
301
303
var hideSheet = $ionicActionSheet . show ( {
302
304
buttons : buttons ,
@@ -327,12 +329,12 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
327
329
qmService . goToCorrelationsListForVariable ( $scope . state . measurement . variableName ) ;
328
330
}
329
331
if ( index === 6 ) {
330
- qm . urlHelper . openUrlInNewTab ( measurement . url ) ;
332
+ qm . urlHelper . openUrlInNewTab ( m . url ) ;
331
333
}
332
334
return true ;
333
335
} ,
334
336
destructiveButtonClicked : function ( ) {
335
- $scope . deleteMeasurement ( measurement ) ;
337
+ $scope . deleteMeasurement ( m ) ;
336
338
return true ;
337
339
}
338
340
} ) ;
0 commit comments