diff --git a/www/api/index.html b/www/api/index.html index 2940e3421b53df0a31a1883f3633756e84678f29..3f74c11b7496a6529dedccda9266793942700b13 100644 --- a/www/api/index.html +++ b/www/api/index.html @@ -87,6 +87,7 @@ <script src="../dist/dist_js/app/services/wallet-services.js"></script> <script src="../dist/dist_js/app/services/plugin-services.js"></script> <script src="../dist/dist_js/app/services.js"></script> +<script src="../dist/dist_js/app/api/api-demo-services.js"></script> <!-- entities --> <script src="../dist/dist_js/app/entities/peer.js"></script> diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index f51e8b0d20115f58f791a02645a5ae2fe6d0cb3e..22efdb4f8fcb4a4243a969238d350836ea79433a 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -804,7 +804,7 @@ "DESCRIPTION_DIVIDER": "Description", "URL_DIVIDER": "Access URL", "PARAMETERS_DIVIDER": "Parameters", - "AVAILABLE_PARAMETERS": "Here is the list of parameters and options:", + "AVAILABLE_PARAMETERS": "Here is the list of al available parameters:", "DEMO_DIVIDER": "Try it !", "DEMO_HELP": "To test this service, click on this button. The result content will be display below.", "DEMO_RESULT": "Result returned by call:", @@ -813,7 +813,7 @@ "INTEGRATE_DIVIDER": "To integrate", "INTEGRATE_CODE": "HTML Code:", "INTEGRATE_RESULT": "Result preview:", - "BTN_DEMO": "Demo", + "INTEGRATE_PARAMETERS": "Parameters", "TRANSFER": { "TITLE": "Payments", "DESCRIPTION": "From a site (eg online marketplace) you can delegate payment in free currency to Cesium API. To do this, simply open a page at the following address:", @@ -830,7 +830,19 @@ "PARAM_CANCEL_URL": "URL if cancelled", "PARAM_CANCEL_URL_HELP": "URL in case of cancellation", "EXAMPLES_HELP": "Examples of integration:", - "EXAMPLE_BUTTON_CODE": "HTML Button" + "EXAMPLE_BUTTON": "HTML Button", + "EXAMPLE_BUTTON_DEFAULT_TEXT": "Pay in {{currency|currencySymbol}}", + "EXAMPLE_BUTTON_DEFAULT_STYLE": "Custom style", + "EXAMPLE_BUTTON_TEXT_HELP": "Button text", + "EXAMPLE_BUTTON_TEXT_COLOR": "Color", + "EXAMPLE_BUTTON_TEXT_COLOR_HELP": "eg: #fbc14c, yellow, lightgrey, rgb(180,180,180)", + "EXAMPLE_BUTTON_TEXT_ICON": "Icon", + "EXAMPLE_BUTTON_TEXT_WIDTH": "Width", + "EXAMPLE_BUTTON_TEXT_WIDTH_HELP": "eg: 200px, 50%", + "EXAMPLE_BUTTON_ICON_CESIUM": "Cesium logo", + "EXAMPLE_BUTTON_ICON_DUNITER": "Duniter logo", + "EXAMPLE_BUTTON_ICON_G1_COLOR": "Ğ1 logo", + "EXAMPLE_BUTTON_ICON_G1_BLACK": "Ğ1 logo (outline)" } } } diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index c06875734a0b890177b6f7e3999805ed0bbf967e..e7dbf7ea694f7abfdbdb264941b1c7d58ac75f6a 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -804,7 +804,7 @@ "DESCRIPTION_DIVIDER": "Description", "URL_DIVIDER": "Access URL", "PARAMETERS_DIVIDER": "Parameters", - "AVAILABLE_PARAMETERS": "Here is the list of parameters and options:", + "AVAILABLE_PARAMETERS": "Here is the list of al available parameters:", "DEMO_DIVIDER": "Try it !", "DEMO_HELP": "To test this service, click on this button. The result content will be display below.", "DEMO_RESULT": "Result returned by call:", @@ -813,7 +813,7 @@ "INTEGRATE_DIVIDER": "To integrate", "INTEGRATE_CODE": "HTML Code:", "INTEGRATE_RESULT": "Result preview:", - "BTN_DEMO": "Demo", + "INTEGRATE_PARAMETERS": "Parameters", "TRANSFER": { "TITLE": "Payments", "DESCRIPTION": "From a site (eg online marketplace) you can delegate payment in free currency to Cesium API. To do this, simply open a page at the following address:", @@ -830,7 +830,19 @@ "PARAM_CANCEL_URL": "URL if cancelled", "PARAM_CANCEL_URL_HELP": "URL in case of cancellation", "EXAMPLES_HELP": "Examples of integration:", - "EXAMPLE_BUTTON_CODE": "HTML Button" + "EXAMPLE_BUTTON": "HTML Button", + "EXAMPLE_BUTTON_DEFAULT_TEXT": "Pay in {{currency|currencySymbol}}", + "EXAMPLE_BUTTON_DEFAULT_STYLE": "Custom style", + "EXAMPLE_BUTTON_TEXT_HELP": "Button text", + "EXAMPLE_BUTTON_TEXT_COLOR": "Color", + "EXAMPLE_BUTTON_TEXT_COLOR_HELP": "eg: #fbc14c, yellow, lightgrey, rgb(180,180,180)", + "EXAMPLE_BUTTON_TEXT_ICON": "Icon", + "EXAMPLE_BUTTON_TEXT_WIDTH": "Width", + "EXAMPLE_BUTTON_TEXT_WIDTH_HELP": "eg: 200px, 50%", + "EXAMPLE_BUTTON_ICON_CESIUM": "Cesium logo", + "EXAMPLE_BUTTON_ICON_DUNITER": "Duniter logo", + "EXAMPLE_BUTTON_ICON_G1_COLOR": "Ğ1 logo", + "EXAMPLE_BUTTON_ICON_G1_BLACK": "Ğ1 logo (outline)" } } } diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 6959049ce8c3da157c9edaa52ef9ce4e75ffdc39..c7eae8a52289b540c058c519dd6180499d667e54 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -804,16 +804,16 @@ "DESCRIPTION_DIVIDER": "Description", "URL_DIVIDER": "URL d'accès", "PARAMETERS_DIVIDER": "Paramètres", - "AVAILABLE_PARAMETERS": "Voici la liste des paramètres et options :", + "AVAILABLE_PARAMETERS": "Voici la liste des paramètres possibles :", "DEMO_DIVIDER": "Tester", "DEMO_HELP": "Pour tester ce service, cliquez sur le bouton ci-contre. Le résultat s'affichera en dessous.", "DEMO_RESULT": "Résultat retourné par l'appel :", "DEMO_SUCCEED": "<i class=\"icon ion-checkmark\"></i> Succès !", "DEMO_CANCELLED": "<i class=\"icon ion-close\"></i> Annulé par l'utilisateur", "INTEGRATE_DIVIDER": "Intégrer", - "INTEGRATE_CODE": "Code HTML :", + "INTEGRATE_CODE": "Code :", "INTEGRATE_RESULT": "Prévisualisation du résultat :", - "BTN_DEMO": "Démo", + "INTEGRATE_PARAMETERS": "Paramètres", "TRANSFER": { "TITLE": "Paiements", "DESCRIPTION": "Depuis un site (ex: vente en ligne) vous pouvez déléguer le paiement en monnaie libre à Cesium API. Pour cela, il vous suffit de déclencher l'ouveture d'un page sur l'adresse suivante :", @@ -830,7 +830,19 @@ "PARAM_CANCEL_URL": "Adresse web d'annulation", "PARAM_CANCEL_URL_HELP": "Adresse web (URL) en cas d'annulation du paiement, par l'utilisateur", "EXAMPLES_HELP": "Voici des exemples d'intégration :", - "EXAMPLE_BUTTON_CODE": "Bouton HTML" + "EXAMPLE_BUTTON": "Bouton HTML", + "EXAMPLE_BUTTON_DEFAULT_TEXT": "Payer en {{currency|currencySymbol}}", + "EXAMPLE_BUTTON_DEFAULT_STYLE": "Style personnalisé", + "EXAMPLE_BUTTON_TEXT_HELP": "Texte du bouton", + "EXAMPLE_BUTTON_TEXT_COLOR": "Couleur", + "EXAMPLE_BUTTON_TEXT_COLOR_HELP": "Exemple: #fbc14c, yellow, lightgrey, rgb(180,180,180)", + "EXAMPLE_BUTTON_TEXT_ICON": "Icône", + "EXAMPLE_BUTTON_TEXT_WIDTH": "Largeur", + "EXAMPLE_BUTTON_TEXT_WIDTH_HELP": "Exemple: 200px, 50%", + "EXAMPLE_BUTTON_ICON_CESIUM": "Logo Cesium", + "EXAMPLE_BUTTON_ICON_DUNITER": "Logo Duniter", + "EXAMPLE_BUTTON_ICON_G1_COLOR": "Logo Ğ1", + "EXAMPLE_BUTTON_ICON_G1_BLACK": "Logo Ğ1 (noir)" } } } diff --git a/www/img/logo_32px.png b/www/img/logo_32px.png new file mode 100644 index 0000000000000000000000000000000000000000..305e647fc6a4a8bb4803313eb105be2db22c5778 Binary files /dev/null and b/www/img/logo_32px.png differ diff --git a/www/img/logo_duniter_32px.png b/www/img/logo_duniter_32px.png new file mode 100644 index 0000000000000000000000000000000000000000..a6205fd125dc72581df1cfed72e39ec60c067d08 Binary files /dev/null and b/www/img/logo_duniter_32px.png differ diff --git a/www/img/logo_g1_32px.png b/www/img/logo_g1_32px.png new file mode 100644 index 0000000000000000000000000000000000000000..bebaffe9cf2961e2a634a4d7e0af2e6baf9f7a06 Binary files /dev/null and b/www/img/logo_g1_32px.png differ diff --git a/www/img/logo_g1_32px_black.png b/www/img/logo_g1_32px_black.png new file mode 100644 index 0000000000000000000000000000000000000000..e9af8d7790043277aa479c221159a5031a0474d9 Binary files /dev/null and b/www/img/logo_g1_32px_black.png differ diff --git a/www/js/api/api-demo-services.js b/www/js/api/api-demo-services.js new file mode 100644 index 0000000000000000000000000000000000000000..bc676c06ed356e222e6c1be11e35a803acc188b9 --- /dev/null +++ b/www/js/api/api-demo-services.js @@ -0,0 +1,72 @@ +angular.module('cesium.api.demo.services', ['cesium.bma.services', 'cesium.crypto.services', 'cesium.utils.services', 'cesium.settings.services']) + + + .factory('csDemoWallet', function($rootScope, $timeout, $controller, $state, $q, $translate, $filter, + BMA, CryptoUtils) { + 'ngInject'; + + function factory(authData) { + + var demoPubkey; + + return { + start: function() { + return $q.when(); + }, + login: function() { + var self = this; + return $translate('API.TRANSFER.DEMO.PUBKEY') + .then(function(pubkey) { + demoPubkey = pubkey; + if (!authData || authData.pubkey != demoPubkey) { + throw {message: 'API.TRANSFER.DEMO.BAD_CREDENTIALS'}; + } + self.data = { + keypair: authData.keypair + }; + return { + uid: 'Demo', + pubkey: demoPubkey + }; + }); + }, + transfer: function(pubkey, amount, comment) { + var self = this; + return BMA.blockchain.current() + .then(function(block) { + var tx = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' + + 'Type: Transaction\n' + + 'Currency: ' + block.currency + '\n' + + 'Blockstamp: ' + block.number + '-' + block.hash + '\n' + + 'Locktime: 0\n' + // no lock + 'Issuers:\n' + + demoPubkey + '\n' + + 'Inputs:\n' + + [amount, block.unitbase, 'T', 'FakeId27jQMAf3jqL2fr75ckZ6Jgi9TZL9fMf9TR9vBvG', 0].join(':')+ '\n' + + 'Unlocks:\n' + + '0:SIG(0)\n' + + 'Outputs:\n' + + [amount, block.unitbase, 'SIG(' + pubkey + ')'].join(':')+'\n' + + 'Comment: '+ (comment||'') + '\n'; + + return CryptoUtils.sign(tx, self.data.keypair) + .then(function(signature) { + var signedTx = tx + signature + "\n"; + return CryptoUtils.util.hash(signedTx) + .then(function(txHash) { + return $q.when({ + tx: signedTx, + hash: txHash + }); + }); + }); + }); + } + }; + } + + return { + instance: factory + }; + }) +; diff --git a/www/js/api/app.js b/www/js/api/app.js index b7fbf2ed486ccd5d4b3a191e5f9ee4134c4932d5..636578cd9c75772a6160c1df32d69622f2376423 100644 --- a/www/js/api/app.js +++ b/www/js/api/app.js @@ -10,7 +10,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr // endRemoveIf(no-device) 'cesium.filters', 'cesium.config', 'cesium.platform', 'cesium.templates', 'cesium.translations', 'cesium.directives', // API dependencies : - 'cesium.services', 'cesium.login.controllers', 'cesium.help.controllers' + 'cesium.services', 'cesium.api.demo.services', 'cesium.login.controllers', 'cesium.help.controllers' ]) .config(function($stateProvider, $urlRouterProvider) { @@ -70,9 +70,28 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr }; }) - .controller('ApiDocCtrl', function ($scope, $rootScope, $state, csConfig){ + .controller('ApiDocCtrl', function ($scope, $rootScope, $state, $translate, $sce, csCurrency){ 'ngInject'; + $scope.loading = true; + $scope.buttonIcons = [ + { + label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_DUNITER', + filename: '../img/logo_duniter_32px.png' + }, + { + label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_CESIUM', + filename: '../img/logo_32px.png' + }, + { + label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_G1_COLOR', + filename: '../img/logo_g1_32px.png' + }, + { + label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_G1_BLACK', + filename: '../img/logo_g1_32px_black.png' + } + ]; $scope.transferData = { pubkey: 'G2CBgZBPLe6FSFUgpx2Jf1Aqsgta6iib3vmDRA1yLiqU', amount: 100, @@ -80,12 +99,19 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr name: 'www.domain.com', redirect_url: 'http://www.domain.com/payment?ref={comment}&tx={tx}', cancel_url: 'http://www.domain.com/payment?ref={comment}&cancel', - show: true + show: false, // hide integration parameters, by default + buttonText: 'Ğ1 pubkey', + buttonIcon: $scope.buttonIcons[0], + buttonTextEnable: false, + buttonColor: '#fbc14c', + buttonWidth: undefined }; + + // Compute URL for transfer demo $scope.demoUrl = $rootScope.rootPath + $state.href('api.transfer', angular.merge({}, $scope.transferData, { demo: true, - redirect_url: $rootScope.rootPath + '#/app/home?service=payment&result={comment}%0A{hash}%0A{tx}', + redirect_url: $rootScope.rootPath + '#/app/home?service=payment&result={tx}', cancel_url: $rootScope.rootPath + '#/app/home?service=payment&cancel' })); $scope.transferData.url = $rootScope.rootPath + $state.href('api.transfer', $scope.transferData); @@ -101,19 +127,53 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr if (state.stateParams && state.stateParams.cancel) { $scope.result.cancelled = true; } + + csCurrency.get() + .then(function(currency) { + return $translate('API.DOC.TRANSFER.EXAMPLE_BUTTON_DEFAULT_TEXT', {currency: currency.name}); + }) + .then(function(buttonText) { + $scope.transferData.buttonText = buttonText; + $scope.loading = false; + // compute HTML button + $scope.onTransferDataChanged(); + }); + }; $scope.$on('$ionicView.enter', $scope.enter); // watch from update - $scope.onTransferDataChanged = function(oldValue, newValue, scope) { + $scope.onTransferDataChanged = function() { + if ($scope.loading) return; // skip if loading + // recompute URL - $scope.transferData.url = $rootScope.rootPath + $state.href('api.transfer', $scope.transferData); + var buttonUrl = $rootScope.rootPath + $state.href('api.transfer', $scope.transferData); + + // Button with text + if ($scope.transferData.buttonTextEnable) { + $scope.buttonHtml = '<a href="'+buttonUrl+'">\n'+ + ' <div style="background-color: '+$scope.transferData.buttonColor+'; border-radius: 5px; min-height: 42px; text-align: center; padding: 5px; color: black;'; + if ($scope.transferData.buttonWidth) { + $scope.buttonHtml += 'max-width: '+$scope.transferData.buttonWidth+';'; + } + $scope.buttonHtml += '">\n'+ + ' <img style="vertical-align: middle;" src="'+$rootScope.rootPath + $scope.transferData.buttonIcon.filename+'">\n' + + ' ' + $scope.transferData.buttonText + '\n' + + ' </div>\n' + + '</a>'; + } + // Simple button + else { + $scope.buttonHtml = '<a href="'+buttonUrl+'">\n'+ + ' <img src="'+$rootScope.rootPath + '../img/duniter_button.svg">\n'+ + '</a>'; + } }; $scope.$watch('transferData', $scope.onTransferDataChanged, true); }) .controller('ApiTransferCtrl', function ($scope, $rootScope, $timeout, $controller, $state, $q, $translate, $filter, - BMA, CryptoUtils, UIUtils, csCurrency, csTx, csWallet){ + BMA, CryptoUtils, UIUtils, csCurrency, csTx, csWallet, csDemoWallet){ 'ngInject'; // Initialize the super class and extend it. @@ -154,64 +214,6 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr }; $scope.$on('$ionicView.enter', $scope.enter); - function createDemoWallet(authData) { - var demoPubkey = '3G28bL6deXQBYpPBpLFuECo46d3kfYMJwst7uhdVBnD1'; - - return { - start: function() { - return $q.when(); - }, - login: function() { - var self = this; - return $translate('API.TRANSFER.DEMO.PUBKEY') - .then(function(pubkey) { - if (!authData || authData.pubkey != '3G28bL6deXQBYpPBpLFuECo46d3kfYMJwst7uhdVBnD1') { - throw {message: 'API.TRANSFER.DEMO.BAD_CREDENTIALS'}; - } - self.data = { - keypair: authData.keypair - }; - return { - uid: 'Demo', - pubkey: demoPubkey - }; - }); - }, - transfer: function() { - var self = this; - return BMA.blockchain.current() - .then(function(block) { - var tx = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' + - 'Type: Transaction\n' + - 'Currency: ' + block.currency + '\n' + - 'Blockstamp: ' + block.number + '-' + block.hash + '\n' + - 'Locktime: 0\n' + // no lock - 'Issuers:\n' + - demoPubkey + '\n' + - 'Inputs:\n' + - [$scope.transferData.amount, block.unitbase, 'T', 'FakeId27jQMAf3jqL2fr75ckZ6Jgi9TZL9fMf9TR9vBvG', 0].join(':')+ '\n' + - 'Unlocks:\n' + - '0:SIG(0)\n' + - 'Outputs:\n' + - [$scope.transferData.amount, block.unitbase, 'SIG(' + $scope.transferData.pubkey + ')'].join(':')+'\n' + - 'Comment: '+ ($scope.transferData.comment||'') + '\n'; - - return CryptoUtils.sign(tx, self.data.keypair) - .then(function(signature) { - var signedTx = tx + signature + "\n"; - return CryptoUtils.util.hash(signedTx) - .then(function(txHash) { - return $q.when({ - tx: signedTx, - hash: txHash - }); - }); - }) - }); - } - }; - } - function onLogin(authData) { // User cancelled @@ -221,11 +223,11 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr if ($scope.sending) return; $scope.sending = true; - var wallet = $scope.demo ? createDemoWallet(authData) : csWallet.instance('api', BMA); + var wallet = $scope.demo ? csDemoWallet.instance(authData) : csWallet.instance('api', BMA); UIUtils.loading.show(); - wallet.start({skipRestore: true}) + wallet.start({restore: false}/*skip restore from local storage*/) .then(function() { return wallet.login({auth: true, authData: authData}); }) diff --git a/www/js/config.js b/www/js/config.js index f08c7b49d5bd06166a4634527aea68e2fc179eb4..6ac06261a3f4a3523d082dd96a86efe99e86585d 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -32,7 +32,7 @@ angular.module("cesium.config", []) "en": "license/license_g1-en" }, "node": { - "host": "g1.duniter.org", + "host": "g1.duniter.fr", "port": "443" }, "fallbackNodes": [ @@ -71,4 +71,4 @@ angular.module("cesium.config", []) "newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug" }) -; \ No newline at end of file +; diff --git a/www/js/filters.js b/www/js/filters.js index a07a9f660f69740fda231222c7e24b732cdecc1c..9e04d158190a34162b35639a97c7d841856bb27c 100644 --- a/www/js/filters.js +++ b/www/js/filters.js @@ -374,4 +374,9 @@ angular.module('cesium.filters', ['cesium.config', 'cesium.platform', 'pascalpre }; }) + .filter('trustAsHtml', function($sce) { + return function(html) { + return $sce.trustAsHtml(html); + }; + }) ; diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index 891cf66a1fc5efdc460f38e13f78f146f0bd1184..c325d0bb2752ba47612e001e323b9b5e277d6a7c 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -1662,7 +1662,8 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se function start(options) { options = options || {}; - options.skipRestore = angular.isDefined(options.skipRestore) ? options.skipRestore : false; + // By default, restore if the service is the default object + options.restore = angular.isDefined(options.restore) ? options.restore : (id === 'default'); console.debug('[wallet] Starting...'); var now = new Date().getTime(); @@ -1674,7 +1675,7 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se ]); // Restore - if (!options.skipRestore) startPromise = startPromise.then(restore); + if (options.restore) startPromise = startPromise.then(restore); // Emit ready event startPromise.then(function() { diff --git a/www/templates/api/doc.html b/www/templates/api/doc.html index 170e203c2f1c204e5a140e18e4efebeb6c7cfc4d..b3cc0e3b31a76adae5f4662db026e676757eb528 100644 --- a/www/templates/api/doc.html +++ b/www/templates/api/doc.html @@ -60,9 +60,9 @@ <div class="item item-divider no-border"> <p translate>API.DOC.DEMO_DIVIDER</p> </div> - <div class="item item-button-right"> - <p translate>API.DOC.DEMO_HELP</p> - <a href="{{demoUrl}}" class="button button-raised button-positive" translate>API.DOC.BTN_DEMO</a> + <div class="item item-button-right item-text-wrap padding-bottom"> + <p class="item-icon-right-padding" translate>API.DOC.DEMO_HELP</p> + <a href="{{demoUrl}}" class="button button-raised button-positive icon ion-play"></a> </div> <div class="item item-text-wrap" ng-if="result.type === 'payment' && !result.cancelled"> <h2 class="text-right balanced" translate>API.DOC.DEMO_SUCCEED</h2> @@ -77,14 +77,15 @@ <p translate>API.DOC.INTEGRATE_DIVIDER</p> </div> - <div class="item item-text-wrap"> <p translate>API.DOC.TRANSFER.EXAMPLES_HELP</p> - <div class="row"> + <div class="row responsive-sm"> <div class="col col-20 text-italic"> - <span translate>API.DOC.TRANSFER.EXAMPLE_BUTTON_CODE</span> + <span translate>API.DOC.TRANSFER.EXAMPLE_BUTTON</span> </div> + + <!-- no text on button --> <div class="col gray no-border"> <!-- code --> @@ -93,7 +94,7 @@ <span translate>API.DOC.INTEGRATE_CODE</span> </p> <div class="item item-input "> - <textarea class="gray" select-on-click="" rows="3" cols="80"><a href="{{transferData.url}}"><img src="{{$root.rootPath}}../img/duniter_button.svg"></a></textarea> + <textarea class="gray" select-on-click rows="4" ng-model="buttonHtml"></textarea> </div> <!-- preview --> @@ -101,66 +102,148 @@ <i class="icon ion-eye"></i> <span translate>API.DOC.INTEGRATE_RESULT</span> </p> - <p class="padding-left"> - <a href="{{transferData.url}}" target="_system"><img src="../img/duniter_button.svg"></a> - </p> + <div class="padding-left"> + <ng-bind-html ng-bind-html="buttonHtml|trustAsHtml"></ng-bind-html> + </div> + </div> + </div> + <div class="row responsive-sm"> + <div class="col col-20 hidden-xs hidden-sm"> </div> + + <!-- no text on button --> + <div class="col gray no-border"> <p class="padding-top"> <a class="positive" ng-click="transferData.show=!transferData.show"> <i class="icon ion-wrench"></i> - <span translate>API.DOC.PARAMETERS_DIVIDER</span> + <span translate>API.DOC.INTEGRATE_PARAMETERS</span> <i class="icon" ng-class="{'ion-arrow-down-b': !transferData.show, 'ion-arrow-up-b': transferData.show}"></i> </a> </p> - <form id="transferForm" ng-if="transferData.show" class="padding-left stable-bg"> - <p class="padding-top"> - <i class="icon ion-key"></i> - {{'API.DOC.TRANSFER.PARAM_PUBKEY' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.pubkey" placeholder="{{'API.DOC.TRANSFER.PARAM_PUBKEY_HELP'|translate}}"> - </label> - - <p class="padding-top"> - <i class="icon ion-pricetag"></i> - {{'API.DOC.TRANSFER.PARAM_AMOUNT' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.amount" placeholder="{{'API.DOC.TRANSFER.PARAM_AMOUNT_HELP'|translate}}"> - </label> - - <p class="padding-top"> - <i class="icon ion-flag"></i> - {{'API.DOC.TRANSFER.PARAM_COMMENT' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.comment" placeholder="{{'API.DOC.TRANSFER.PARAM_COMMENT'|translate}}"> - </label> - - <p class="padding-top"> - <i class="icon ion-ios-world-outline"></i> - {{'API.DOC.TRANSFER.PARAM_NAME' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.name" placeholder="{{'API.DOC.TRANSFER.PARAM_NAME'|translate}}"> - </label> - - <p class="padding-top"> - <i class="icon ion-arrow-return-left"></i> - {{'API.DOC.TRANSFER.PARAM_REDIRECT_URL' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.redirect_url" placeholder="{{'API.DOC.TRANSFER.PARAM_REDIRECT_URL'|translate}}"> - </label> - - <p class="padding-top"> - <i class="icon ion-backspace"></i> - {{'API.DOC.TRANSFER.PARAM_CANCEL_URL' | translate}} : - </p> - <label class="item item-input"> - <input type="text" ng-model="transferData.cancel_url" placeholder="{{'API.DOC.TRANSFER.PARAM_CANCEL_URL'|translate}}"> - </label> + <div ng-if="transferData.show" class="padding-left"> + + <form id="transferForm" class="stable-bg padding"> + <p class="padding-top"> + <i class="icon ion-key"></i> + {{'API.DOC.TRANSFER.PARAM_PUBKEY' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.pubkey" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.PARAM_PUBKEY_HELP'|translate}}"> + </label> + + <p class="padding-top"> + <i class="icon ion-pricetag"></i> + {{'API.DOC.TRANSFER.PARAM_AMOUNT' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.amount" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.PARAM_AMOUNT_HELP'|translate}}"> + </label> + + <p class="padding-top"> + <i class="icon ion-flag"></i> + {{'API.DOC.TRANSFER.PARAM_COMMENT' | translate}} : + </p> + <label class="item item-input"> + <input type="text" ng-model="transferData.comment" placeholder="{{'API.DOC.TRANSFER.PARAM_COMMENT'|translate}}"> + </label> + + <p class="padding-top"> + <i class="icon ion-ios-world-outline"></i> + {{'API.DOC.TRANSFER.PARAM_NAME' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.name" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.PARAM_NAME'|translate}}"> + </label> + + <p class="padding-top"> + <i class="icon ion-arrow-return-left"></i> + {{'API.DOC.TRANSFER.PARAM_REDIRECT_URL' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.redirect_url" + ng-model-options="{ debounce: 650 }"placeholder="{{'API.DOC.TRANSFER.PARAM_REDIRECT_URL'|translate}}"> + </label> + + <p class="padding-top"> + <i class="icon ion-backspace"></i> + {{'API.DOC.TRANSFER.PARAM_CANCEL_URL' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.cancel_url" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.PARAM_CANCEL_URL'|translate}}"> + </label> + + <p class="padding-top"> + <a class="positive" ng-click="transferData.buttonTextEnable=!transferData.buttonTextEnable"> + <i class="icon" ng-class="{'ion-android-checkbox-outline': transferData.buttonTextEnable, 'ion-android-checkbox-outline-blank': !transferData.buttonTextEnable}"></i> + <span translate>API.DOC.TRANSFER.EXAMPLE_BUTTON_DEFAULT_STYLE</span> + </a> + </p> + + <div ng-if="transferData.buttonTextEnable"> + + <!-- button color --> + <p class="padding-top"> + <i class="icon ion-paintbucket"></i> + {{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_COLOR' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.buttonColor" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_COLOR_HELP'|translate}}"> + </label> + + <!-- button icon --> + <p class="padding-top"> + <i class="icon ion-image"></i> + {{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_ICON' | translate}} : + </p> + <label class="item item-input item-select"> + <select class="stable-bg dark" + ng-model="transferData.buttonIcon" style="width: 100%; max-width: 100%;" + ng-options="l as (l.label | translate) for l in buttonIcons track by l.filename"> + </select> + </label> + + <!-- button text --> + <p class="padding-top"> + <i class="icon ion-quote"></i> + {{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_HELP' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.buttonText" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_HELP'|translate}}"> + </label> + + <!-- button width --> + <p class="padding-top"> + <i class="icon ion-ios-crop-strong"></i> + {{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_WIDTH' | translate}} : + </p> + <label class="item item-input"> + <input type="text" + ng-model="transferData.buttonWidth" + ng-model-options="{ debounce: 650 }" + placeholder="{{'API.DOC.TRANSFER.EXAMPLE_BUTTON_TEXT_WIDTH_HELP'|translate}}"> + </label> + </div> + </div> </form> </div> diff --git a/www/templates/api/home.html b/www/templates/api/home.html index 15b4106a3ec2ab6c969b59c6bb972996df9ba525..4eb1e30fd7981f0612ca92abea89496b9af53943 100644 --- a/www/templates/api/home.html +++ b/www/templates/api/home.html @@ -9,7 +9,7 @@ <div class="light text-center" > <h4 class="hidden-xs" translate>API.HOME.MESSAGE</h4> - <h4 class="visible-xs" translate>API.HOME.MESSAGE_SHORT</h4> + <h4 class="visible-xs padding" translate>API.HOME.MESSAGE_SHORT</h4> </div> <br class="hidden-xs"/> diff --git a/www/templates/api/menu.html b/www/templates/api/menu.html index a4751ae51b9578bd1b42556c6c873fc2c20ac5d7..ed55bc0595b4556b4748b60ba4c4eccebaaa0b47 100644 --- a/www/templates/api/menu.html +++ b/www/templates/api/menu.html @@ -1,18 +1,13 @@ -<ion-side-menus bind-notifier="{locale:$root.settings.locale.id}"> - <!-- HEADER --> - <ion-side-menu-content> - <ion-nav-bar class="bar-dark" title-align="left"> - <ion-nav-back-button class="no-text"> - </ion-nav-back-button> - <ion-nav-buttons side="left"> - </ion-nav-buttons> - <ion-nav-buttons side="right" > - </ion-nav-buttons> - </ion-nav-bar> - <ion-nav-view name="menuContent"></ion-nav-view> +<ion-nav-bar class="bar-dark" title-align="left"> + <ion-nav-back-button class="no-text"> + </ion-nav-back-button> - </ion-side-menu-content> + <ion-nav-buttons side="left"> + </ion-nav-buttons> + <ion-nav-buttons side="right" > + </ion-nav-buttons> +</ion-nav-bar> +<ion-nav-view name="menuContent"></ion-nav-view> -</ion-side-menus> diff --git a/www/templates/api/transfer.html b/www/templates/api/transfer.html index ee0d5c8c80629f38aab8d90c9e26549b3b1d3286..c82098b7363c51b70f17a2573619f6394fa7818c 100644 --- a/www/templates/api/transfer.html +++ b/www/templates/api/transfer.html @@ -1,18 +1,16 @@ - -<ion-nav-view class="circle-bg-dark"> - <ion-nav-title> - <h1 class="title" ng-bind-html="'API.TRANSFER.TITLE' | translate"> - </h1> - <span class="visible-xs visible-sm" translate>API.TRANSFER.TITLE</span> - </ion-nav-title> +<ion-view class="circle-bg-dark"> <ion-nav-buttons side="left"> <button class="button button-clear visible-xs" ng-click="closeModal()" translate>COMMON.BTN_CANCEL </button> </ion-nav-buttons> + <ion-nav-title> + <span class="title visible-xs" translate>API.TRANSFER.TITLE_SHORT</span> + </ion-nav-title> + <ion-nav-buttons side="right"> - <button class="button button-icon button-clear icon ion-android-send visible-xs" ng-click="doLogin()"> + <button class="button button-positive button-icon button-clear icon ion-android-done visible-xs" ng-click="doLogin()"> </button> </ion-nav-buttons> @@ -28,10 +26,7 @@ <div class="light-bg"> - <h2 class="padding-top text-center"> - <span class="hidden-xs" translate>API.TRANSFER.TITLE</span> - <span class="visible-xs" translate>API.TRANSFER.TITLE_SHORT</span> - </h2> + <h2 class="padding-top text-center hidden-xs" translate>API.TRANSFER.TITLE</h2> <div class="no-padding energized-100-bg" ng-if="demo"> <div class="item item-icon-left item-text-wrap no-border"> @@ -64,17 +59,20 @@ <div class="item item-icon-left-padding item-text-wrap"> <h2 translate>API.TRANSFER.PUBKEY</h2> <div class="badge"> - <br class="visible-xs"/> - {{transferData.pubkey}} + <span class="hidden-xs"><i class="icon ion-key"></i>{{transferData.pubkey}}</span> + <span class="visible-xs" copy-on-click="{{transferData.pubkey}}"><br class="visible-xs"/><i class="icon ion-key"></i> {{transferData.pubkey|formatPubkey}}</span> </div> </div> <div class="item item-icon-left-padding"> <h2 translate>API.TRANSFER.COMMENT</h2> <div class="badge item-note"> - {{transferData.comment}} + <span class="hidden-xs">{{transferData.comment}}</span> + <span class="visible-xs" copy-on-click="{{transferData.comment}}"><br/>{{transferData.comment}}</span> </div> </div> + <!-- spacer in small screen --> + <div class="padding-bottom visible-xs"> </div> </div> </div> <div class="col col-20 hidden-xs hidden-sm text-center" id="home" > diff --git a/www/templates/menu.html b/www/templates/menu.html index 7994709966a821c5569ab9e8f7da6a65148d673c..e08e9427e5c3f54b8a74010d5281780d4c4c06ff 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -1,8 +1,7 @@ <ion-side-menus enable-menu-with-back-views="true" bind-notifier="{locale:$root.settings.locale.id}"> <!-- HEADER --> - <ion-side-menu-content - > + <ion-side-menu-content> <ion-nav-bar class="bar-dark" title-align="left"> <ion-nav-back-button class="no-text"> </ion-nav-back-button>