diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-09-01 11:44:40 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-09-01 11:44:40 -0400 |
| commit | 2e1a669455190e3d0d857e613cc34cd22f4862c0 (patch) | |
| tree | 850e2d0abcd5dbbc603b5f054725691ed5abb951 /www/js/HelpCtrl.js | |
| parent | dc5dd1c8684266c320cccd6e8943b5d419a280e4 (diff) | |
mostly formatting and removal of console.logs
Former-commit-id: 5cbac40ad5ccb7096fb7b9f58696e923ba282232
Diffstat (limited to 'www/js/HelpCtrl.js')
| -rw-r--r-- | www/js/HelpCtrl.js | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/www/js/HelpCtrl.js b/www/js/HelpCtrl.js index 15504f7b..8506b2f1 100644 --- a/www/js/HelpCtrl.js +++ b/www/js/HelpCtrl.js @@ -2,66 +2,67 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console, Masonry */ -angular.module('zmApp.controllers').controller('zmApp.HelpCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel','$ionicSideMenuDelegate', '$ionicHistory', '$state', '$translate', '$q', '$templateRequest', '$sce', '$compile', function ($scope, $rootScope, $ionicModal, ZMDataModel,$ionicSideMenuDelegate, $ionicHistory, $state, $translate, $q, $templateRequest, $sce, $compile) { -$scope.openMenu = function () { - $ionicSideMenuDelegate.toggleLeft(); - }; +angular.module('zmApp.controllers').controller('zmApp.HelpCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicHistory', '$state', '$translate', '$q', '$templateRequest', '$sce', '$compile', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicHistory, $state, $translate, $q, $templateRequest, $sce, $compile) { + $scope.openMenu = function () { + $ionicSideMenuDelegate.toggleLeft(); + }; //---------------------------------------------------------------- // Alarm notification handling //---------------------------------------------------------------- - $scope.handleAlarms = function() - { - $rootScope.isAlarm=!$rootScope.isAlarm; - if (!$rootScope.isAlarm) - { - $rootScope.alarmCount="0"; - $ionicHistory.nextViewOptions({disableBack: true}); - $state.go("events", {"id": 0}, { reload: true }); + $scope.handleAlarms = function () { + $rootScope.isAlarm = !$rootScope.isAlarm; + if (!$rootScope.isAlarm) { + $rootScope.alarmCount = "0"; + $ionicHistory.nextViewOptions({ + disableBack: true + }); + $state.go("events", { + "id": 0 + }, { + reload: true + }); } }; - - function insertHelp() - { - - - + //---------------------------------------------------------------- + // This function dynamically inserts the relevant help text file + // based on selected language + //---------------------------------------------------------------- + + function insertHelp() { + var l = ZMDataModel.getDefaultLanguage() || 'en'; - var lang = "lang/help/help-"+l+".html"; - console.log ("LANG IS " + lang); + var lang = "lang/help/help-" + l + ".html"; + //console.log ("LANG IS " + lang); var templateUrl = $sce.getTrustedResourceUrl(lang); - var lang_fb= "lang/help/help-"+"en"+".html"; + var lang_fb = "lang/help/help-" + "en" + ".html"; var templateUrlFB = $sce.getTrustedResourceUrl(lang_fb); - + $templateRequest(lang) - .then (function(template) - { + .then(function (template) { var elem = angular.element(document.getElementById('insertHelp')); - $compile(elem.html(template).contents())($scope); - }, - function (error) - { - ZMDataModel.zmLog ("Language file " + lang + " not found, falling back"); + $compile(elem.html(template).contents())($scope); + }, + function (error) { + ZMDataModel.zmLog("Language file " + lang + " not found, falling back"); $templateRequest(templateUrlFB) - .then (function( template) - { + .then(function (template) { var elem = angular.element(document.getElementById('insertHelp')); $compile(elem.html(template).contents())($scope); - }, - function (error) - { + }, + function (error) { ZMDataModel.zmLog("fallback help not found"); - }); + }); } - ); - - - + ); + + + } - //------------------------------------------------------------------------- + //------------------------------------------------------------------------- // Lets make sure we set screen dim properly as we enter // The problem is we enter other states before we leave previous states // from a callback perspective in ionic, so we really can't predictably @@ -73,11 +74,11 @@ $scope.openMenu = function () { ZMDataModel.setAwake(false); $scope.zmAppVersion = ZMDataModel.getAppVersion(); insertHelp(); - - - + + + }); -}]); +}]);
\ No newline at end of file |
