From 13387ba95c992d799fbf93e27a353c59d55cfc52 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 13 Apr 2016 19:57:28 +0200 Subject: [PATCH] - Add material design motions to UI - Add header to identity view, and fab button --- www/css/style.css | 17 +- www/i18n/locale-en.json | 31 ++-- www/i18n/locale-fr-FR.json | 35 ++-- www/index.html | 2 + www/js/controllers.js | 2 + www/js/controllers/app-controllers.js | 23 +-- www/js/controllers/currency-controllers.js | 38 ++-- www/js/controllers/home-controllers.js | 12 +- www/js/controllers/registry-controllers.js | 7 - www/js/controllers/settings-controllers.js | 43 +---- www/js/controllers/transfer-controllers.js | 206 +++++++++++++++++++++ www/js/controllers/wallet-controllers.js | 139 +------------- www/js/controllers/wot-controllers.js | 20 +- www/js/services/bma-services.js | 19 +- www/js/services/utils-services.js | 14 +- www/templates/account/view_wallet.html | 107 ----------- www/templates/currency/lookup.html | 4 +- www/templates/currency/lookup_form.html | 3 +- www/templates/{ => home}/home.html | 0 www/templates/home/new_account_wizard.html | 10 +- www/templates/login.html | 8 +- www/templates/menu.html | 30 +-- www/templates/registry/view_record.html | 3 +- www/templates/wallet/modal_transfer.html | 12 ++ www/templates/wallet/new_transfer.html | 66 ++----- www/templates/wallet/transfer_form.html | 55 ++++++ www/templates/wallet/view_wallet.html | 8 +- www/templates/wot/modal_lookup.html | 4 +- www/templates/wot/view_identity.html | 89 +++++---- 29 files changed, 533 insertions(+), 474 deletions(-) create mode 100644 www/js/controllers/transfer-controllers.js delete mode 100644 www/templates/account/view_wallet.html rename www/templates/{ => home}/home.html (100%) create mode 100644 www/templates/wallet/modal_transfer.html create mode 100644 www/templates/wallet/transfer_form.html diff --git a/www/css/style.css b/www/css/style.css index 42dff2b78..9f6ee0a5d 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -37,9 +37,19 @@ } .bar .button.button-clear { + font-size: 12px !important; + font-weight: 300 !important; + width: initial !important; + min-width: 38px !important; + max-width: 90px !important; +} +.bar .title + .button.button-clear.button-icon.icon { + min-height: 30px; } + + #transfer .list .item { border-bottom: solid 1px #ccc; } @@ -48,9 +58,10 @@ border-bottom: solid 1px #ccc; } -/*#menu .item { - border: 0px; -}*/ +#menu .item.item-divider { + min-height: 5px; + height: 5px; +} .menu .avatar { height: 88px; diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 2d473b4f6..7bc6cb7ba 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -10,21 +10,23 @@ "BTN_CANCEL": "Cancel", "BTN_LOGIN": "Login", "BTN_LOGOUT": " Logout", - "BTN_ADD_ACCOUNT": "Register", - "SEARCH_NO_RESULT": "No result found" + "BTN_ADD_ACCOUNT": "Join us", + "SEARCH_NO_RESULT": "No result found", + "LOADING": "Loading..." }, "MENU": { - "TITLE": "Cesium", + "TITLE": "Duniter", "HOME": "Home", "REGISTRY": "Registry", "MARKET": "Market place", - "EXPLORE_CURRENCIES": "Explore currencies", - "ACCOUNT": "My Account" + "CURRENCIES": "Currencies", + "ACCOUNT": "My Account", + "SETTINGS": "Settings" }, "HOME": { - "TITLE": "Cesium", - "WELCOME": "Welcome", - "MESSAGE": "<b>Cesium</b> is still in development phase. There is not much to see right now. :-)", + "TITLE": " ", + "WELCOME": "Duniter", + "MESSAGE": "Welcome to Cesium App for Duniter !<br/>See your Duniter wallets in real time.", "BTN_REGISTRY": "Registry", "BTN_MARKET": "Market place", "BTN_CURRENCIES": "Explore currencies" @@ -111,7 +113,12 @@ "AMOUNT": "Amount", "AMOUNT_HELP": "Amount", "COMMENTS": "Reference", - "COMMENTS_HELP": "Reference (optional)" + "COMMENTS_HELP": "Reference (optional)", + "BTN_SEND": "Send", + "BTN_RELATIVE_UNIT": "Amount in relative unit ?", + "MODAL": { + "TITLE": "Transfer" + } }, "MARKET": { "COMMON": { @@ -198,11 +205,13 @@ "SEND_TX_FAILED": "Could not send transaction", "ALL_SOURCES_USED": "Please wait the next block computation (All transaction sources has been used).", "NOT_ENOUGH_SOURCES": "Please wait the next block computation (Not enough transaction sources).", - "ACCOUNT_CREATION_FAILED": "Error while creating your member account" + "ACCOUNT_CREATION_FAILED": "Error while creating your member account", + "LOAD_WALLET_DATA_ERROR": "Error while loading wallet data" }, "INFO": { "POPUP_TITLE": "Information", "CERTIFICATION_DONE": "Identity successfully signed", - "NOT_ENOUGH_CREDIT": "Not enough credit." + "NOT_ENOUGH_CREDIT": "Not enough credit.", + "TRANSFER_SENT": "Transaction successfully sent." } } diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index e47e87a46..f3e02343d 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -9,22 +9,24 @@ "BTN_BACK": "Retour", "BTN_CANCEL": "Annuler", "BTN_LOGIN": "Se connecter", - "BTN_LOGOUT": "Déconnecter", + "BTN_LOGOUT": "Déconnexion", "BTN_ADD_ACCOUNT": "Nous rejoindre", - "SEARCH_NO_RESULT": "Aucun résultat trouvé" + "SEARCH_NO_RESULT": "Aucun résultat trouvé", + "LOADING": "Veuillez patienter..." }, "MENU": { - "TITLE": "Cesium", + "TITLE": "Duniter", "HOME": "Accueil", "REGISTRY": "Annuaire", - "MARKET": "Offres/Demandes", - "EXPLORE_CURRENCIES": "Voir les monnaies", - "ACCOUNT": "Mon compte" + "MARKET": "Annonces", + "CURRENCIES": "Monnaies", + "ACCOUNT": "Mon compte", + "SETTINGS": "Configuration" }, "HOME": { "TITLE": " ", "WELCOME": "Duniter", - "MESSAGE": "Bienvenue dans Duniter !<br/>Regardez l'état de vos comptes en temps réel.", + "MESSAGE": "Bienvenue dans l'application Cesium !<br/>Regardez l'état de vos comptes Duniter en temps réel.", "BTN_REGISTRY": "Annuaire", "BTN_MARKET": "Offres/demandes", "BTN_CURRENCIES": "Explorer les monnaies" @@ -86,7 +88,7 @@ "BTN_MEMBERSHIP_IN": "Devenir membre", "BTN_MEMBERSHIP_RENEW": "Renouveller son adhésion comme membre", "BTN_MEMBERSHIP_OUT": "Arrêter son adhésion", - "BTN_SEND_IDENTITY": "Publier le pseudonym (sans devenir membre)", + "BTN_SEND_IDENTITY": "Publier le pseudonyme", "NEW": { "TITLE": "Inscription", "SLIDE_1_TITLE": "Choix de la monnaie :", @@ -111,7 +113,12 @@ "AMOUNT": "Montant", "AMOUNT_HELP": "Montant", "COMMENTS": "Référence", - "COMMENTS_HELP": "Référence de l'opération (optionnelle)" + "COMMENTS_HELP": "Référence (optionnelle)", + "BTN_SEND": "Envoyer", + "BTN_RELATIVE_UNIT": "Montant en unité relative ?", + "MODAL": { + "TITLE": "Paiement" + } }, "MARKET": { "COMMON": { @@ -120,7 +127,7 @@ "ISSUER": "Soumis par" }, "SEARCH": { - "TITLE": "Offres/Demandes", + "TITLE": "Annonces", "SEARCH_HELP": "Recherche (voiture, livre...)", "BTN_ADD": "Nouveau", "BTN_OPTIONS": "Recherche avancée", @@ -195,14 +202,16 @@ "GET_CURRENCY_PARAMETER": "Echec de la récupération des règles de la monnaie", "GET_CURRENCIES_FAILED": "Impossible de chargement la liste des monnaies", "GET_CURRENCY_FAILED": "Chargement de la monnaie impossible", - "SEND_TX_FAILED": "Echec de l'envoir du transfer", + "SEND_TX_FAILED": "Echec du paiement", "ALL_SOURCES_USED": "Veuillez attendre le cacul du prochain bloc (Toutes vos sources de monnaie ont été utilisées).", "NOT_ENOUGH_SOURCES": "Veuillez attendre le cacul du prochain bloc (Pas assez de sources de monnaie).", - "ACCOUNT_CREATION_FAILED": "Echec de la création du compte membre" + "ACCOUNT_CREATION_FAILED": "Echec de la création du compte membre", + "LOAD_WALLET_DATA_ERROR": "Echec du chargement des données du portefeuille" }, "INFO": { "POPUP_TITLE": "Information", "CERTIFICATION_DONE": "Certification envoyée", - "NOT_ENOUGH_CREDIT": "Credit insuffisant." + "NOT_ENOUGH_CREDIT": "Credit insuffisant.", + "TRANSFER_SENT": "La transaction a été envoyée avec succès." } } diff --git a/www/index.html b/www/index.html index e80f051e6..d1a101565 100644 --- a/www/index.html +++ b/www/index.html @@ -59,6 +59,8 @@ <script src="js/controllers/peer-controllers.js"></script> <script src="js/controllers/currency-controllers.js"></script> <script src="js/controllers/wallet-controllers.js"></script> + <script src="js/controllers/transfer-controllers.js"></script> + <script src="js/controllers/settings-controllers.js"></script> <script src="js/controllers/market-controllers.js"></script> <script src="js/controllers/registry-controllers.js"></script> <script src="js/controllers.js"></script> diff --git a/www/js/controllers.js b/www/js/controllers.js index 7f38eddc8..556042733 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -5,6 +5,8 @@ angular.module('cesium.controllers', [ 'cesium.wallet.controllers', 'cesium.currency.controllers', 'cesium.wot.controllers', + 'cesium.transfer.controllers', + 'cesium.settings.controllers', 'cesium.market.controllers', 'cesium.registry.controllers' ]) diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 553d6907b..6fc70d12c 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -67,12 +67,7 @@ function LoginController($scope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, .then(function(walletData){ resolve(walletData); }) - .catch(function(err) { - UIUtils.loading.hide(); - console.error('>>>>>>>' , err); - UIUtils.alert.error('ERROR.CRYPTO_UNKNOWN_ERROR'); - reject(err); - }); + .catch(UIUtils.onError('ERROR.LOAD_WALLET_DATA_ERROR', reject)); }); } else if (!Wallet.data.loaded) { @@ -80,12 +75,7 @@ function LoginController($scope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, .then(function(walletData){ resolve(walletData); }) - .catch(function(err) { - UIUtils.loading.hide(); - console.error('>>>>>>>' , err); - UIUtils.alert.error('Could not fetch wallet data from remote uCoin node.'); - reject(err); - }); + .catch(UIUtils.onError('ERROR.LOAD_WALLET_DATA_ERROR', reject)); } else { resolve(Wallet.data); @@ -115,7 +105,7 @@ function LoginController($scope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, var callback = $scope.loginData.callback; $scope.loginData = {}; // Reset login data $scope.loginForm.$setPristine(); // Reset form - if (callback != "undefined" && callback != null) { + if (!!callback) { callback(); } // Default: redirect to wallet view @@ -178,7 +168,7 @@ function LoginController($scope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, } -function AppController($scope, $ionicModal, $state, $ionicSideMenuDelegate, UIUtils, $q, $timeout, CryptoUtils, BMA, Wallet, Registry, APP_CONFIG) { +function AppController($scope, $ionicModal, $state, $ionicSideMenuDelegate, UIUtils, $q, $timeout, CryptoUtils, BMA, Wallet, Registry, APP_CONFIG, ionicMaterialInk) { // With the new view caching in Ionic, Controllers are only called // when they are recreated or on app start, instead of every page change. @@ -201,8 +191,11 @@ function AppController($scope, $ionicModal, $state, $ionicSideMenuDelegate, UIUt enable: nodeWithES } }; + LoginController.call(this, $scope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, $state, $timeout, $ionicSideMenuDelegate); + TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils) + //////////////////////////////////////// // Load currencies //////////////////////////////////////// @@ -320,6 +313,6 @@ function AppController($scope, $ionicModal, $state, $ionicSideMenuDelegate, UIUt }; // Set Ink - //ionicMaterialInk.displayEffect(); + ionicMaterialInk.displayEffect(); } diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index 958bcb7b2..7007cca9e 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -53,7 +53,7 @@ angular.module('cesium.currency.controllers', ['cesium.services']) ; -function CurrencyLookupController($scope, $state, $q, $timeout, UIUtils, APP_CONFIG, BMA, Registry) { +function CurrencyLookupController($scope, $state, $q, $timeout, UIUtils, APP_CONFIG, BMA, Registry, ionicMaterialInk) { $scope.selectedCurrency = ''; $scope.knownCurrencies = []; @@ -68,7 +68,7 @@ function CurrencyLookupController($scope, $state, $q, $timeout, UIUtils, APP_CON $scope.selectedCurrency = res[0].id; } // Set Ink - //ionicMaterialInk.displayEffect(); + ionicMaterialInk.displayEffect({selector: 'a.item'}); }); }); @@ -84,7 +84,7 @@ function CurrencyLookupController($scope, $state, $q, $timeout, UIUtils, APP_CON }; } -function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $interval, $timeout, Registry) { +function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $interval, $timeout, Registry, ionicMaterialInk) { var USE_RELATIVE_DEFAULT = true; @@ -99,7 +99,7 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.$on('$ionicView.enter', function(e, $state) { if (!!$scope.node) { - $scope.node.close(); + $scope.node.websocket.block().close(); $scope.node = null; } if ($state.stateParams && $state.stateParams.id) { // Load by id @@ -112,11 +112,13 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i } }); + $scope.$on('$ionicView.beforeLeave', function(){ + $scope.closeNode(); + }); + $scope.load = function(id) { - if (!!$scope.node) { - $scope.node.close(); - $scope.node = null; - } + $scope.closeNode(); + if (!!Registry) { Registry.currency.get({ id: id }) .then(function(currency) { @@ -149,7 +151,6 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i return; } - // Currency OK $scope.node.websocket.block().on('block', function(block) { var theFPR = fpr(block); if ($scope.knownBlocks.indexOf(theFPR) === -1) { @@ -161,11 +162,19 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i }, wait); } }); - $scope.node.websocket.peer().on('peer', function(peer) { + /*$scope.node.websocket.peer().on('peer', function(peer) { console.log(peer); - }); + });*/ }; + $scope.closeNode = function() { + if (!$scope.node) { + return; + } + $scope.node.websocket.close(); + $scope.node = null; + } + $scope.$watch('formData.useRelative', function() { if ($scope.formData.useRelative) { $scope.M = $scope.M / $scope.currentUD; @@ -187,6 +196,9 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i }; $scope.updateExploreView = function() { + if (!$scope.node) { + return; + } UIUtils.loading.show(); $scope.formData.useRelative = false; @@ -231,6 +243,10 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.MoverN = $scope.M / $scope.Nprev; $scope.cactual = 100 * $scope.UD / $scope.MoverN; $scope.formData.useRelative = USE_RELATIVE_DEFAULT; + + // Set Ink + ionicMaterialInk.displayEffect({selector: '.peer-item'}); + UIUtils.loading.hide(); }) .catch(function(err) { diff --git a/www/js/controllers/home-controllers.js b/www/js/controllers/home-controllers.js index d2cd9809f..8b084b4e6 100644 --- a/www/js/controllers/home-controllers.js +++ b/www/js/controllers/home-controllers.js @@ -8,7 +8,7 @@ angular.module('cesium.home.controllers', ['cesium.services']) url: "/home", views: { 'menuContent': { - templateUrl: "templates/home.html", + templateUrl: "templates/home/home.html", controller: 'HomeCtrl' } } @@ -88,7 +88,15 @@ function NewAccountWizardController($scope, $ionicModal, $state, $ionicSideMenuD $scope.newAccountModal = modal; $scope.newAccountModal.hide() .then(function(){ - showModal(); + $scope.loadCurrencies() + .then(function (res) { + $scope.knownCurrencies = res; + $scope.search.looking = false; + if (!!res && res.length == 1) { + $scope.selectedCurrency = res[0].id; + } + showModal(); + }); }); }); diff --git a/www/js/controllers/registry-controllers.js b/www/js/controllers/registry-controllers.js index 3903a3a8c..941999fff 100644 --- a/www/js/controllers/registry-controllers.js +++ b/www/js/controllers/registry-controllers.js @@ -379,13 +379,6 @@ function RegistryRecordViewController($scope, $ionicModal, Wallet, Registry, UIU .catch(UIUtils.onError('ERROR.LOGIN_FAILED')); }; - // Transfer click - $scope.transfer = function() { - $state.go('app.new_transfer', { - pubkey: $scope.formData.issuer, - uid: $scope.formData.title - }); - }; } function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIUtils, $state, CryptoUtils, $q, $ionicPopup, $translate) { diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index e051bd4aa..6a689a484 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -1,5 +1,5 @@ -angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency.controllers']) +angular.module('cesium.settings.controllers', ['cesium.services', 'cesium.currency.controllers']) .config(function($stateProvider, $urlRouterProvider) { $stateProvider @@ -24,50 +24,17 @@ function SettingsController($scope, $state, $q, Wallet, $translate) { $scope.walletData = {}; $scope.$on('$ionicView.enter', function(e, $state) { + if (!$scope.isLogged()) { + return; + } + UIUtils.loading.show(); $scope.loadWallet() .then(function(wallet) { - if (!!Registry && !wallet.avatar) { - Registry.record.avatar({issuer:wallet.pubkey, category:'particulier'}) - .then(function(res) { - if (res.hits.total > 0) { - wallet.avatar = res.hits.hits.reduce(function(res, hit) { - return res.concat(hit._source.pictures.reduce(function(res, pic) { - return res.concat(pic.src); - }, [])[0]); - }, [])[0]; - } - $scope.updateWalletView(wallet); - UIUtils.loading.hide(); - }) - .catch(function(err) { - // no avatar: continue - $scope.updateWalletView(wallet); - UIUtils.loading.hide(); - }) - } - else { - $scope.updateWalletView(wallet); UIUtils.loading.hide(); - } }); }); - $scope.refreshConvertedBalance = function() { - if ($scope.walletData.useRelative) { - $scope.convertedBalance = $scope.walletData.balance ? ($scope.walletData.balance / $scope.walletData.currentUD) : 0; - $scope.unit = 'universal_dividend'; - $scope.udUnit = $scope.walletData.currency; - } else { - $scope.convertedBalance = $scope.walletData.balance; - if (!$scope.convertedBalance) { - $scope.convertedBalance = 0; - } - $scope.unit = $scope.walletData.currency; - $scope.udUnit = ''; - } - }; $scope.$watch('walletData.useRelative', $scope.refreshConvertedBalance, true); - $scope.$watch('walletData.balance', $scope.refreshConvertedBalance, true); // Update view $scope.updateWalletView = function(wallet) { diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js new file mode 100644 index 000000000..44493fd2c --- /dev/null +++ b/www/js/controllers/transfer-controllers.js @@ -0,0 +1,206 @@ +angular.module('cesium.transfer.controllers', ['cesium.services', 'cesium.currency.controllers']) + + .config(function($stateProvider, $urlRouterProvider) { + $stateProvider + + .state('app.new_transfer', { + url: "/transfer/:pubkey/:uid", + views: { + 'menuContent': { + templateUrl: "templates/wallet/new_transfer.html", + controller: 'TransferCtrl' + } + } + }) + + .state('app.new_transfer_pubkey', { + url: "/transfer/:pubkey", + views: { + 'menuContent': { + templateUrl: "templates/wallet/new_transfer.html", + controller: 'TransferCtrl' + } + } + }) + ; + }) + + .controller('TransferCtrl', TransferController) +; + +function TransferController($scope, $ionicModal, $state, BMA, Wallet, UIUtils) { + + TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils) + + $scope.$on('$ionicView.enter', function(e, $state) { + if (!!$state.stateParams + && !!$state.stateParams.pubkey) { + $scope.formData.destPub = $state.stateParams.pubkey; + if (!!$state.stateParams.uid) { + $scope.dest = $state.stateParams.uid; + } + else { + $scope.dest = $scope.destPub; + } + } + + $scope.loadWallet() + .then(function(wallet) { + $scope.walletData = wallet; + $scope.onUseRelativeChanged(); + UIUtils.loading.hide(); + }); + }); + +} + + +function TransferModalController($scope, $ionicModal, $state, BMA, Wallet, UIUtils) { + + $scope.walletData = {}; + $scope.transferForm = {}; + $scope.convertedBalance = 0; + $scope.formData = { + destPub: null, + amount: null, + comments: null + }; + $scope.dest = null; + $scope.udAmount = null; + + WotLookupController.call(this, $scope, BMA, $state); + + // Create the login modal that we will use later + $ionicModal.fromTemplateUrl('templates/wallet/modal_transfer.html', { + scope: $scope, + focusFirstInput: true + }).then(function(modal) { + $scope.transferModal = modal; + $scope.transferModal.hide(); + }); + + $ionicModal.fromTemplateUrl('templates/wot/modal_lookup.html', { + scope: $scope, + controller: 'WotLookupController', + focusFirstInput: true + }).then(function(modal) { + $scope.lookupModal = modal; + $scope.lookupModal.hide(); + }); + + //Cleanup the modal when we're done with it! + $scope.$on('$destroy', function() { + if (!!$scope.transferModal) { + $scope.transferModal.remove(); + } + if (!!$scope.lookupModal) { + $scope.lookupModal.remove(); + } + }); + + $scope.setTransferForm = function(transferForm) { + $scope.transferForm = transferForm; + } + + // Open transfer modal + $scope.transfer = function(destPub, dest, callback) { + UIUtils.loading.show(); + if (!!$scope.transferModal) { + $scope.formData.destPub = destPub; + $scope.formData.callback = callback; + $scope.dest = dest; + $scope.loadWallet() + .then(function(walletData) { + UIUtils.loading.hide(); + $scope.walletData = walletData; + $scope.transferModal.show(); + }); + } + else{ + $timeout($scope.transfer, 2000); + } + }; + + // Triggered in the login modal to close it + $scope.closeTransfer = function() { + $scope.formData = {}; // Reset login data + $scope.transferForm.$setPristine(); // Reset form + $scope.transferModal.hide(); + }; + + // When changing use relative UD + $scope.onUseRelativeChanged = function() { + if ($scope.walletData.useRelative) { + $scope.convertedBalance = $scope.walletData.balance / $scope.walletData.currentUD; + $scope.udAmount = $scope.amount * $scope.walletData.currentUD; + $scope.unit = 'universal_dividend'; + $scope.udUnit = $scope.walletData.currency; + } else { + $scope.convertedBalance = $scope.walletData.balance; + // Convert to number + $scope.formData.amount = (!!$scope.formData.amount && typeof $scope.formData.amount == "string") + ? Math.floor(parseFloat($scope.formData.amount.replace(new RegExp('[,]'), '.'))) + : $scope.formData.amount; + // Compute UD + $scope.udAmount = (!!$scope.formData.amount + && typeof $scope.formData.amount == "number" + && !!$scope.walletData.currentUD + && typeof $scope.walletData.currentUD == "number") + ? $scope.formData.amount / $scope.walletData.currentUD + : null; + $scope.unit = $scope.walletData.currency; + $scope.udUnit = ''; + } + }; + $scope.$watch('walletData.useRelative', $scope.onUseRelativeChanged, true); + $scope.$watch('walletData.balance', $scope.onUseRelativeChanged, true); + + $scope.openWotLookup = function() { + $scope.lookupModal.show(); + } + + $scope.doTransfer = function() { + UIUtils.loading.show(); + + var amount = $scope.formData.amount; + if ($scope.walletData.useRelative + && !!amount + && typeof amount == "string") { + amount = $scope.walletData.currentUD + * amount.replace(new RegExp('[.,]'), '.'); + } + + Wallet.transfer($scope.formData.destPub, amount, $scope.formData.comments) + .then(function() { + var callback = $scope.formData.callback; + $scope.formData = {}; // Reset form data + $scope.transferForm.$setPristine(); // Reset form + $scope.closeTransfer(); + if (!!callback) { + callback(); + } + // Default: redirect to wallet view + else { + UIUtils.loading.hide(); + UIUtils.alert.info('INFO.TRANSFER_SENT'); + $state.go('app.view_wallet'); + } + }) + .catch(UIUtils.onError('ERROR.SEND_TX_FAILED')); + }; + + $scope.closeLookup = function() { + $scope.lookupModal.hide(); + } + + $scope.doSelectIdentity = function(pub, uid) { + if (uid != "undefined" && uid != null) { + $scope.dest = uid; + } + else { + $scope.dest = uid; + } + $scope.formData.destPub = pub; + $scope.lookupModal.hide(); + } +} diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index ff55b1624..d9fb7222b 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -13,36 +13,14 @@ angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency } } }) - - .state('app.new_transfer', { - url: "/transfer/:pubkey/:uid", - views: { - 'menuContent': { - templateUrl: "templates/wallet/new_transfer.html", - controller: 'TransferCtrl' - } - } - }) - - .state('app.new_transfer_pubkey', { - url: "/transfer/:pubkey", - views: { - 'menuContent': { - templateUrl: "templates/wallet/new_transfer.html", - controller: 'TransferCtrl' - } - } - }) ; }) .controller('WalletCtrl', WalletController) - - .controller('TransferCtrl', TransferController) ; function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $timeout, - ionicMaterialMotion, /*ionicMaterialInk,*/ + ionicMaterialMotion, ionicMaterialInk, UIUtils, Wallet, BMA, $translate, Registry) { $scope.walletData = {}; @@ -105,22 +83,21 @@ function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $t ionicMaterialMotion.fadeSlideInRight({ startVelocity: 3000 }); - ionicMaterialMotion.slideUp({ - selector: '.slide-up' - }); - // Set Ink - //ionicMaterialInk.displayEffect(); + ionicMaterialInk.displayEffect({selector: '.item'}); }, 10); }; // Transfer click - $scope.transfer= function() { + $scope.openTransfer = function() { if (!$scope.hasCredit) { UIUtils.alert.info('INFO.NOT_ENOUGH_CREDIT'); return; } - $state.go('app.new_transfer'); + $scope.transfer(null,null, function() { + UIUtils.loading.hide(); + UIUtils.alert.info('INFO.TRANSFER_SENT'); + }); }; $scope.setRegisterForm = function(registerForm) { @@ -285,106 +262,4 @@ function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $t }; } -function TransferController($scope, $ionicModal, $state, $ionicHistory, BMA, Wallet, UIUtils) { - - $scope.walletData = {}; - $scope.convertedBalance = 0; - $scope.formData = { - destPub: null, - amount: null, - comments: null - }; - $scope.dest = null; - $scope.udAmount = null; - - WotLookupController.call(this, $scope, BMA, $state); - - $scope.$on('$ionicView.enter', function(e, $state) { - if ($state.stateParams != null - && $state.stateParams.pubkey != null - && $state.stateParams.pubkey != "undefined") { - $scope.destPub = $state.stateParams.pubkey; - if ($state.stateParams.uid != null - && $state.stateParams.uid != "undefined") { - $scope.dest = $state.stateParams.uid; - } - else { - $scope.dest = $scope.destPub; - } - } - - // Login and load wallet - $scope.loadWallet() - .then(function(walletData) { - $scope.walletData = walletData; - $scope.onUseRelativeChanged(); - UIUtils.loading.hide(); - }); - }); - - // When chaing use relative UD - $scope.onUseRelativeChanged = function() { - if ($scope.walletData.useRelative) { - $scope.convertedBalance = $scope.walletData.balance / $scope.walletData.currentUD; - $scope.udAmount = $scope.amount * $scope.walletData.currentUD; - $scope.unit = 'universal_dividend'; - $scope.udUnit = $scope.walletData.currency; - } else { - $scope.convertedBalance = $scope.walletData.balance; - $scope.formData.amount = ($scope.formData.amount != "undefined" && $scope.formData.amount != null) - ? Math.floor(parseFloat($scope.formData.amount.replace(new RegExp('[,]'), '.'))) - : null; - $scope.udAmount = $scope.amount / $scope.walletData.currentUD; - $scope.unit = $scope.walletData.currency; - $scope.udUnit = ''; - } - }; - $scope.$watch('walletData.useRelative', $scope.onUseRelativeChanged, true); - $scope.$watch('walletData.balance', $scope.onUseRelativeChanged, true); - - $ionicModal.fromTemplateUrl('templates/wot/modal_lookup.html', { - scope: $scope, - focusFirstInput: true - }).then(function(modal) { - $scope.lookupModal = modal; - $scope.lookupModal.hide(); - }); - - $scope.openSearch = function() { - $scope.lookupModal.show(); - } - - $scope.doTransfer = function() { - UIUtils.loading.show(); - - var amount = $scope.formData.amount; - if ($scope.walletData.useRelative - && amount != "undefined" - && amount != null) { - amount = $scope.walletData.currentUD - * amount.replace(new RegExp('[.,]'), '.'); - } - Wallet.transfer($scope.formData.destPub, amount, $scope.formData.comments) - .then(function() { - UIUtils.loading.hide(); - $ionicHistory.goBack() - }) - .catch(UIUtils.onError('ERROR.SEND_TX_FAILED')); - }; - - $scope.closeLookup = function() { - $scope.lookupModal.hide(); - } - - $scope.doSelectIdentity = function(pub, uid) { - if (uid != "undefined" && uid != null) { - $scope.dest = uid; - } - else { - $scope.dest = uid; - } - $scope.formData.destPub = pub; - $scope.lookupModal.hide(); - } -} diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index f880d9883..ef4084a9d 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -55,7 +55,7 @@ function WotLookupController($scope, BMA, $state) { }; } -function IdentityController($scope, $state, BMA, Wallet, UIUtils, $q) { +function IdentityController($scope, $state, BMA, Wallet, UIUtils, $q, ionicMaterialMotion, $timeout, ionicMaterialInk) { $scope.identity = {}; $scope.hasSelf = false; @@ -87,6 +87,13 @@ function IdentityController($scope, $state, BMA, Wallet, UIUtils, $q) { .then(function(block) { $scope.identity.sigDate = block.time; UIUtils.loading.hide(); + + // Set Motion + $timeout(function() { + ionicMaterialMotion.fadeSlideIn({ + selector: '.item' + }); + }, 10); }) .catch(UIUtils.onError('ERROR.LOAD_IDENTITY_FAILED')); }) @@ -111,11 +118,8 @@ function IdentityController($scope, $state, BMA, Wallet, UIUtils, $q) { .catch(UIUtils.onError('ERROR.LOGIN_FAILED')); }; - // Transfer click - $scope.transfer = function() { - $state.go('app.new_transfer', { - pubkey: $scope.identity.pubkey, - uid: $scope.identity.uid - }); - }; + $scope.$parent.clearFabs(); + + ionicMaterialInk.displayEffect(); + } diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 31a083d93..48cbcbb09 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -85,23 +85,29 @@ angular.module('cesium.bma.services', ['ngResource', } function ws(uri) { - var sock = new WebSocket(uri); - sockets.concat(sock); + var sock = null; return { on: function(type, callback) { + if (!sock) { + sock = new WebSocket(uri) + sockets.push(this); + } sock.onmessage = function(e) { callback(JSON.parse(e.data)); }; }, close: function(type, callback) { - sock.close(); + if (!!sock) { + sock.close(); + sock = null; + } } }; } - function close() { + function closeWs() { if (sockets.length > 0) { - sockets.length.forEach(function(sock) { + sockets.forEach(function(sock) { sock.close(); }); sockets = []; // Reset socks list @@ -149,7 +155,8 @@ angular.module('cesium.bma.services', ['ngResource', }, peer: function() { return ws('ws://' + wsServer + '/ws/peer'); - } + }, + close : closeWs } } } diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 46187900d..94271dad6 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -3,6 +3,9 @@ angular.module('cesium.utils.services', ['ngResource']) .factory('UIUtils', function($ionicLoading, $ionicPopup, $translate, $q) { + + var loadingTextCache=null; + function alertError(err, subtitle) { $translate([err, subtitle, 'ERROR.POPUP_TITLE', 'ERROR.UNKNOWN_ERROR', 'COMMON.BTN_OK']) .then(function (translations) { @@ -48,8 +51,17 @@ angular.module('cesium.utils.services', ['ngResource']) } function showLoading() { + if (!loadingTextCache) { + $translate(['COMMON.LOADING']) + .then(function(translations){ + loadingTextCache = translations['COMMON.LOADING']; + showLoading(); + }); + return; + } + $ionicLoading.show({ - template: 'Loading...' + template: loadingTextCache }); } diff --git a/www/templates/account/view_wallet.html b/www/templates/account/view_wallet.html deleted file mode 100644 index 64f7ec108..000000000 --- a/www/templates/account/view_wallet.html +++ /dev/null @@ -1,107 +0,0 @@ -<ion-view left-buttons="leftButtons" view-title="" id="wallet"> - <ion-nav-buttons side="secondary"> - <button class="button button-icon" ng-click="doUpdate()"> - <i class="icon ion-android-refresh"></i> - </button> - <button class="button button-icon visible-xs visible-sm" ng-click="showActionsheet()"> - <i class="icon ion-android-more-vertical"></i> - </button> - - </ion-nav-buttons> - - <ion-content> - <div class="scroll"> - - <div class="item item-royal item-icon-left center item-text-wrap"> - <i class="icon " ng-class="{'ion-card': !isMember, 'ion-person': isMember}"></i> - <h2 class="light" ng-if="isMember">{{walletData.uid}}</h2> - <h4 class="light" ng-if="isMember">{{walletData.pubkey | formatPubkey}}</h4> - <h2 class="light" ng-if="!isMember">{{walletData.pubkey | formatPubkey}}</h2> - <h1 class="light"> - <span ng-if="!walletData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> - <span ng-if="walletData.useRelative">{{convertedBalance | formatDecimal}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub></span> - </h1> - </div> - - <div class="item item-content item-toggle dark"> - <h4 class="gray"> - {{'COMMON.BTN_RELATIVE_UNIT' | translate}} - </h4> - <label class="toggle toggle-royal"> - <input type="checkbox" ng-model="walletData.useRelative"> - <div class="track"> - <div class="handle"></div> - </div> - </label> - </div> - - <div class="hidden-xs hidden-sm padding" style="text-align:center"> - <button class="button button-assertive" - ng-click="transfer()"> - {{'ACCOUNT.BTN_SEND_MONEY' | translate}} - </button> - - <button class="button icon-left ion-person" - ng-if="needMembership" - ng-click="membershipIn()"> - {{'ACCOUNT.BTN_MEMBERSHIP_IN' | translate}} - </button> - - <button class="button icon-left ion-loop" - ng-if="needRenew" - ng-click="membershipRenew()"> - {{'ACCOUNT.BTN_MEMBERSHIP_RENEW' | translate}} - </button> - - <button class="button icon-left ion-log-out" - ng-if="needMembershipOut" - ng-click="membershipOut()"> - {{'ACCOUNT.BTN_MEMBERSHIP_OUT' | translate}} - </button> - - <button class="button icon-left ion-flag" - ng-if="needSelf" - ng-click="self()"> - {{'ACCOUNT.BTN_SEND_IDENTITY' | translate}} - </button> - </div> - - <div class="list"> - - <!--div class="item-divider"> - - </div> - - - - <!--TODO : charger les TX en arrière plan - label class="item center" ng-if="search.looking"> - <ion-spinner icon="android"></ion-spinner> - </label--> - - <!-- Last Transactions --> - <div ng-if="walletData.history && walletData.history.length > 0"> - - <div class="item item-divider"> - {{'ACCOUNT.LAST_TX' | translate}} - </div> - - <a href="#" class="item" ng-repeat="tx in walletData.history"> - <h3>{{tx.time | formatDate}}</h3> - <p ng-if="tx.issuer">{{'COMMON.PUBKEY' | translate}}: {{tx.issuer | formatPubkey}}</p> - <p ng-if="tx.receiver">{{'COMMON.PUBKEY' | translate}}: {{tx.receiver | formatPubkey}}</p> - <span class="badge item-note" ng-if="!walletData.useRelative">{{tx.amount | formatInteger}}</span> - <span class="badge item-note" ng-if="walletData.useRelative">{{tx.amount/walletData.currentUD | formatDecimal}}</span> - </a> - </div> - - </div> - <div class="scroll-bar scroll-bar-v"></div> - </div> - </ion-content> - - <button class="button button-float visible-xs visible-sm" ng-click="transfer()"> - <i class="icon ion-android-send"></i> - </button> -</ion-view> - \ No newline at end of file diff --git a/www/templates/currency/lookup.html b/www/templates/currency/lookup.html index 0dbc705ae..3424c1aa6 100644 --- a/www/templates/currency/lookup.html +++ b/www/templates/currency/lookup.html @@ -1,5 +1,7 @@ <ion-view view-title="{{'CURRENCY.SELECT.TITLE' | translate}}"> <ion-content class="padding no-padding-xs"> - <ng-include src="'templates/currency/lookup_form.html'"/> + <h4 class="content double-padding-x" translate>CURRENCY.SELECT.CURRENCIES</h4> + + <ng-include src="'templates/currency/lookup_form.html'"/> </ion-content> </ion-view> diff --git a/www/templates/currency/lookup_form.html b/www/templates/currency/lookup_form.html index ab1509c5c..850d2e807 100644 --- a/www/templates/currency/lookup_form.html +++ b/www/templates/currency/lookup_form.html @@ -1,5 +1,4 @@ -<h4 class="content double-padding-x" translate>CURRENCY.SELECT.CURRENCIES</h4> <ion-list> @@ -9,7 +8,7 @@ <div ng-repeat="currency in knownCurrencies" ng-class="{ selected: selectedCurrency == currency }"> - <a class="item item-text-wrap hidden-xs hidden-sm ink" ng-click="selectCurrency(currency.id, true)" + <a class="item hidden-xs hidden-sm ink" ng-click="selectCurrency(currency.id, true)" ng-class="{ selected: selectedCurrency == currency }"> <h3>{{currency.id}}</h3> <h4 class="gray">{{currency.peer}}</h4> diff --git a/www/templates/home.html b/www/templates/home/home.html similarity index 100% rename from www/templates/home.html rename to www/templates/home/home.html diff --git a/www/templates/home/new_account_wizard.html b/www/templates/home/new_account_wizard.html index 5a41f5611..2e202e3be 100644 --- a/www/templates/home/new_account_wizard.html +++ b/www/templates/home/new_account_wizard.html @@ -1,6 +1,6 @@ <ion-view class="modal slide-in-up ng-enter active ng-enter-active"> - <ion-header-bar class="bar-dark"> + <ion-header-bar class="bar-positive"> <button class="button button-icon button-clear icon ion-ios-arrow-back buttons header-item" ng-click="slidePrev()" ng-show="slides.slider.activeIndex > 0"> </button> @@ -8,7 +8,7 @@ <h1 class="title" translate>ACCOUNT.NEW.TITLE</h1> - <button class="button button-positive button-icon ion-android-send visible-xs" ng-click="doNewAccount()" ng-show="slides.slider.activeIndex == 2"></button> + <button class="button button-icon button-clear icon ion-android-send visible-xs" ng-click="doNewAccount()" ng-show="slides.slider.activeIndex == 2"></button> </ion-nav-buttons> </ion-header-bar> @@ -121,10 +121,10 @@ ng-click="showAccountPubkey()" ng-if="!accountData.pubkey && accountForm.$valid" class="animate-if" translate> - COMMON.BTN_SHOW + COMMON.BTN_SHOW_PUBKEY </a> - <span class="badge badge-energized" ng-if="accountData.pubkey"> - {{accountData.pubkey | formatPubkey}} + <span class="item-input" ng-if="accountData.pubkey"> + {{accountData.pubkey}} </span> </div> </div> diff --git a/www/templates/login.html b/www/templates/login.html index 6073df5ec..989ec781a 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -51,10 +51,11 @@ </div> </div> - <!-- show public key --> - <div class="item item-icon-left item-button-right left"> + <!-- Show public key --> + <div class="item item-icon-left item-button-right left" + ng-if="!(loginData.pubkey || loginData.computing || !loginData.username || !loginData.password)"> <span class="input-label" translate>COMMON.PUBKEY</span> - <a class="button button-light button-small ink" ng-click="showLoginPubkey()" ng-if="!(loginData.pubkey || loginData.computing || !loginData.username || !loginData.password)" + <a class="button button-light button-small ink" ng-click="showLoginPubkey()" class="animate-if"> {{'COMMON.BTN_SHOW_PUBKEY' | translate}} </a> @@ -63,6 +64,7 @@ </h3> </div> </div> + <div class="padding hidden-xs"> <button class="button button-block button-positive ink" type="submit"> {{'COMMON.BTN_LOGIN' | translate}} diff --git a/www/templates/menu.html b/www/templates/menu.html index fadd63d3f..0ac89a1d2 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -2,7 +2,7 @@ <!-- MENU --> <ion-side-menu side="left" id="menu"> - <ion-header-bar class="bar-positive-900"> + <ion-header-bar class="bar"> <h1 class="title" translate> MENU.TITLE </h1> @@ -13,34 +13,40 @@ <i class="icon ion-home"></i> <span translate>MENU.HOME</span> </ion-item> - <div class="item-divider"></div> - <ion-item menu-close class="item-icon-left" href="#/app/registry" ng-if="options.registry.enable"> + <ion-item menu-close class="item item-icon-left" href="#/app/currency"> + <i class="icon ion-ios-world-outline"></i> + <span translate>MENU.CURRENCIES</span> + </ion-item> + + <div class="item item-divider"></div> + + <ion-item menu-close class="item item-icon-left" href="#/app/registry" ng-if="options.registry.enable"> <i class="icon ion-person-stalker"></i> <span translate>MENU.REGISTRY</span> </ion-item> - <ion-item menu-close class="item-icon-left" href="#/app/market" ng-if="options.market.enable"> + <ion-item menu-close class="item item-icon-left" href="#/app/market" ng-if="options.market.enable"> <i class="icon ion-bag"></i> <span translate>MENU.MARKET</span> </ion-item> - <ion-item menu-close class="item-icon-left" href="#/app/currency"> - <i class="icon ion-ios-world-outline"></i> - <span translate>MENU.EXPLORE_CURRENCIES</span> - </ion-item> - <div class="item-divider"></div> + <div class="item item-divider"></div> - <ion-item menu-close class="item-icon-left" ng-click="login()" ng-if="!isLogged()"> + <ion-item menu-close class="item item-icon-left" ng-click="login()" ng-if="!isLogged()"> <i class="icon ion-card"></i> <span translate>MENU.ACCOUNT</span> </ion-item> - <ion-item menu-close class="item-icon-left" href="#" ui-sref="app.view_wallet" ng-if="isLogged()"> + <ion-item menu-close class="item item-icon-left" href="#" ui-sref="app.view_wallet" ng-if="isLogged()"> <i class="icon ion-card"></i> <span translate>MENU.ACCOUNT</span> </ion-item> <!-- <ion-item menu-close ng-click="addAccount()"> Add account </ion-item> --> - <ion-item menu-close class="item-assertive item-icon-left" ng-click="logout()" ng-if="isLogged()"> + <ion-item menu-close class="item item-icon-left" href="#/app/settings"> + <i class="icon ion-wrench"></i> + <span translate>MENU.SETTINGS</span> + </ion-item> + <ion-item menu-close class="item item-assertive item-icon-left" ng-click="logout()" ng-if="isLogged()"> <i class="icon ion-log-out"></i> <span translate>COMMON.BTN_LOGOUT</span> </ion-item> diff --git a/www/templates/registry/view_record.html b/www/templates/registry/view_record.html index f901122fe..f7af6f3ca 100644 --- a/www/templates/registry/view_record.html +++ b/www/templates/registry/view_record.html @@ -43,9 +43,8 @@ </div> - <div class="item-divider"></div> - <div class="item item-button-right positive" ng-click="transfer()"> + <div class="item item-button-right positive" ng-click="transfer(formData.issuer, formData.title)"> {{'ACCOUNT.BTN_SEND_MONEY' | translate}} <a class="button button-clear button-positive" > <i class="icon-right ion-chevron-right"></i> diff --git a/www/templates/wallet/modal_transfer.html b/www/templates/wallet/modal_transfer.html new file mode 100644 index 000000000..1f990c885 --- /dev/null +++ b/www/templates/wallet/modal_transfer.html @@ -0,0 +1,12 @@ +<ion-modal-view class="transfer"> + <ion-header-bar class="bar-positive"> + <button class="button button-clear" ng-click="closeTransfer()" translate>COMMON.BTN_CANCEL</button> + <h1 class="title" translate>TRANSFER.MODAL.TITLE</h1> + <button class="button button-icon button-clear icon ion-android-send visible-xs" ng-click="doTransfer()"> + </button> + </ion-header-bar> + + <ion-content scroll="false"> + <ng-include src="'templates/wallet/transfer_form.html'"></ng-include> + </ion-content> +</ion-modal-view> diff --git a/www/templates/wallet/new_transfer.html b/www/templates/wallet/new_transfer.html index b7ae76dbe..5bd8b9bb9 100644 --- a/www/templates/wallet/new_transfer.html +++ b/www/templates/wallet/new_transfer.html @@ -1,56 +1,14 @@ <ion-view view-title="{{'TRANSFER.TITLE' | translate}}" left-buttons="leftButtons"> - <ion-nav-buttons side="secondary"> - <button class="button button-icon button-clear icon ion-android-send" ng-click="doTransfer()"> - </button> - </ion-nav-buttons> - - <ion-content id="transfer"> - <div class="scroll"> - <div class="list"> - - <span class="item item-button-right" ng-click="openSearch()"> - {{'TRANSFER.TO' | translate}} - <span class="badge badge-royal">{{dest}}</span> - <i class="button button-clear ion-chevron-right"></i> - </span> - - <span class="item item-text-wrap"> - {{'TRANSFER.FROM' | translate}} - <span class="badge" - ng-class="{'badge-assertive': (convertedBalance <= 0 || (formData.amount && convertedBalance < formData.amount)), 'badge-balanced': (convertedBalance > 0 && (!formData.amount || convertedBalance >= formData.amount)) }"> - {{walletData.pubkey| formatPubkey}} / - <span ng-if="!walletData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> - <span ng-if="walletData.useRelative">{{convertedBalance | formatDecimal}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub></span> - </span> - </span> - - <div class="item item-content item-toggle dark"> - <h4 class="gray">{{'COMMON.BTN_RELATIVE_UNIT' | translate}}</h4> - <label class="toggle toggle-royal"> - <input type="checkbox" ng-model="walletData.useRelative"> - <div class="track"> - <div class="handle"></div> - </div> - </label> - </div> - - <div class="item item-input item-floating-label" ng-if="!walletData.useRelative"> - <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> - <input type="number" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" ng-model="formData.amount" > - </div> - - <div class="item item-input item-floating-label" ng-if="walletData.useRelative"> - <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> - <input type="text" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" ng-model="formData.amount" > - </div> - - - <label class="item item-input"> - <textarea placeholder="{{'TRANSFER.COMMENTS_HELP' | translate}}" ng-model="formData.comments"></textarea> - </label> - </div> - - <div class="scroll-bar scroll-bar-v"></div> - </div> - </ion-content> + <ion-nav-buttons side="secondary"> + <button class="button button-icon button-clear icon ion-android-send visible-xs" ng-click="doTransfer()"> + </button> + </ion-nav-buttons> + + <ion-content class="no-padding-xs"> + <div class="scroll"> + <ng-include src="'templates/wallet/transfer_form.html'"></ng-include> + + <div class="scroll-bar scroll-bar-v"></div> + </div> + </ion-content> </ion-view> diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html new file mode 100644 index 000000000..2b909e0b3 --- /dev/null +++ b/www/templates/wallet/transfer_form.html @@ -0,0 +1,55 @@ + <form name="transferForm" novalidate="" ng-submit="doTransfer()"> + + <div class="list" ng-init="setTransferForm(transferForm)"> + + <span class="item item-button-right gray" ng-click="openWotLookup()"> + <span class="gray" translate>TRANSFER.TO</span> + <span class="badge badge-royal">{{dest | formatPubkey}}</span> + <i class="button button-clear ion-chevron-right"></i> + </span> + + <span class="item item-text-wrap"> + <span class="gray" translate>TRANSFER.FROM</span> + <span class="badge" + ng-class="{'badge-assertive': (convertedBalance <= 0 || (formData.amount && convertedBalance < formData.amount)), 'badge-balanced': (convertedBalance > 0 && (!formData.amount || convertedBalance >= formData.amount)) }"> + {{walletData.pubkey| formatPubkey}} / + <span ng-if="!walletData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> + <span ng-if="walletData.useRelative">{{convertedBalance | formatDecimal}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub></span> + </span> + </span> + + <div class="item item-input item-floating-label" ng-if="!walletData.useRelative"> + <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> + <input type="number" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" + ng-model="formData.amount" required> + </div> + + <div class="item item-input item-floating-label" ng-if="walletData.useRelative"> + <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> + <input type="text" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" ng-model="formData.amount" + required> + </div> + + + <div class="item item-content item-toggle dark"> + <h4 class="gray">{{'TRANSFER.BTN_RELATIVE_UNIT' | translate}}</h4> + <label class="toggle toggle-royal"> + <input type="checkbox" ng-model="walletData.useRelative"> + <div class="track"> + <div class="handle"></div> + </div> + </label> + </div> + + <label class="item item-input"> + <textarea placeholder="{{'TRANSFER.COMMENTS_HELP' | translate}}" ng-model="formData.comments"></textarea> + </label> + </div> + + <div class="padding hidden-xs"> + <button class="button button-block button-positive button-raised icon icon-right ion-android-send ink" type="submit"> + {{'TRANSFER.BTN_SEND' | translate}} + </button> + </div> + </form> + diff --git a/www/templates/wallet/view_wallet.html b/www/templates/wallet/view_wallet.html index fd27f3f09..57a2c9dc5 100644 --- a/www/templates/wallet/view_wallet.html +++ b/www/templates/wallet/view_wallet.html @@ -13,6 +13,7 @@ <ion-content ng-class="{expanded:isExpanded}"> <div class="scroll"> + <div class="positive-900-bg hero"> <div class="content"> <div class="avatar" @@ -30,7 +31,7 @@ <div class="hidden-xs hidden-sm padding" style="text-align:center"> <button class="button button-raised button-assertive ink-dark" - ng-click="transfer()"> + ng-click="openTransfer()"> {{'ACCOUNT.BTN_SEND_MONEY' | translate}} </button> @@ -84,6 +85,7 @@ </ion-content> - <button class="button button-fab button-fab-bottom-right button-assertive icon ion-android-send visible-xs visible-sm" ng-click="transfer()"> - </button> + <button class="button button-fab button-fab-bottom-right button-assertive icon ion-android-send visible-xs visible-sm" + ng-click="openTransfer()"> + </button> </ion-view> diff --git a/www/templates/wot/modal_lookup.html b/www/templates/wot/modal_lookup.html index 69a66c0d2..07098b7ed 100644 --- a/www/templates/wot/modal_lookup.html +++ b/www/templates/wot/modal_lookup.html @@ -1,7 +1,7 @@ <ion-modal-view> - <ion-header-bar class="bar-dark"> + <ion-header-bar class="bar-positive"> <button class="button button-clear" ng-click="closeLookup()" translate>COMMON.BTN_CANCEL</button> - <h1 class="title" translate>WOT.MODAL.TITLE</h1> + <h1 class="title" translate>WOT.MODAL.TITLE</h1> </ion-header-bar> <ion-content> diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index b84d431c9..0ce24e032 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -1,40 +1,57 @@ <ion-view view-title="{{identity.uid}}" left-buttons="leftButtons"> -<ion-content> + + + + <ion-content> + <div class="positive-900-bg hero"> + <div class="content"> + <div class="avatar" + ng-if="!!identity.avatar" + style="background-image: url({{identity.avatar}});"></div> + <i class="avatar avatar-member" ng-if="!identity.avatar"></i> + <h3 class="light">{{identity.uid}}</h3> + <h4 class="light"> + {{identity.pub | formatPubkey}} + </h4> + </div> + </div> <div class="scroll"> - <div class="list"> - <span class="item item-icon-left"> - <i class="icon ion-person"></i> - <h2 class="positive">{{identity.uid}}</h2> - <h4 class="gray">{{'WOT.REGISTERED_SINCE' | translate}}{{identity.sigDate | formatDate}}</h4> - </span> - - <a class="item item-icon-left"> - <i class="icon ion-key"></i> - <h4 class="gray">{{identity.pub}}</h4> - </a> - - <div class="item-divider"></div> - - <div class="item item-button-right positive" ng-click="transfer()"> - {{'WOT.BTN_SEND_MONEY' | translate}} - <a class="button button-clear button-positive" > - <i class="icon-right ion-chevron-right"></i> - </a> - </div> - - <div class="item item-button-right positive" ng-click="signIdentity()" ng-if="hasSelf"> - {{'WOT.BTN_CERTIFY' | translate}} - <a class="button button-clear button-positive" > - <i class="icon-right ion-chevron-right"></i> - </a> - </div> - - <!--div class="item item-divider" ng-if="isLogged()"> - Last transactions - </div--> - - </div> - <div class="scroll-bar scroll-bar-v"></div> + + + <div class="hidden-xs hidden-sm padding" style="text-align:center"> + <button class="button button-raised button-assertive ink-dark" + ng-click="transfer(identity.pub, identity.uid)"> + {{'ACCOUNT.BTN_SEND_MONEY' | translate}} + </button> + + <button class="button button-raised icon-left ion-person" ng-click="signIdentity()" ng-if="hasSelf"> + {{'WOT.BTN_CERTIFY' | translate}} + </button> + </div> + + <div class="list animate-fade-slide-in"> + <span class="item item-icon-left"> + <i class="icon ion-calendar"></i> + <span>{{'WOT.REGISTERED_SINCE' | translate}}</span> + <span class="badge badge-balanced">{{identity.sigDate | formatDate}}</span> + </span> + + <a class="item item-icon-left"> + <i class="icon ion-key"></i> + <h4 class="gray">{{identity.pub}}</h4> + </a> + </div> + <div class="scroll-bar scroll-bar-v"></div> </div> -</ion-content> + </ion-content> + + <button class="button button-fab button-fab-bottom-right button-assertive icon ion-android-send visible-xs visible-sm" + ng-click="transfer(identity.pub, identity.uid)"> + </button> + + <button class="button button-fab button-fab-bottom-right button-assertive icon ion-ribbon-b visible-xs visible-sm" + ng-click="signIdentity()" + ng-if="hasSelf" + style="bottom:78px;"> + </button> </ion-view> -- GitLab