Skip to content
Snippets Groups Projects
Select Git revision
  • f976ece18bf109d453943f1a099da2d6c1ae06be
  • master default protected
  • Vivakvo-master-patch-80805
  • patch-26
  • patch-19
  • patch-25
  • patch-24
  • patch-23
  • patch-22
  • patch-21
  • patch-18
  • patch-17
  • Vivakvo-master-patch-99327
  • patch-16
  • patch-15
  • patch-14
  • patch-13
  • patch-12
  • patch-11
  • patch-10
  • patch-9
  • v1.4.1
  • v1.4.0
  • v1.3.11
  • v1.3.10
  • v1.3.9
  • v1.3.8
  • v1.3.7
  • v1.3.6
  • v1.3.5
  • v1.3.4
  • v1.3.3
  • v1.3.2
  • v1.3.1
  • v1.3.0
  • v1.2.10
  • v1.2.9
  • v1.2.8
  • v1.2.7
  • v1.2.6
  • v1.2.5
41 results

config.js

Blame
  • Forked from clients / Cesium-grp / Cesium
    Source project has a limited visibility.
    settings-controllers.js 4.19 KiB
    
    angular.module('cesium.settings.controllers', ['cesium.services', 'cesium.currency.controllers'])
    
      .config(function($stateProvider, $urlRouterProvider) {
        'ngInject';
    
        $stateProvider
    
          .state('app.settings', {
            url: "/settings",
            views: {
              'menuContent': {
                templateUrl: "templates/settings/settings.html",
                controller: 'SettingsCtrl'
              }
            }
          })
        ;
      })
    
      .controller('SettingsCtrl', SettingsController)
    ;
    
    function SettingsController($scope, $state, UIUtils, Wallet, $translate, BMA, $q, $ionicPopup, $timeout, localStorage) {
      'ngInject';
    
      $scope.locales = [
          {id:'fr-FR', label:'Français'},
          {id:'en', label:'English'}
        ];
      $scope.formData = angular.copy(Wallet.defaultSettings);
      $scope.loading = true;
    
      $scope.$on('$ionicView.enter', function(e, $state) {
        $scope.loading = true; // to avoid the call of Wallet.store()
        $scope.formData.locale = _.findWhere($scope.locales, {id: $translate.use()});
        Wallet.restore()
        .then(function() {
          angular.merge($scope.formData, Wallet.data.settings);
          if (Wallet.data.settings.locale && Wallet.data.settings.locale.id) {
            $scope.formData.locale = _.findWhere($scope.locales, {id: Wallet.data.settings.locale.id});
          }
          UIUtils.loading.hide();
          $scope.loading = false;
        })
        .catch(function(err) {
          $scope.loading = false;
          UIUtils.loading.hide();
        });
      });
    
      $scope.setSettingsForm = function(settingsForm) {
        $scope.settingsForm = settingsForm;
      };
    
      $scope.changeLanguage = function(langKey) {
        $translate.use(langKey);
      };
    
      // Change node
      $scope.changeNode= function(node) {
        if (!node) {
          node = $scope.formData.node;
        }
        $scope.showNodePopup(node)
        .then(function(node) {
          if (node == $scope.formData.node) {
            return; // same node = nothing to do
          }
          UIUtils.loading.show();