diff --git a/app/config.json b/app/config.json index 409b72c95ce456896aea55e43aa53558249f520d..64f9fcd2e47d5a4063a7f3edab97ab9644c86781 100644 --- a/app/config.json +++ b/app/config.json @@ -14,7 +14,7 @@ }, "plugins":{ "es": { - "enable": "false", + "enable": false, "host": "test-net.duniter.fr", "port": "9203" } @@ -36,8 +36,8 @@ }, "plugins":{ "es": { - "enable": "false", - "host": "192.168.0.28", + "enable": false, + "host": "192.168.0.5", "port": "9203" } } diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index b44dd9051a5df736a6d2f1d8f53b31f6c35d2044..ed7d9a47937743119f0e7af9794f41dd85cca19d 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -88,6 +88,8 @@ "AUTHENTICATION_SETTINGS": "Authentication", "REMEMBER_ME": "Remember me", "PLUGINS_SETTINGS": "Extensions", + "MENU_TITLE": "Options", + "BTN_RESET": "Restore default values", "POPUP_NODE": { "TITLE" : "Duniter Node", "HELP" : "Set the address of the node to use:" diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 2baf9ea99370e828f9ef11565494bb5d264b168d..31a7dd19459a9eb0db9a52d2657b8d1455af15e9 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -88,6 +88,8 @@ "AUTHENTICATION_SETTINGS": "Authentification", "REMEMBER_ME": "Se souvenir de moi", "PLUGINS_SETTINGS": "Extensions", + "MENU_TITLE": "Options", + "BTN_RESET": "Restaurer les valeurs par défaut", "POPUP_NODE": { "TITLE" : "Noeud Duniter", "HELP" : "Saisissez l'adresse du noeud que vous voulez utiliser :" @@ -161,7 +163,7 @@ }, "ACCOUNT": { "TITLE": "Mon compte", - "MENU_TITLE": "Options du portefeuille", + "MENU_TITLE": "Options", "BALANCE": "Solde", "LAST_TX": "Dernières transactions", "NO_TX": "Aucune transaction", diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index 8e498c79e490510f4c3ad219ac61fe4a20f85811..641e2f76447de61b9fbcf4326d64c7808d13a693 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -20,14 +20,14 @@ angular.module('cesium.settings.controllers', ['cesium.services', 'cesium.curren .controller('SettingsCtrl', SettingsController) ; -function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHttp, UIUtils, BMA, csSettings) { +function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHttp, UIUtils, BMA, csSettings, $ionicPopover) { 'ngInject'; $scope.formData = angular.copy(csSettings.data); $scope.popupData = {}; // need for the node popup $scope.loading = true; - $scope.$on('$ionicView.enter', function(e, $state) { + $scope.$on('$ionicView.enter', function(e) { $scope.loading = true; // to avoid the call of Wallet.store() $scope.locales = UIUtils.locales; $scope.formData.locale = _.findWhere($scope.locales, {id: $translate.use()}); @@ -43,12 +43,33 @@ function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHtt // Set Ink UIUtils.ink({selector: '.item'}); }, 100); + + + }); + + $ionicPopover.fromTemplateUrl('templates/settings/popover_actions.html', { + scope: $scope + }).then(function(popover) { + $scope.actionsPopover = popover; + }); + + //Cleanup the popover when we're done with it! + $scope.$on('$destroy', function() { + $scope.actionsPopover.remove(); }); $scope.setPopupForm = function(popupForm) { $scope.popupForm = popupForm; }; + $scope.reset = function() { + if ($scope.actionsPopover) { + $scope.actionsPopover.hide(); + } + csSettings.reset(); + angular.merge($scope.formData, csSettings.data); + }; + $scope.changeLanguage = function(langKey) { $translate.use(langKey); }; diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 983d60f589425d8a0d092905076787d4a40550e2..5af39d644d69dd62eaa39e83ebe4df4801466ffd 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -4,7 +4,7 @@ angular.module('cesium.es.common.controllers', ['ngResource', 'cesium.es.service .config(function(PluginServiceProvider, csConfig) { 'ngInject'; - var enable = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.enable; + var enable = csConfig.plugins && csConfig.plugins.es; if (enable) { // Menu extension points PluginServiceProvider.extendState('app', { diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js index da91a34fada31198fb98ba133ec70867a2d32fb3..a9bc5f0a8462f3e663c87581ba4929a9ca06f579 100644 --- a/www/plugins/es/js/controllers/settings-controllers.js +++ b/www/plugins/es/js/controllers/settings-controllers.js @@ -4,7 +4,7 @@ angular.module('cesium.es.settings.controllers', ['cesium.es.services']) .config(function(PluginServiceProvider, $stateProvider, csConfig) { 'ngInject'; - var enable = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.enable; + var enable = csConfig.plugins && csConfig.plugins.es; if (enable) { // Extend settings via extension points PluginServiceProvider.extendState('app.settings', { @@ -42,15 +42,7 @@ function ESExtendSettingsController ($scope, PluginService, csSettings) { 'ngInject'; $scope.extensionPoint = PluginService.extensions.points.current.get(); - $scope.enable = false; - // Update settings if need - $scope.onSettingsLoaded = function() { - if ($scope.loading) { - $scope.enable = csSettings.data.plugins && csSettings.data.plugins.es && csSettings.data.plugins.es.enable; - } - }; - $scope.$watch('formData', $scope.onSettingsLoaded, true); } /* diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index 5936fcfe51b4f1e971ba4755a4e86608311be99a..3f1910634873ef9eaedf3361002f9512d32e8dff 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -2,7 +2,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se .config(function(PluginServiceProvider, csConfig) { 'ngInject'; - var enable = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.enable; + var enable = csConfig.plugins && csConfig.plugins.es; if (enable) { // Will force to load this service PluginServiceProvider.registerEagerLoadingService('esUser'); @@ -212,9 +212,8 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se function isEnable() { return csSettings.data.plugins && - csSettings.data.plugins.es && - csSettings.data.plugins.es.enable && - !!esHttp.getServer(host, port); + csSettings.data.plugins.es && + host && csSettings.data.plugins.es.enable; } function refreshListeners() { diff --git a/www/plugins/es/templates/settings/settings_extend.html b/www/plugins/es/templates/settings/settings_extend.html index 0d9d277f92f5889de75d85a2417f88d97b05ee4f..4cdf3c353ff9ed7909db01e11eb4f27a994013b9 100644 --- a/www/plugins/es/templates/settings/settings_extend.html +++ b/www/plugins/es/templates/settings/settings_extend.html @@ -5,7 +5,7 @@ <div class="input-label ng-binding" translate>ES_SETTINGS.PLUGIN_NAME</div> <h3 class="item-note"> - <span class="dark" ng-if="enable" translate>COMMON.ENABLE</span> - <span ng-if="!enable" translate>COMMON.DISABLE</span> + <span class="dark" ng-if="formData.plugins.es.enable" translate>COMMON.ENABLE</span> + <span ng-if="!formData.plugins.es.enable" translate>COMMON.DISABLE</span> </h3> </div> diff --git a/www/templates/settings/popover_actions.html b/www/templates/settings/popover_actions.html new file mode 100644 index 0000000000000000000000000000000000000000..8dbdb691a9536b510e9941e4bc3c184fd5516772 --- /dev/null +++ b/www/templates/settings/popover_actions.html @@ -0,0 +1,15 @@ +<ion-popover-view class="fit has-header"> + <ion-header-bar> + <h1 class="title" translate>SETTINGS.MENU_TITLE</h1> + </ion-header-bar> + <ion-content scroll="false"> + <div class="list item-text-wrap"> + + <a class="item item-icon-left ink" + ng-click="reset()"> + <i class="icon ion-refresh"></i> + {{'SETTINGS.BTN_RESET' | translate}} + </a> + </div> + </ion-content> +</ion-popover-view> diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html index 500ac2aac59cabc442ce947cc27938ab2b534eec..0712e6625cb3eeaff57e53b77213df30831f0f68 100644 --- a/www/templates/settings/settings.html +++ b/www/templates/settings/settings.html @@ -3,6 +3,12 @@ class="settings"> <ion-nav-title translate>SETTINGS.TITLE</ion-nav-title> + <ion-nav-buttons side="secondary"> + <button class="button button-icon button-clear" ng-click="actionsPopover.show($event)"> + <i class="icon ion-android-more-vertical"></i> + </button> + </ion-nav-buttons> + <ion-content > <div class="item item-toggle dark"> <div class="input-label">