From f0aa5e65c53c9cff723f50602c41fb7c582ed5c6 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 23 Aug 2017 16:28:46 +0200 Subject: [PATCH] [enh] Cesium API button example: add "none" option for icon --- www/i18n/locale-en-GB.json | 3 ++- www/i18n/locale-en.json | 3 ++- www/i18n/locale-fr-FR.json | 3 ++- www/js/api/app.js | 15 ++++++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 73de4c190..96f152ce4 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -843,8 +843,9 @@ "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_NONE": "No icon", "EXAMPLE_BUTTON_ICON_DUNITER": "Duniter logo", + "EXAMPLE_BUTTON_ICON_CESIUM": "Cesium 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 f0bcb75d9..1517958ce 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -843,8 +843,9 @@ "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_NONE": "No icon", "EXAMPLE_BUTTON_ICON_DUNITER": "Duniter logo", + "EXAMPLE_BUTTON_ICON_CESIUM": "Cesium 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 a49fc0897..49e4a953d 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -843,8 +843,9 @@ "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_NONE": "Aucune", "EXAMPLE_BUTTON_ICON_DUNITER": "Logo Duniter", + "EXAMPLE_BUTTON_ICON_CESIUM": "Logo Cesium", "EXAMPLE_BUTTON_ICON_G1_COLOR": "Logo Ğ1", "EXAMPLE_BUTTON_ICON_G1_BLACK": "Logo Ğ1 (noir)" } diff --git a/www/js/api/app.js b/www/js/api/app.js index b41617a76..3dcfd370e 100644 --- a/www/js/api/app.js +++ b/www/js/api/app.js @@ -121,6 +121,9 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr html: undefined, showParameters: false, // hide integration parameters, by default icons: [ + { + label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_NONE' + }, { label: 'API.DOC.TRANSFER.EXAMPLE_BUTTON_ICON_DUNITER', filename: '../img/logo_duniter_32px.png' @@ -146,7 +149,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr width: undefined } }; - $scope.transferButton.style.icon = $scope.transferButton.icons[0]; + $scope.transferButton.style.icon = $scope.transferButton.icons[1/*Duniter icon*/]; $scope.transferDemoUrl = $rootScope.rootPath + $state.href('api.transfer', angular.merge({}, $scope.transferData, { demo: true, redirect_url: $rootScope.rootPath + '#/app/home?service=payment&result={tx}', @@ -199,7 +202,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr // Compute HTML: advanced button else { html = '<a href="'+url+'">\n'+ - ' <div style="border-radius: 5px; min-height: 42px; text-align: center; padding: 5px; '; + ' <div style="border-radius: 5px; min-height: 42px; text-align: center; padding: 5px; line-height: 30px; '; if ($scope.transferButton.style.width) { html += 'max-width: '+$scope.transferButton.style.width+'; '; } @@ -209,9 +212,11 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr if ($scope.transferButton.style.fontColor) { html += 'color: '+$scope.transferButton.style.fontColor+'; '; } - html += '">\n'+ - ' <img style="vertical-align: middle;" src="'+$rootScope.rootPath + $scope.transferButton.style.icon.filename+'">\n' + - ' ' + $scope.transferButton.style.text + '\n' + + html += '">\n'; + if ($scope.transferButton.style.icon && $scope.transferButton.style.icon.filename) { + html += ' <img style="vertical-align: middle;" src="'+$rootScope.rootPath + $scope.transferButton.style.icon.filename+'">\n'; + } + html += ' ' + $scope.transferButton.style.text + '\n' + ' </div>\n' + '</a>'; } -- GitLab