diff --git a/www/css/style.css b/www/css/style.css index d3a3194af2a0afe7d22a652f30248c1d1f50e4eb..c406ac90109385ace755f9e90c8b96160ca1e65d 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -184,7 +184,7 @@ top:16px !important; } -#settings .item-divider { +.settings .item-divider { background-color: #f5f5f5; } diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 26d9e1ce18e8ac8b30885b6ed3916aaf8e92e84c..0eae981512b729b700b21024ba91a83a49e8efe7 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -32,7 +32,9 @@ "UD": "UD", "DATE_PATTERN": "YYYY-MM-DD HH:mm", "EMPTY_PARENTHESIS": "(empty)", - "UID": "Pseudonym" + "UID": "Pseudonym", + "ENABLE": "Enable", + "DISABLE": "Disable" }, "SYSTEM": { "PICTURE_CHOOSE_TYPE": "Choose picture source :", @@ -81,6 +83,7 @@ "DISPLAY_UD_HISTORY": "Show received dividends ?", "AUTHENTICATION_SETTINGS": "Authentication", "REMEMBER_ME": "Remember me", + "PLUGINS_SETTINGS": "Extensions", "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 068427418dbd1e16ea3a07cf3b56f2893e4840b4..063d5c699c0b239fc3ca3a047ce029726feee1fd 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -32,7 +32,9 @@ "UD": "DU", "DATE_PATTERN": "DD/MM/YYYY HH:mm", "EMPTY_PARENTHESIS": "(vide)", - "UID": "Pseudonyme" + "UID": "Pseudonyme", + "ENABLE": "Activé", + "DISABLE": "Désactivé" }, "SYSTEM": { "PICTURE_CHOOSE_TYPE": "Choisir la source :", @@ -81,6 +83,7 @@ "DISPLAY_UD_HISTORY": "Voir les dividendes reçus ?", "AUTHENTICATION_SETTINGS": "Authentification", "REMEMBER_ME": "Se souvenir de moi", + "PLUGINS_SETTINGS": "Extensions", "POPUP_NODE": { "TITLE" : "Noeud Duniter", "HELP" : "Saisissez l'adresse du noeud que vous voulez utiliser :" diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index 50e0abb2431efc9f2320d07602368e1b553a43f0..b01b86b538f035c4111a41fed7d89d73562bf71e 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -36,6 +36,12 @@ function SettingsController($scope, $state, UIUtils, Wallet, $translate, BMA, $q } UIUtils.loading.hide(); $scope.loading = false; + + // Set Ink + $timeout(function() { + // Set Ink + UIUtils.ink({selector: '.item'}); + }, 100); }); $scope.setSettingsForm = function(settingsForm) { @@ -107,6 +113,7 @@ function SettingsController($scope, $state, UIUtils, Wallet, $translate, BMA, $q ] }) .then(function(node) { + delete $scope.formData.newNode; if (!node) { // user cancel UIUtils.loading.hide(); return; @@ -127,9 +134,5 @@ function SettingsController($scope, $state, UIUtils, Wallet, $translate, BMA, $q }; $scope.$watch('formData', $scope.onSettingsChanged, true); - // Set Ink - $timeout(function() { - // Set Ink - UIUtils.ink({selector: '.item'}); - }, 10); + } diff --git a/www/js/services/device-services.js b/www/js/services/device-services.js index 20bd9e80963186ec650b72b578dc5a0432add5e3..07a521be93cc7b582e67bd228699058b54bbf789 100644 --- a/www/js/services/device-services.js +++ b/www/js/services/device-services.js @@ -80,14 +80,16 @@ angular.module('cesium.device.services', ['ngResource', 'cesium.utils.services'] }); }; - scan = function () { + scan = function (n) { return $q(function(resolve,reject){ if (!enable) { reject("Barcode scanner not enable. Please call 'Device.ready()' once before use (e.g in app.js)."); return; } - $cordovaBarcodeScanner.scan() - .then(function(result) { + cordova.plugins.barcodeScanner.scan( + function(result) { + //console.log('bar code result'); + //console.log(result); if (!result.cancelled) { resolve(result.text); // make sure to convert into String } @@ -95,7 +97,8 @@ angular.module('cesium.device.services', ['ngResource', 'cesium.utils.services'] resolve(); } }, - function(error) {reject(error);}); + function(err) {reject(err);}, + n); }); }; diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 554fa910379e1bde41af2cc45669c628d186e6ea..b3897e57cac40cec1ddcee39d1f70deef082653d 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -144,7 +144,7 @@ angular.module('cesium.utils.services', ['ngResource']) } // Otherwise, log to console and display error else { - console.error('>>>>>>>' , err); + console.error(err); hideLoading(10); // timeout, to avoid bug on transfer (when error on reference) alertError(fullMsg, subtitle); } @@ -309,6 +309,7 @@ angular.module('cesium.utils.services', ['ngResource']) this.motion.fadeSlideIn= disableMotion('.animate-fade-slide-in'); this.motion.fadeSlideInRight = disableMotion('.animate-fade-slide-in-right'); + this.motion.ripple = disableMotion('.animate-ripple'); } return { diff --git a/www/lib/ionic/js/angular/angular-api.js b/www/lib/ionic/js/angular/angular-api.js index f8cdc2bdd22af881ddc932f17464b2ea4f34568a..212eef827dd1c2b72af58d1525d65a0b0b548769 100644 --- a/www/lib/ionic/js/angular/angular-api.js +++ b/www/lib/ionic/js/angular/angular-api.js @@ -100,7 +100,8 @@ // Creating raise that return a promise event method: featureName.raisePromise.eventName feature.raisePromise[eventName] = function() { var deferred = $q.defer(); - if (!$rootScope.$$listeners[eventId]) { + // If no listener: continue + if (!$rootScope.$$listenerCount[eventId]) { deferred.resolve(); } else { @@ -132,6 +133,10 @@ listener.dereg(); var index = self.eventListeners.indexOf(listener); self.eventListeners.splice(index, 1); + // If empty, completely remove the event array + //if (!$rootScope.$$listenerCount[eventId]) { + // delete $rootScope.$$listeners[eventId]; + //} }; scope.$on('$destroy', function() { diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index e78a82fffcdf54e5f37f867c834586c807e7fd0f..7ca7936e18e3cd08703c3517b44975d05d792620 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -144,7 +144,13 @@ } }, "SETTINGS": { + "PLUGIN_NAME": "Registry and market place", + "ENABLE_TOGGLE": "Enable extension ?", "ES_NODE": "Data node address", - "ES_NODE_HELP": "server.domain.com:port" + "ES_NODE_HELP": "server.domain.com:port", + "POPUP_NODE": { + "TITLE" : "Data Node", + "HELP" : "Set the address of the node to use:" + } } } diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index d8fe52bba4249463040d236ae01430c06dda07f5..2b5def94e4c7e5022c7ec0decd5f95f82dddc641 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -143,8 +143,14 @@ "PROFILE_SAVED": "Profil sauvegardé" } }, - "SETTINGS": { - "ES_NODE": "Addresse du noeud de données", - "ES_NODE_HELP": "server.domain.com:port" + "ES_SETTINGS": { + "PLUGIN_NAME": "Annuaire et place de marché", + "ENABLE_TOGGLE": "Activé l'extension ?", + "NODE": "Addresse du noeud de données", + "NODE_HELP": "server.domain.com:port", + "POPUP_NODE": { + "TITLE" : "Noeud de données", + "HELP" : "Saisissez l'adresse du noeud que vous voulez utiliser :" + } } } diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 64c67d1a405a1e03a6d624f894a743bebfc3e8f5..a6e7c51077eb8d339b9666b4a84822ff8a8da501 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -11,17 +11,20 @@ angular.module('cesium.es.common.controllers', ['cesium.es.services']) points: { 'menu-main': { templateUrl: "plugins/es/templates/menu_extend.html", - controller: "PluginExtensionPointCtrl" + controller: "ESMenuExtendCtrl" }, 'menu-user': { templateUrl: "plugins/es/templates/menu_extend.html", - controller: "PluginExtensionPointCtrl" + controller: "ESMenuExtendCtrl" } } }); } }) + + .controller('ESMenuExtendCtrl', ESMenuExtendController) + .controller('ESPicturesEditCtrl', ESPicturesEditController) .controller('ESSocialsEditCtrl', ESSocialsEditController) @@ -30,6 +33,18 @@ angular.module('cesium.es.common.controllers', ['cesium.es.services']) ; +/** + * Control menu extension + */ +function ESMenuExtendController($scope, PluginService, Wallet) { + 'ngInject'; + $scope.extensionPoint = PluginService.extensions.points.current.get(); + + $scope.es = Wallet.data.settings.plugins && Wallet.data.settings.plugins.es ? Wallet.data.settings.plugins.es : { + enable: false + }; +} + function ESPicturesEditController($scope, $ionicModal, Wallet, esMarket, UIUtils, $state, CryptoUtils, $q, $ionicPopup, Device, $timeout, ModalUtils) { 'ngInject'; diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js index 97f2d39370fdbcc4948e5921401d128b5707f117..a1c04cfa523870df66790ebe75bb8bf43a030451 100644 --- a/www/plugins/es/js/controllers/settings-controllers.js +++ b/www/plugins/es/js/controllers/settings-controllers.js @@ -1,7 +1,7 @@ angular.module('cesium.es.settings.controllers', ['cesium.es.services']) // Configure menu items - .config(function(PluginServiceProvider, APP_CONFIG) { + .config(function(PluginServiceProvider, $stateProvider, APP_CONFIG) { 'ngInject'; var enable = !!APP_CONFIG.DUNITER_NODE_ES; @@ -9,44 +9,84 @@ angular.module('cesium.es.settings.controllers', ['cesium.es.services']) // Extend settings via extension points PluginServiceProvider.extendState('app.settings', { points: { - 'network': { + 'plugins': { templateUrl: "plugins/es/templates/settings/settings_extend.html", controller: "ESExtendSettingsCtrl" } } }); + + $stateProvider + .state('app.es_settings', { + url: "/settings/es", + views: { + 'menuContent': { + templateUrl: "plugins/es/templates/settings/plugin_settings.html", + controller: 'ESPluginSettingsCtrl' + } + } + }); } }) .controller('ESExtendSettingsCtrl', ESExtendSettingsController) + .controller('ESPluginSettingsCtrl', ESPluginSettingsController) + ; /* * Settings extend controller */ -function ESExtendSettingsController ($scope, UIUtils, PluginService, APP_CONFIG, esHttp, esMarket, esRegistry, esUser) { +function ESExtendSettingsController ($scope, Wallet, PluginService, APP_CONFIG) { $scope.extensionPoint = PluginService.extensions.points.current.get(); + $scope.enable = false; // Update settings if need $scope.onSettingsLoaded = function() { if ($scope.loading) { - if (!$scope.formData.esNode && APP_CONFIG.DUNITER_NODE_ES) { - $scope.formData.esNode = APP_CONFIG.DUNITER_NODE_ES; + var enable = !!APP_CONFIG.DUNITER_NODE_ES; + if (enable && Wallet.data.settings && Wallet.data.settings.plugins && Wallet.data.settings.plugins.es) { + enable = Wallet.data.settings.plugins.es.enable; } + $scope.enable = enable; } }; $scope.$watch('formData', $scope.onSettingsLoaded, true); +} + +/* + * Settings extend controller + */ +function ESPluginSettingsController ($scope, $q, $translate, $ionicPopup, $ionicHistory, UIUtils, APP_CONFIG, esHttp, esMarket, + esRegistry, esUser, Wallet) { + + $scope.formData = {}; + + $scope.$on('$ionicView.enter', function(e, $state) { + if (!$scope.formData.node && APP_CONFIG.DUNITER_NODE_ES) { + if (Wallet.data.settings && Wallet.data.settings.plugins && Wallet.data.settings.plugins.es) { + angular.merge($scope.formData, Wallet.data.settings.plugins.es); + } + else { + $scope.formData.enable = !!APP_CONFIG.DUNITER_NODE_ES; + } + } + }); + + $scope.setSettingsForm = function(settingsForm) { + $scope.settingsForm = settingsForm; + }; // Change ESnode $scope.changeEsNode= function(node) { if (!node) { - node = $scope.formData.esNode; + node = $scope.formData.node; } $scope.showNodePopup(node) .then(function(node) { - if (node == $scope.formData.esNode) { + if (node == $scope.formData.node) { return; // same node = nothing to do } UIUtils.loading.show(); @@ -63,9 +103,86 @@ function ESExtendSettingsController ($scope, UIUtils, PluginService, APP_CONFIG, newInstance = esUser.instance(node); esUser.copy(newInstance); - $scope.formData.esNode = node; + $scope.formData.node = node; UIUtils.loading.hide(10); }); }; + + // Show node popup + $scope.showNodePopup = function(node) { + return $q(function(resolve, reject) { + $scope.formData.newNode = node; + if (!!$scope.settingsForm) { + $scope.settingsForm.$setPristine(); + } + $translate(['ES_SETTINGS.POPUP_NODE.TITLE', 'ES_SETTINGS.POPUP_NODE.HELP', 'COMMON.BTN_OK', 'COMMON.BTN_CANCEL']) + .then(function (translations) { + // Choose UID popup + $ionicPopup.show({ + templateUrl: 'templates/settings/popup_node.html', + title: translations['ES_SETTINGS.POPUP_NODE.TITLE'], + subTitle: translations['ES_SETTINGS.POPUP_NODE.HELP'], + scope: $scope, + buttons: [ + { text: translations['COMMON.BTN_CANCEL'] }, + { + text: translations['COMMON.BTN_OK'], + type: 'button-positive', + onTap: function(e) { + $scope.settingsForm.$submitted=true; + if(!$scope.settingsForm.$valid || !$scope.settingsForm.newNode) { + //don't allow the user to close unless he enters a node + e.preventDefault(); + } else { + return $scope.formData.newNode; + } + } + } + ] + }) + .then(function(node) { + delete $scope.formData.newNode; + if (!node) { // user cancel + UIUtils.loading.hide(); + return; + } + resolve(node); + }); + }); + }); + }; + + $scope.onSettingsChanged = function() { + if ($scope.loading) { + $timeout(function() { + $scope.onSettingsChanged(); + }, 200); + return; + } + $scope.loading = true; + + if (!Wallet.data.settings.plugins) { + Wallet.data.settings.plugins={}; + } + if (!Wallet.data.settings.plugins.es) { + Wallet.data.settings.plugins.es=$scope.formData; + } + else { + angular.merge(Wallet.data.settings.plugins.es, $scope.formData); + } + + // Update services + esHttp.setEnable($scope.formData.enable); + esUser.refreshListeners(); + + Wallet.store(); + + // Clean cache + $ionicHistory.clearCache(); + + $scope.loading = false; + + }; + $scope.$watch('formData', $scope.onSettingsChanged, true); } diff --git a/www/plugins/es/js/services/comment-services.js b/www/plugins/es/js/services/comment-services.js index a00d181e68208fafc85a0c1e741c6c63ca390f84..bd78ffa78a3a25b562c3ecc6171bad553674d94b 100644 --- a/www/plugins/es/js/services/comment-services.js +++ b/www/plugins/es/js/services/comment-services.js @@ -3,82 +3,81 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services .factory('esComment', function($q, BMA, esHttp) { 'ngInject'; - function ESComment(index) { + function ESComment(index) { - var - fields = { - commons: ["issuer", "time", "message"], - }; + var + fields = { + commons: ["issuer", "time", "message"], + }; - var postSearchComments = esHttp.post('/'+index+'/comment/_search?pretty'); + var postSearchComments = esHttp.post('/'+index+'/comment/_search?pretty'); - function getCommentsByRecord(recordId, size) { - if (!size) { - size = 10; - } - else if (size < 0) { - size = 1000; - } - return $q(function(resolve, reject) { - var errorFct = function(err) { - reject(err); - }; - var request = { - sort : [ - { "time" : {"order" : "desc"}} - ], - query : { - constant_score:{ - filter: { - term: { record : recordId} - } + function getCommentsByRecord(recordId, size) { + if (!size) { + size = 10; + } + else if (size < 0) { + size = 1000; + } + return $q(function(resolve, reject) { + var errorFct = function(err) { + reject(err); + }; + var request = { + sort : [ + { "time" : {"order" : "desc"}} + ], + query : { + constant_score:{ + filter: { + term: { record : recordId} } - }, - from: 0, - size: size, - _source: fields.commons - }; - - postSearchComments(request) - .then(function(res){ - if (res.hits.total === 0) { - resolve([]); - } - else { - BMA.wot.member.uids(true/*cache*/) - .then(function(uids){ - var result = res.hits.hits.reduce(function(result, hit) { - var comment = hit._source; - comment.id = hit._id; - comment.uid = uids[comment.issuer]; - return result.concat(comment); - }, []); - - resolve(result); - }) - .catch(errorFct); } - }) - .catch(errorFct); - }); - } + }, + from: 0, + size: size, + _source: fields.commons + }; - return { + postSearchComments(request) + .then(function(res){ + if (res.hits.total === 0) { + resolve([]); + } + else { + BMA.wot.member.uids(true/*cache*/) + .then(function(uids){ + var result = res.hits.hits.reduce(function(result, hit) { + var comment = hit._source; + comment.id = hit._id; + comment.uid = uids[comment.issuer]; + return result.concat(comment); + }, []); - search: postSearchComments, - all: getCommentsByRecord, - add: esHttp.record.post('/'+index+'/comment'), - update: esHttp.record.post('/'+index+'/comment/:id/_update'), - remove: esHttp.record.remove(index, 'comment'), - fields: { - commons: fields.commons - } - }; + resolve(result); + }) + .catch(errorFct); + } + }) + .catch(errorFct); + }); } - var service = {}; + return { + + search: postSearchComments, + all: getCommentsByRecord, + add: esHttp.record.post('/'+index+'/comment'), + update: esHttp.record.post('/'+index+'/comment/:id/_update'), + remove: esHttp.record.remove(index, 'comment'), + fields: { + commons: fields.commons + } + }; + } - service.instance = ESComment; - return service; + return { + instance: ESComment + }; }) ; diff --git a/www/plugins/es/js/services/http-services.js b/www/plugins/es/js/services/http-services.js index 72b6f82782a8b3ca5761f11ea0650ce50055d4f6..acbcfef319a80569379ee147c4dbdba26a9b4420 100644 --- a/www/plugins/es/js/services/http-services.js +++ b/www/plugins/es/js/services/http-services.js @@ -8,6 +8,11 @@ angular.module('cesium.es.http.services', ['ngResource', 'cesium.services', 'ces function esHttp(server) { + var enable = !!server; + if (enable && Wallet.data && Wallet.data.settings && Wallet.data.settings.plugins && Wallet.data.settings.plugins.es) { + enable = Wallet.data.settings.plugins.es.enable; + } + function copy(otherNode) { if (!!this.instance) { var instance = this.instance; @@ -157,9 +162,13 @@ angular.module('cesium.es.http.services', ['ngResource', 'cesium.services', 'ces $http.defaults.headers.common.Authorization = 'Basic ';*/ } - isEnable = function() { - return !!server; - }; + function isEnable() { + return enable; + } + + function setEnable(value) { + enable = value; + } function emptyHit() { return { @@ -173,6 +182,7 @@ angular.module('cesium.es.http.services', ['ngResource', 'cesium.services', 'ces return { isEnable: isEnable, + setEnable: setEnable, copy: copy, get: get, post: post, @@ -193,9 +203,7 @@ angular.module('cesium.es.http.services', ['ngResource', 'cesium.services', 'ces }; } - var service = esHttp((Wallet.data && Wallet.data.settings && Wallet.data.settings.esNode) ? - Wallet.data.settings.esNode : - APP_CONFIG.DUNITER_NODE_ES); + var service = esHttp(APP_CONFIG.DUNITER_NODE_ES); service.instance = esHttp; return service; }) diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index c2af90dfd64e8e20b319312dcd2fd74036dfc1f1..57cef594e701e83cecff34b13e78c04a5eb51374 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -191,14 +191,18 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se } function removeListeners() { + console.log("[ES] Removing contribution to Wallet and Wot services"); + _.forEach(listeners, function(remove){ remove(); }); listeners = []; } - // Extend Wallet.loadData() and WotService.loadData() - if (esHttp.isEnable()) { + function addListeners() { + console.log("[ES] Enable contribution to Wallet and Wot services"); + + // Extend Wallet.loadData() and WotService.loadData() listeners = [ Wallet.api.data.on.load($rootScope, onWalletLoad, this), WotService.api.data.on.load($rootScope, onWotLoad, this), @@ -206,9 +210,21 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se ]; } + function refreshListeners() { + if (!esHttp.isEnable() && listeners && listeners.length > 0) { + removeListeners(); + } + else if (esHttp.isEnable() && (!listeners || listeners.length === 0)) { + addListeners(); + } + } + + // Default action + refreshListeners(); return { copy: copy, + refreshListeners: refreshListeners, profile: { get: esHttp.get('/user/profile/:id'), add: esHttp.record.post('/user/profile'), diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html index 42a8f455fe32b847778346b2ea7a23625f35bab0..d78b145331b98c27756f258090b2209c25f93114 100644 --- a/www/plugins/es/templates/menu_extend.html +++ b/www/plugins/es/templates/menu_extend.html @@ -1,6 +1,6 @@ <!-- Main section --> -<ng-if ng-if="extensionPoint === 'menu-main'"> +<ng-if ng-if="es.enable && extensionPoint === 'menu-main'"> <!-- professionals registry--> <ion-item menu-close class="item item-icon-left" active-link="active" @@ -18,7 +18,7 @@ </ng-if> <!-- User section --> -<ng-if ng-if="extensionPoint === 'menu-user'"> +<ng-if ng-if="es.enable && extensionPoint === 'menu-user'"> <!-- user profile --> <ion-item menu-close class="item item-icon-left" active-link="active" ng-if="isLogin()" diff --git a/www/plugins/es/templates/settings/plugin_settings.html b/www/plugins/es/templates/settings/plugin_settings.html new file mode 100644 index 0000000000000000000000000000000000000000..b5c7579039479d9662d822f94db2207aa8dcbef6 --- /dev/null +++ b/www/plugins/es/templates/settings/plugin_settings.html @@ -0,0 +1,31 @@ +<ion-view left-buttons="leftButtons" + class="settings"> + <ion-nav-title translate>ES_SETTINGS.PLUGIN_NAME</ion-nav-title> + + <ion-nav-buttons side="secondary"> + <button class="button button-icon button-clear ion-android-done visible-xs visible-sm" ng-click="submitAndSave()"> + </button> + </ion-nav-buttons> + + <ion-content scroll="true"> + + <div class="item item-toggle dark"> + <div class="input-label" translate>ES_SETTINGS.ENABLE_TOGGLE</div> + <label class="toggle toggle-royal"> + <input type="checkbox" ng-model="formData.enable" > + <div class="track"> + <div class="handle"></div> + </div> + </label> + </div> + + <span class="item item-divider" translate>SETTINGS.NETWORK_SETTINGS</span> + + <div class="item ink" ng-click="changeEsNode()" > + <div class="input-label" ng-class="{'gray': !formData.enable}"> + {{'ES_SETTINGS.NODE' | translate}} + </div> + <span class="item-note" ng-class="{'gray': !formData.enable}">{{formData.node}}</span> + </div> + </ion-content> +</ion-view> diff --git a/www/plugins/es/templates/settings/settings_extend.html b/www/plugins/es/templates/settings/settings_extend.html index fb41335694f68425832a6e7a1ffd40a769be3dd5..6a13ddc538e3f1a13eaea646e95ed4499b6f3e6e 100644 --- a/www/plugins/es/templates/settings/settings_extend.html +++ b/www/plugins/es/templates/settings/settings_extend.html @@ -1,7 +1,9 @@ - <div class="item ink" ng-click="changeEsNode()"> - <div class="input-label"> - {{'SETTINGS.ES_NODE' | translate}} - </div> - <span class="item-note">{{formData.esNode}}</span> - </div> +<div class="item ink" ui-sref="app.es_settings"> + <div class="input-label ng-binding" translate>ES_SETTINGS.PLUGIN_NAME</div> + + <h3 class="item-note"> + <span ng-if="enable" translate>COMMON.ENABLE</span> + <span ng-if="!enable" translate>COMMON.DISABLE</span> + </h3> +</div> diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html index 098df8368158a602ace0e6ff6bfd81fde107126b..368410da38398908d9b70f266d64972de050d527 100644 --- a/www/templates/settings/settings.html +++ b/www/templates/settings/settings.html @@ -1,9 +1,7 @@ <ion-view left-buttons="leftButtons" cache-view="false" - id="settings"> - <ion-nav-title> - <span translate>SETTINGS.TITLE</span> - </ion-nav-title> + class="settings"> + <ion-nav-title translate>SETTINGS.TITLE</ion-nav-title> <ion-content > <div class="item item-toggle dark"> @@ -60,14 +58,10 @@ </div> - <span class="item item-divider"> - {{'SETTINGS.HISTORY_SETTINGS' | translate}} - </span> + <span class="item item-divider" translate>SETTINGS.HISTORY_SETTINGS</span> <div class="item item-toggle dark"> - <div class="input-label"> - {{'SETTINGS.DISPLAY_UD_HISTORY' | translate}} - </div> + <div class="input-label" translate>SETTINGS.DISPLAY_UD_HISTORY</div> <label class="toggle toggle-royal"> <input type="checkbox" ng-model="formData.showUDHistory" > <div class="track"> @@ -75,12 +69,11 @@ </div> </label> </div> + <!-- Allow extension here --> <cs-extension-point name="history"></cs-extension-point> - <span class="item item-divider"> - {{'SETTINGS.NETWORK_SETTINGS' | translate}} - </span> + <span class="item item-divider" translate>SETTINGS.NETWORK_SETTINGS</span> <div class="item ink" ng-click="changeNode()"> <div class="input-label"> @@ -91,6 +84,10 @@ <!-- Allow extension here --> <cs-extension-point name="network"></cs-extension-point> + <span class="item item-divider" translate>SETTINGS.PLUGINS_SETTINGS</span> + + <!-- Allow extension here --> + <cs-extension-point name="plugins"></cs-extension-point> </ion-content> </ion-view>