From 8fd8a9ffd4bdd7dec269099ed2e2b780988424ab Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Tue, 25 Oct 2016 14:22:33 +0200 Subject: [PATCH] - code refactoring: use $root.walldetData instead of $scope.walletData, when possible - fix wallet header refresh, after logout and login - ES: comment now display user avatar and name, is exists - ES: add "share" button to popover actions - ES: fix misspelling --- www/js/controllers/app-controllers.js | 7 +-- www/js/controllers/currency-controllers.js | 4 +- www/js/controllers/help-controllers.js | 53 +++++++------------ www/js/controllers/peer-controllers.js | 2 +- www/js/controllers/transfer-controllers.js | 24 ++++----- www/js/controllers/wallet-controllers.js | 46 ++++++++-------- www/js/controllers/wot-controllers.js | 29 +++++----- www/js/services/utils-services.js | 12 ++++- www/plugins/es/i18n/locale-fr-FR.json | 4 +- .../es/js/controllers/app-controllers.js | 6 +-- .../es/js/controllers/common-controllers.js | 6 +-- .../es/js/controllers/market-controllers.js | 51 ++++++++++++------ .../es/js/controllers/registry-controllers.js | 52 ++++++++++++------ .../es/js/services/comment-services.js | 20 +++---- www/plugins/es/js/services/user-services.js | 24 +++++---- .../es/templates/common/view_comments.html | 13 +++-- .../market/view_popover_actions.html | 6 +++ .../es/templates/market/view_record.html | 25 ++++----- .../registry/view_popover_actions.html | 6 +++ .../es/templates/registry/view_record.html | 25 ++++----- www/templates/wallet/popover_unit.html | 4 +- www/templates/wallet/transfer_form.html | 14 ++--- www/templates/wallet/view_wallet.html | 7 +-- .../wallet/view_wallet_tx_error.html | 20 +++---- www/templates/wot/view_identity.html | 2 +- 25 files changed, 248 insertions(+), 214 deletions(-) diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index ea88094ed..4d27afc13 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -82,18 +82,13 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ $rootScope.config = csConfig; $rootScope.device = Device; $rootScope.login = Wallet.isLogin(); - console.debug("$root.login="+$rootScope.login); - - $rootScope.smallscreen = screenmatch.bind('xs, sm', $rootScope); - - $rootScope.smallscreen.active = true; //true if the screen is xs or sm //////////////////////////////////////// // Show currency view //////////////////////////////////////// $scope.showCurrencyView = function() { - $state.go(screenmatch.is('sm, xs') ? 'app.currency_view': 'app.currency_view_lg'); + $state.go(UIUtils.screen.isSmall() ? 'app.currency_view': 'app.currency_view_lg'); }; //////////////////////////////////////// diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index c3025fdf8..3767e3618 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -59,7 +59,7 @@ angular.module('cesium.currency.controllers', ['cesium.services']) ; -function CurrencyLookupController($scope, $state, UIUtils, csCurrency, screenmatch) { +function CurrencyLookupController($scope, $state, UIUtils, csCurrency) { 'ngInject'; $scope.selectedCurrency = ''; @@ -82,7 +82,7 @@ function CurrencyLookupController($scope, $state, UIUtils, csCurrency, screenmat // Called to navigate to the main app $scope.selectCurrency = function(id) { $scope.selectedCurrency = id; - $state.go(screenmatch.is('sm, xs') ? 'app.currency_view' : 'app.currency_view_lg', {name: id}); + $state.go(UIUtils.screen.isSmall() ? 'app.currency_view' : 'app.currency_view_lg', {name: id}); }; } diff --git a/www/js/controllers/help-controllers.js b/www/js/controllers/help-controllers.js index 4fd0c115d..c9f0cd20b 100644 --- a/www/js/controllers/help-controllers.js +++ b/www/js/controllers/help-controllers.js @@ -246,8 +246,7 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe if ($ionicSideMenuDelegate.isOpen()) { $ionicSideMenuDelegate.toggleLeft(false); } - var smallScreen = screenmatch.is('sm, xs'); - return $state.go(smallScreen ? 'app.currency_view' : 'app.currency_view_lg') + return $state.go(UIUtils.screen.isSmall() ? 'app.currency_view' : 'app.currency_view_lg') .then(function () { return $scope.showHelpTip('helptip-currency-newcomers', { bindings: { @@ -273,13 +272,12 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe function () { if (!csSettings.data.useRelative) return true; //skip but continue - var smallScreen = screenmatch.is('sm, xs'); return $scope.showHelpTip('helptip-currency-mass-member-unit', { bindings: { content: 'HELP.TIP.CURRENCY_UNIT_RELATIVE', contentParams: contentParams, icon: { - position: smallScreen ? 'right' : 'center' + position: UIUtils.screen.isSmall() ? 'right' : 'center' } } }); @@ -287,27 +285,25 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe function () { if (!csSettings.data.useRelative) return true; //skip but continue - var smallScreen = screenmatch.is('sm, xs'); return $scope.showHelpTip('helptip-currency-change-unit', { bindings: { content: 'HELP.TIP.CURRENCY_CHANGE_UNIT', contentParams: contentParams, icon: { - position: smallScreen ? 'right' : 'center' + position: UIUtils.screen.isSmall() ? 'right' : 'center' } } }); }, function () { - var smallScreen = screenmatch.is('sm, xs'); if (csSettings.data.useRelative) return true; //skip but continue return $scope.showHelpTip('helptip-currency-change-unit', { bindings: { content: 'HELP.TIP.CURRENCY_CHANGE_UNIT_TO_RELATIVE', contentParams: contentParams, icon: { - position: smallScreen ? 'right' : 'center' + position: UIUtils.screen.isSmall() ? 'right' : 'center' } } }); @@ -362,10 +358,9 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe } return $state.go('app.wot_lookup') .then(function(){ - var smallScreen = screenmatch.is('sm, xs'); return $scope.showHelpTip('helptip-wot-search-text', { bindings: { - content: smallScreen ? 'HELP.TIP.WOT_SEARCH_TEXT_XS' : 'HELP.TIP.WOT_SEARCH_TEXT', + content: UIUtils.screen.isSmall() ? 'HELP.TIP.WOT_SEARCH_TEXT_XS' : 'HELP.TIP.WOT_SEARCH_TEXT', icon: { position: 'center' } @@ -452,21 +447,19 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe angular.element(element).triggerHandler('click'); }); } - var smallScreen = screenmatch.is('sm, xs'); - return $scope.showHelpTip(smallScreen ? 'fab-certify': 'helptip-certs-certify', { + return $scope.showHelpTip(UIUtils.screen.isSmall() ? 'fab-certify': 'helptip-certs-certify', { bindings: { content: 'HELP.TIP.WOT_VIEW_CERTIFY', icon: { - position: smallScreen ? 'bottom-right' : 'center' + position: UIUtils.screen.isSmall() ? 'bottom-right' : 'center' } }, - timeout: smallScreen ? 2000 : 1000 + timeout: UIUtils.screen.isSmall() ? 2000 : 1000 }); }, function() { - var smallScreen = screenmatch.is('sm, xs'); - return $scope.showHelpTip(smallScreen ? 'fab-certify': 'helptip-certs-certify', { + return $scope.showHelpTip(UIUtils.screen.isSmall() ? 'fab-certify': 'helptip-certs-certify', { bindings: { content: 'HELP.TIP.CERTIFY_RULES', icon: { @@ -575,12 +568,11 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe }, function () { - var smallScreen = screenmatch.is('sm, xs'); - return $scope.showHelpTip(smallScreen ? 'helptip-wallet-options-xs' : 'helptip-wallet-options', { + return $scope.showHelpTip(UIUtils.screen.isSmall() ? 'helptip-wallet-options-xs' : 'helptip-wallet-options', { bindings: { content: 'HELP.TIP.WALLET_OPTIONS', icon: { - position: smallScreen ? 'right' : 'center' + position: UIUtils.screen.isSmall() ? 'right' : 'center' }, hasNext: hasNext } @@ -618,8 +610,7 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe angular.element(element).triggerHandler('click'); }); } - var smallScreen = screenmatch.is('sm, xs'); - if (!smallScreen) return true; // skip this helptip if not in tabs mode + if (!UIUtils.screen.isSmall()) return true; // skip this helptip if not in tabs mode return $scope.showHelpTip('helptip-received-certs', { bindings: { content: 'HELP.TIP.WALLET_RECEIVED_CERTS' @@ -628,8 +619,7 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe }, function() { - var smallScreen = screenmatch.is('sm, xs'); - if (smallScreen) { + if (UIUtils.screen.isSmall()) { // Select the second tabs $timeout(function() { var tabs = $window.document.querySelectorAll('ion-tabs .tabs a'); @@ -638,14 +628,14 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe } }, 100); } - return $scope.showHelpTip(smallScreen ? 'fab-select-certify': 'helptip-certs-select-certify', { + return $scope.showHelpTip(UIUtils.screen.isSmall() ? 'fab-select-certify': 'helptip-certs-select-certify', { bindings: { content: 'HELP.TIP.WALLET_CERTIFY', icon: { - position: smallScreen ? 'bottom-right' : 'center' + position: UIUtils.screen.isSmall() ? 'bottom-right' : 'center' } }, - timeout: smallScreen ? 2000 : 500 + timeout: UIUtils.screen.isSmall() ? 2000 : 500 }); }, @@ -690,13 +680,12 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe * @returns {*} */ $scope.startHeaderTour = function(startIndex, hasNext) { - var smallScreen = screenmatch.is('sm, xs'); - if (smallScreen) return $scope.emptyPromise(true); + if (UIUtils.screen.isSmall()) return $scope.emptyPromise(true); var steps = [ function () { - if (smallScreen) return true; // skip for small screen + if (UIUtils.screen.isSmall()) return true; // skip for small screen var elements = $window.document.querySelectorAll('#helptip-header-bar-btn-profile'); if (!elements || !elements.length) return true; return $scope.showHelpTip(elements[elements.length -1], { @@ -710,9 +699,8 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe }, function () { - var smallScreen = screenmatch.is('sm, xs'); // small screens - if (smallScreen) { + if (UIUtils.screen.isSmall()) { $ionicSideMenuDelegate.toggleLeft(true); return $scope.showHelpTip('helptip-menu-btn-settings', { bindings: { @@ -764,8 +752,7 @@ function HelpTipController($scope, $rootScope, $state, $window, $ionicSideMenuDe var steps = [ function () { - var smallScreen = screenmatch.is('sm, xs'); - if (!smallScreen) return true; + if (!UIUtils.screen.isSmall()) return true; $ionicSideMenuDelegate.toggleLeft(true); return $scope.showHelpTip('helptip-menu-btn-settings', { bindings: { diff --git a/www/js/controllers/peer-controllers.js b/www/js/controllers/peer-controllers.js index fd423f2b5..0c8dff243 100644 --- a/www/js/controllers/peer-controllers.js +++ b/www/js/controllers/peer-controllers.js @@ -4,7 +4,7 @@ function PeerController($scope, $rootScope, $ionicSlideBoxDelegate, $ionicModal, $scope.$on('$ionicView.enter', function(e, $state) { if (!$rootScope.memberUidsByPubkeys) { - BMA.wot.member.uids(true/*cache*/) + BMA.wot.member.uids() .then(function(uids){ $rootScope.memberUidsByPubkeys = uids; $scope.showPeer($state.stateParams.server); diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 420f926dd..301309ee8 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -63,8 +63,7 @@ function TransferController($scope, $rootScope, $state, BMA, Wallet, UIUtils, $t } $scope.loadWallet() - .then(function(walletData) { - $scope.walletData = walletData; + .then(function() { $scope.formData.useRelative = csSettings.data.useRelative; $scope.onUseRelativeChanged(); UIUtils.loading.hide(); @@ -85,7 +84,6 @@ function TransferModalController($scope, $rootScope, $ionicPopover, $translate, csSettings, parameters) { 'ngInject'; - $scope.walletData = $rootScope.walletData; $scope.convertedBalance = 0; $scope.formData = { destPub: null, @@ -137,12 +135,12 @@ function TransferModalController($scope, $rootScope, $ionicPopover, $translate, // When changing use relative UD $scope.onUseRelativeChanged = function() { - $scope.unit = $scope.walletData.currency; + $scope.unit = $rootScope.walletData.currency; if ($scope.formData.useRelative) { - $scope.convertedBalance = $scope.walletData.balance / $scope.walletData.currentUD; - $scope.udAmount = $scope.amount * $scope.walletData.currentUD; + $scope.convertedBalance = $rootScope.walletData.balance / $rootScope.walletData.currentUD; + $scope.udAmount = $scope.amount * $rootScope.walletData.currentUD; } else { - $scope.convertedBalance = $scope.walletData.balance; + $scope.convertedBalance = $rootScope.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('[,]'), '.'))) : @@ -150,9 +148,9 @@ function TransferModalController($scope, $rootScope, $ionicPopover, $translate, // 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; + !!$rootScope.walletData.currentUD && + typeof $rootScope.walletData.currentUD == "number") ? + $scope.formData.amount / $rootScope.walletData.currentUD :null; } }; $scope.$watch('formData.useRelative', $scope.onUseRelativeChanged, true); @@ -179,7 +177,7 @@ function TransferModalController($scope, $rootScope, $ionicPopover, $translate, var amount = $scope.formData.amount; if ($scope.formData.useRelative && !!amount && typeof amount == "string") { - amount = $scope.walletData.currentUD * + amount = $rootScope.walletData.currentUD * amount.replace(new RegExp('[.,]'), '.'); } @@ -197,10 +195,10 @@ function TransferModalController($scope, $rootScope, $ionicPopover, $translate, $translate(['COMMON.UD', 'COMMON.EMPTY_PARENTHESIS']) .then(function(translations){ $translate('CONFIRM.TRANSFER', { - from: $scope.walletData.isMember ? $scope.walletData.uid : $filter('formatPubkey')($scope.walletData.pubkey), + from: $rootScope.walletData.isMember ? $rootScope.walletData.uid : $filter('formatPubkey')($rootScope.walletData.pubkey), to: $scope.destUid ? $scope.destUid : $scope.destPub, amount: $scope.formData.amount, - unit: $scope.formData.useRelative ? translations['COMMON.UD'] : $filter('abbreviate')($scope.walletData.parameters.currency), + unit: $scope.formData.useRelative ? translations['COMMON.UD'] : $filter('abbreviate')($rootScope.walletData.parameters.currency), comment: (!$scope.formData.comment || $scope.formData.comment.trim().length === 0) ? translations['COMMON.EMPTY_PARENTHESIS'] : $scope.formData.comment }) .then(function(confirmMsg) { diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index d95963a45..2b42ced96 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -32,11 +32,10 @@ angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency .controller('WalletTxErrorCtrl', WalletTxErrorController) ; -function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $ionicHistory, screenmatch, - UIUtils, Wallet, $translate, $ionicPopover, Modals, csSettings, BMA) { +function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $ionicHistory, + UIUtils, Wallet, $translate, $ionicPopover, Modals, csSettings, BMA) { 'ngInject'; - $scope.walletData = null; $scope.convertedBalance = null; $scope.hasCredit = false; $scope.showDetails = false; @@ -51,7 +50,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $scope.updateView(); $scope.loading=false; $scope.showFab('fab-transfer'); - $scope.showQRCode('qrcode', walletData.pubkey, 1100); + $scope.showQRCode('qrcode', $rootScope.walletData.pubkey, 1100); $scope.showHelpTip(); UIUtils.loading.hide(); // loading could have be open (e.g. new account) }) @@ -77,13 +76,13 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, }); $scope.refreshConvertedBalance = function() { - if (!$scope.walletData) { + if (!$rootScope.walletData) { return; } if (csSettings.data.useRelative) { - $scope.convertedBalance = $scope.walletData.balance ? ($scope.walletData.balance / $scope.walletData.currentUD) : 0; + $scope.convertedBalance = $rootScope.walletData.balance ? ($rootScope.walletData.balance / $rootScope.walletData.currentUD) : 0; } else { - var balance = $scope.walletData.balance; + var balance = $rootScope.walletData.balance; if (!balance) { balance = 0; } @@ -95,7 +94,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, // Update view $scope.updateView = function() { - $scope.hasCredit = (!!$scope.walletData.balance && $scope.walletData.balance > 0); + $scope.hasCredit = (!!$rootScope.walletData.balance && $rootScope.walletData.balance > 0); $scope.refreshConvertedBalance(); // Set Motion $timeout(function() { @@ -115,7 +114,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, return $q(function(resolve, reject) { $translate(['ACCOUNT.NEW.TITLE', 'ACCOUNT.POPUP_REGISTER.TITLE', 'ACCOUNT.POPUP_REGISTER.HELP', 'COMMON.BTN_OK', 'COMMON.BTN_CANCEL']) .then(function (translations) { - $scope.walletData.newUid = (!!$scope.walletData.uid ? ''+$scope.walletData.uid : ''); + $rootScope.walletData.newUid = (!!$rootScope.walletData.uid ? ''+$rootScope.walletData.uid : ''); // Choose UID popup $ionicPopup.show({ @@ -130,11 +129,11 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, type: 'button-positive', onTap: function(e) { $scope.registerForm.$submitted=true; - if(!$scope.registerForm.$valid || !$scope.walletData.newUid) { + if(!$scope.registerForm.$valid || !$rootScope.walletData.newUid) { //don't allow the user to close unless he enters a uid e.preventDefault(); } else { - return $scope.walletData.newUid; + return $rootScope.walletData.newUid; } } } @@ -142,7 +141,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, }) .then(function(uid) { if (!uid) { // user cancel - $scope.walletData.uid = null; + $rootScope.walletData.uid = null; UIUtils.loading.hide(); return; } @@ -203,9 +202,9 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, .then(function (uid) { UIUtils.loading.show(); // If uid changed, or selft blockUid not retrieve : do self() first - if (!$scope.walletData.blockUid || uid != $scope.walletData.uid) { - $scope.walletData.blockUid = null; - $scope.walletData.uid = uid; + if (!$rootScope.walletData.blockUid || uid != $rootScope.walletData.uid) { + $rootScope.walletData.blockUid = null; + $rootScope.walletData.uid = uid; Wallet.self(uid, false/*do NOT load membership here*/) .then(function() { doMembershipIn(); @@ -359,9 +358,9 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, }; $scope.showCertifications = function() { - $state.go(screenmatch.is('sm, xs') ? 'app.wallet_view_cert' : 'app.wallet_view_cert_lg', { - pubkey: $scope.walletData.pubkey, - uid: $scope.walletData.name || $scope.walletData.uid + $state.go(UIUtils.screen.isSmall() ? 'app.wallet_view_cert' : 'app.wallet_view_cert_lg', { + pubkey: $rootScope.walletData.pubkey, + uid: $rootScope.walletData.name || $rootScope.walletData.uid }); }; @@ -392,8 +391,8 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $scope.showSharePopover = function(event) { $scope.hideActionsPopover(); - var title = $scope.walletData.name || $scope.walletData.uid || $scope.walletData.pubkey; - var url = $state.href('app.wot_view_identity', {pubkey: $scope.walletData.pubkey, uid: $scope.walletData.name || $scope.walletData.uid}, {absolute: true}); + var title = $rootScope.walletData.name || $rootScope.walletData.uid || $rootScope.walletData.pubkey; + var url = $state.href('app.wot_view_identity', {pubkey: $rootScope.walletData.pubkey, uid: $rootScope.walletData.name || $rootScope.walletData.uid}, {absolute: true}); UIUtils.popover.share(event, { bindings: { url: url, @@ -407,7 +406,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $scope.showMoreTx = function(fromTime) { fromTime = fromTime || - ($scope.walletData.tx.fromTime - csSettings.data.walletHistoryTimeSecond) || + ($rootScope.walletData.tx.fromTime - csSettings.data.walletHistoryTimeSecond) || (Math.trunc(new Date().getTime() / 1000) - 2 * csSettings.data.walletHistoryTimeSecond); UIUtils.loading.show(); @@ -435,12 +434,9 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, function WalletTxErrorController($scope, $timeout, UIUtils, Wallet) { 'ngInject'; - $scope.walletData = null; - $scope.$on('$ionicView.enter', function(e) { $scope.loadWallet() - .then(function(walletData) { - $scope.walletData = walletData; + .then(function() { $scope.updateView(); $scope.showFab('fab-redo-transfer'); UIUtils.loading.hide(); diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 245926b05..9d6e7a2e1 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -84,7 +84,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) ; -function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover) { +function WotLookupController($scope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover) { 'ngInject'; var defaultSearchLimit = 20; @@ -136,7 +136,7 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, $scope.doSearch = function() { $scope.search.loading = true; var text = $scope.search.text.trim(); - if (($rootScope.smallscreen.active && text.length < 3) || !text.length) { + if ((UIUtils.screen.isSmall() && text.length < 3) || !text.length) { $scope.search.results = []; $scope.search.loading = false; $scope.search.type = 'none'; @@ -309,10 +309,10 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, } -function WotLookupModalController($scope, $rootScope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover){ +function WotLookupModalController($scope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover){ 'ngInject'; - WotLookupController.call(this, $scope, $rootScope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover); + WotLookupController.call(this, $scope, BMA, $state, UIUtils, $timeout, csConfig, csSettings, Device, Wallet, WotService, $focus, $ionicPopover); $scope.search.loading = false; $scope.enableFilter = false; @@ -339,7 +339,7 @@ function WotLookupModalController($scope, $rootScope, BMA, $state, UIUtils, $tim // endRemoveIf(device) } -function WotIdentityViewController($scope, $state, screenmatch, $timeout, UIUtils, Device, WotService) { +function WotIdentityViewController($scope, $state, $timeout, UIUtils, WotService) { 'ngInject'; $scope.formData = {}; @@ -379,7 +379,7 @@ function WotIdentityViewController($scope, $state, screenmatch, $timeout, UIUtil }; $scope.showCertifications = function() { - $state.go(screenmatch.is('sm, xs') ? 'app.wot_view_cert' : 'app.wot_view_cert_lg', { + $state.go(UIUtils.screen.isSmall() ? 'app.wot_view_cert' : 'app.wot_view_cert_lg', { pubkey: $scope.formData.pubkey, uid: $scope.formData.name || $scope.formData.uid }); @@ -415,7 +415,7 @@ function WotIdentityViewController($scope, $state, screenmatch, $timeout, UIUtil * @param Modals * @constructor */ -function WotCertificationsViewController($scope, $timeout, $translate, csSettings, Wallet, UIUtils, WotService, Modals) { +function WotCertificationsViewController($scope, $rootScope, $timeout, $translate, csSettings, Wallet, UIUtils, WotService, Modals) { 'ngInject'; $scope.loading = true; @@ -471,13 +471,12 @@ function WotCertificationsViewController($scope, $timeout, $translate, csSetting // Certify the current identity $scope.certify = function() { $scope.loadWallet() - .then(function(walletData) { - console.log(walletData.blockUid); - /*if (!walletData.isMember) { - UIUtils.alert.error(walletData.requirements.needSelf ? + .then(function() { + if (!csConfig.initPhase && !$rootScope.walletData.isMember) { + UIUtils.alert.error($rootScope.walletData.requirements.needSelf ? 'ERROR.NEED_MEMBER_ACCOUNT_TO_CERTIFY' : 'ERROR.NEED_MEMBER_ACCOUNT_TO_CERTIFY_HAS_SELF'); return; - }*/ + } UIUtils.loading.hide(); UIUtils.alert.confirm('CONFIRM.CERTIFY_RULES') .then(function(confirm){ @@ -503,9 +502,9 @@ function WotCertificationsViewController($scope, $timeout, $translate, csSetting $scope.selectAndCertify = function() { $scope.loadWallet() .catch(UIUtils.onError('ERROR.LOGIN_FAILED')) - .then(function(walletData) { - if (!walletData.isMember) { - UIUtils.alert.error(walletData.requirements.needSelf ? + .then(function() { + if (!csConfig.initPhase && !$rootScope.walletData.isMember) { + UIUtils.alert.error($rootScope.walletData.requirements.needSelf ? 'ERROR.NEED_MEMBER_ACCOUNT_TO_CERTIFY' : 'ERROR.NEED_MEMBER_ACCOUNT_TO_CERTIFY_HAS_SELF'); return; } diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 154222dc7..eb9563686 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -2,7 +2,7 @@ angular.module('cesium.utils.services', ['ngResource']) .factory('UIUtils', function($ionicLoading, $ionicPopup, $translate, $q, ionicMaterialInk, ionicMaterialMotion, $window, $timeout, - $ionicPopover, $state, $rootScope, $ionicPosition) { + $ionicPopover, $state, $rootScope, screenmatch) { 'ngInject'; function exact(regexpContent) { @@ -19,6 +19,9 @@ angular.module('cesium.utils.services', ['ngResource']) }, regex = { IMAGE_SRC: exact("data:([A-Za-z//]+);base64,(.+)") + }, + data = { + smallscreen: screenmatch.bind('xs, sm', $rootScope) } ; @@ -159,6 +162,10 @@ angular.module('cesium.utils.services', ['ngResource']) }; } + function isSmallScreen() { + return data.smallscreen.active; + } + function selectElementText(el) { if (el.value || el.type == "text" || el.type == "textarea") { // Source: http://stackoverflow.com/questions/14995884/select-text-on-input-focus @@ -606,6 +613,9 @@ angular.module('cesium.utils.services', ['ngResource']) show: showToast }, onError: onError, + screen: { + isSmall: isSmallScreen + }, ink: ionicMaterialInk.displayEffect, motion: ionicMaterialMotion, fab: { diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 776ee698b..ac1a259e2 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -12,7 +12,7 @@ }, "MENU": { "MARKET": "Annonces", - "REGISTRY": "Professionels", + "REGISTRY": "Professionnels", "USER_PROFILE": "Mon profil", "USER_MESSAGE": "Messages" }, @@ -135,7 +135,7 @@ "TECHNICAL_DIVIDER": "Informations techniques", "BTN_NEW": "Je référence mon organisation", "SEARCH": { - "TITLE": "Annuaire des professionels", + "TITLE": "Annuaire des professionnels", "TITLE_SMALL_DEVICE": "Annuaire pro", "SEARCH_HELP": "Quoi, Qui : restaurant, Chez Marcel, ...", "BTN_ADD": "Nouveau", diff --git a/www/plugins/es/js/controllers/app-controllers.js b/www/plugins/es/js/controllers/app-controllers.js index 7cdad3c81..8ae31e16f 100644 --- a/www/plugins/es/js/controllers/app-controllers.js +++ b/www/plugins/es/js/controllers/app-controllers.js @@ -83,16 +83,16 @@ function ESJoinController($scope, $state, csSettings, PluginService) { /** * Control menu extension */ -function ESMenuExtendController($scope, $state, screenmatch, PluginService, csSettings) { +function ESMenuExtendController($scope, $state, PluginService, csSettings,UIUtils) { 'ngInject'; $scope.extensionPoint = PluginService.extensions.points.current.get(); $scope.showMarketLookupView = function() { - $state.go(screenmatch.is('sm, xs') ? 'app.market_lookup': 'app.market_lookup_lg'); + $state.go(UIUtils.screen.isSmall() ? 'app.market_lookup': 'app.market_lookup_lg'); }; $scope.showRegistryLookupView = function() { - $state.go(screenmatch.is('sm, xs') ? 'app.registry_lookup': 'app.registry_lookup_lg'); + $state.go(UIUtils.screen.isSmall() ? 'app.registry_lookup': 'app.registry_lookup_lg'); }; $scope.updateView = function() { diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 9a8732b6c..3b34327e3 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -155,9 +155,9 @@ function ESCommentsController($scope, $timeout, $filter, $state, Wallet, UIUtils comment.issuer = walletData.pubkey; var obj = {}; angular.copy(comment, obj); - if (walletData.uid) { - obj.uid = walletData.uid; - } + obj.uid = walletData.isMember ? walletData.uid : null; + obj.name = walletData.name; + obj.avatarStyle = walletData.avatarStyle; obj.isnew = true; // use to prevent visibility hidden (if animation) // Create if (!comment.id) { diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js index 49c613b4b..3f7289b28 100644 --- a/www/plugins/es/js/controllers/market-controllers.js +++ b/www/plugins/es/js/controllers/market-controllers.js @@ -380,7 +380,7 @@ function ESMarketLookupController($scope, $state, $focus, $timeout, $filter, $q, function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $state, $translate, $ionicHistory, $q, $timeout, $filter, - Wallet, esMarket, UIUtils, esHttp, BMA, csSettings) { + Wallet, esMarket, UIUtils, esHttp, esUser, BMA, csSettings) { 'ngInject'; $scope.formData = {}; @@ -404,17 +404,6 @@ function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $sta } }); - $ionicPopover.fromTemplateUrl('plugins/es/templates/market/view_popover_actions.html', { - scope: $scope - }) - .then(function(popover) { - $scope.actionsPopover = popover; - }); - - $scope.$on('$destroy', function() { - $scope.actionsPopover.remove(); - }); - $scope.load = function (id, anchor) { var categories; @@ -442,8 +431,10 @@ function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $sta $scope.thumbnail = UIUtils.image.fromAttachment(hit._source.thumbnail); } $scope.canEdit = $scope.formData && Wallet.isUserPubkey($scope.formData.issuer); - - return BMA.wot.member.get($scope.formData.issuer); + return esUser.profile.fillAvatars([{pubkey: $scope.formData.issuer}]) + .then(function(idties) { + return idties[0]; + }) }) .then(function (member) { $scope.issuer = member; @@ -541,9 +532,7 @@ function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $sta }; $scope.delete = function() { - if ($scope.actionsPopover) { - $scope.actionsPopover.hide(); - } + $scope.hideActionsPopover(); UIUtils.alert.confirm('MARKET.VIEW.REMOVE_CONFIRMATION') .then(function(confirm) { @@ -561,7 +550,35 @@ function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $sta }); }; + /* -- modals & popover -- */ + + $scope.showActionsPopover = function(event) { + if (!$scope.actionsPopover) { + $ionicPopover.fromTemplateUrl('plugins/es/templates/market/view_popover_actions.html', { + scope: $scope + }).then(function(popover) { + $scope.actionsPopover = popover; + //Cleanup the popover when we're done with it! + $scope.$on('$destroy', function() { + $scope.actionsPopover.remove(); + }); + $scope.actionsPopover.show(event); + }); + } + else { + $scope.actionsPopover.show(event); + } + }; + + $scope.hideActionsPopover = function() { + if ($scope.actionsPopover) { + $scope.actionsPopover.hide(); + } + }; + $scope.showSharePopover = function(event) { + $scope.hideActionsPopover(); + var title = $scope.formData.title; var url = $state.href('app.market_view_record', {title: title, id: $scope.id}, {absolute: true}); UIUtils.popover.share(event, { diff --git a/www/plugins/es/js/controllers/registry-controllers.js b/www/plugins/es/js/controllers/registry-controllers.js index c6c3d00d8..f19323e11 100644 --- a/www/plugins/es/js/controllers/registry-controllers.js +++ b/www/plugins/es/js/controllers/registry-controllers.js @@ -376,7 +376,7 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopover, $ionicHistory, $translate, $anchorScroll, $filter, - Wallet, esRegistry, UIUtils, BMA, esHttp) { + Wallet, esRegistry, esUser, UIUtils, BMA, esHttp) { 'ngInject'; $scope.formData = {}; @@ -399,17 +399,6 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo } }); - $ionicPopover.fromTemplateUrl('plugins/es/templates/registry/view_popover_actions.html', { - scope: $scope - }) - .then(function(popover) { - $scope.actionsPopover = popover; - }); - - $scope.$on('$destroy', function() { - $scope.actionsPopover.remove(); - }); - $scope.load = function(id, anchor) { $q.all([ esRegistry.category.all() @@ -429,8 +418,11 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo } $scope.canEdit = Wallet.isUserPubkey($scope.formData.issuer); - // Load issuer as member - return BMA.wot.member.get($scope.formData.issuer); + // Load avatar and name (and uid) + return esUser.profile.fillAvatars([{pubkey: $scope.formData.issuer}]) + .then(function(idties) { + return idties[0]; + }) }) .then(function(member){ $scope.issuer = member; @@ -497,9 +489,7 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo }; $scope.delete = function() { - if ($scope.actionsPopover) { - $scope.actionsPopover.hide(); - } + $scope.hideActionsPopover(); // translate var translations; @@ -523,7 +513,34 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo }); }; + /* -- modals & popover -- */ + + $scope.showActionsPopover = function(event) { + if (!$scope.actionsPopover) { + $ionicPopover.fromTemplateUrl('plugins/es/templates/registry/view_popover_actions.html', { + scope: $scope + }).then(function(popover) { + $scope.actionsPopover = popover; + //Cleanup the popover when we're done with it! + $scope.$on('$destroy', function() { + $scope.actionsPopover.remove(); + }); + $scope.actionsPopover.show(event); + }); + } + else { + $scope.actionsPopover.show(event); + } + }; + + $scope.hideActionsPopover = function() { + if ($scope.actionsPopover) { + $scope.actionsPopover.hide(); + } + }; + $scope.showSharePopover = function(event) { + $scope.hideActionsPopover(); var title = $scope.formData.title; var url = $state.href('app.registry_view_record', {title: title, id: $scope.id}, {absolute: true}); UIUtils.popover.share(event, { @@ -536,6 +553,7 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo } }); }; + } function ESRegistryRecordEditController($scope, esRegistry, UIUtils, $state, $q, Device, diff --git a/www/plugins/es/js/services/comment-services.js b/www/plugins/es/js/services/comment-services.js index f3eff7ec5..0b877b7d1 100644 --- a/www/plugins/es/js/services/comment-services.js +++ b/www/plugins/es/js/services/comment-services.js @@ -1,6 +1,6 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services', 'cesium.es.http.services']) -.factory('esComment', function($q, BMA, esHttp) { +.factory('esComment', function($q, BMA, esHttp, esUser) { 'ngInject'; function factory(host, port, index) { @@ -46,16 +46,16 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services 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); - }, []); + var result = res.hits.hits.reduce(function(result, hit) { + var comment = hit._source; + comment.id = hit._id; + return result.concat(comment); + }, []); - resolve(result); + // fill avatars (and uid) + esUser.profile.fillAvatars(result, 'issuer') + .then(function() { + resolve(result); }) .catch(errorFct); } diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index 02a94fb3f..a498221af 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -163,17 +163,23 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se } var uidsByPubkey; - BMA.wot.member.uids() - .then(function(res){ - uidsByPubkey = res; - return esHttp.post(host, port, '/user/profile/_search?pretty')(request); - }) - .then(function(res) { - if (res.hits.total === 0) { + var hits; + $q.all([ + BMA.wot.member.uids() + .then(function(res){ + uidsByPubkey = res; + }), + esHttp.post(host, port, '/user/profile/_search?pretty')(request) + .then(function(res){ + hits = res.hits; + }) + ]) + .then(function() { + if (hits.total === 0) { resolve(datas); } else { - _.forEach(res.hits.hits, function(hit) { + _.forEach(hits.hits, function(hit) { var values = map[hit._id]; if (!values) { var value = {}; @@ -189,7 +195,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se } data.name=hit._source.title; if (!data.uid) { - data.uid = hit._source.uid ? hit._source.uid : uidsByPubkey[data.pubkey]; + data.uid = hit._source.uid ? hit._source.uid : uidsByPubkey[data[pubkeyAtributeName]]; } if (hit.highlight) { if (hit.highlight.title) { diff --git a/www/plugins/es/templates/common/view_comments.html b/www/plugins/es/templates/common/view_comments.html index ff0a82ad1..ea396652e 100644 --- a/www/plugins/es/templates/common/view_comments.html +++ b/www/plugins/es/templates/common/view_comments.html @@ -17,15 +17,20 @@ <ion-item class="card card-comment stable-bg item-text-wrap no-padding" ng-class="{'in done': comment.isnew}"> <div class="padding card-header text-right"> - <a class="pull-left positive" ui-sref="app.wot_view_identity({pubkey:comment.issuer, uid: comment.uid})"> - <i class="icon ion-person"></i> - {{::comment.uid}} + <a class="pull-left" + ng-class="{'positive': comment.uid, 'dark': !comment.uid}" + ui-sref="app.wot_view_identity({pubkey:comment.issuer, uid: comment.name||comment.uid})"> + <i class="icon" + ng-class="{'ion-person': comment.uid, 'ion-key': !comment.uid}"></i> + {{::comment.name||comment.uid||comment.issuer}} </a> <a class="gray pull-right" ng-click="shareComment($event, $index)"> {{::comment.time | formatFromNow}} </a> </div> - <div class="item done in"> + <div class="item item-avatar done in"> + <span class="avatar" + ng-style="comment.avatarStyle"></span> {{::comment.message}} <div class="card-footer text-right gray"> <a class="pull-right" ng-click="shareComment($event, $index)"> diff --git a/www/plugins/es/templates/market/view_popover_actions.html b/www/plugins/es/templates/market/view_popover_actions.html index c24d69f33..7141b7dac 100644 --- a/www/plugins/es/templates/market/view_popover_actions.html +++ b/www/plugins/es/templates/market/view_popover_actions.html @@ -5,6 +5,12 @@ <ion-content scroll="false"> <div class="list item-text-wrap"> + <a class="item item-icon-left ink" + ng-click="showSharePopover($event)"> + <i class="icon ion-android-share"></i> + {{'COMMON.BTN_SHARE' | translate}} + </a> + <a class="item item-icon-left assertive ink " ng-if="canEdit" ng-click="delete()"> diff --git a/www/plugins/es/templates/market/view_record.html b/www/plugins/es/templates/market/view_record.html index 848659942..7788f0ed4 100644 --- a/www/plugins/es/templates/market/view_record.html +++ b/www/plugins/es/templates/market/view_record.html @@ -8,7 +8,7 @@ <i class="icon ion-android-create"></i> </button> <button class="button button-bar button-icon button-clear icon ion-android-more-vertical visible-xs visible-sm" - ng-click="actionsPopover.show($event)"> + ng-click="showActionsPopover($event)"> </button> </ion-nav-buttons> @@ -42,15 +42,11 @@ <h4> <i class="icon ion-clock"></i> <span translate>COMMON.SUBMIT_BY</span> - <a class="positive" ui-sref="app.wot_view_identity({pubkey:formData.issuer, uid:issuer.uid})"> - <span ng-if="issuer.uid"> - <i class="icon ion-person"></i> - {{issuer.uid}} - </span> - <span ng-if="!issuer.uid"> - <i class="icon ion-key"></i> - {{issuer.pubkey|formatPubkey}} - </span> + <a ng-class="{'positive': issuer.uid, 'dark': !issuer.uid}" + ui-sref="app.wot_view_identity({pubkey:issuer.pubkey, uid: issuer.name||issuer.uid})"> + <i class="icon" + ng-class="{'ion-person': issuer.uid, 'ion-key': !issuer.uid}"></i> + {{::issuer.name||issuer.uid||issuer.pubkey}} </a> <span> {{formData.time|formatFromNow}} @@ -63,22 +59,21 @@ <!-- Buttons bar--> <div class="item large-button-bar hidden-xs hidden-sm"> - <button class="button button-small button-stable icon ion-android-share" + <button class="button button-stable icon ion-android-share" ng-click="showSharePopover($event)"> - {{'COMMON.BTN_SHARE' | translate}} </button> - <button class="button button-small button-calm ink-dark" + <button class="button button-calm ink-dark" ng-click="showTransferModal({pubkey: issuer.pubkey, uid: issuer.uid, amount: formData.price})" ng-if="!canEdit && formData.price"> {{'MARKET.COMMON.BTN_BUY' | translate}} </button> - <button class="button button-small button-stable icon-left ink-dark" + <button class="button button-stable icon-left ink-dark" ng-if="canEdit" ng-click="delete()"> <i class="icon ion-trash-a assertive"></i> <span class="assertive"> {{'COMMON.BTN_DELETE' | translate}}</span> </button> - <button class="button button-small button-calm icon-left ion-android-create ink" + <button class="button button-calm icon-left ion-android-create ink" ng-if="canEdit" ng-click="edit()"> {{'COMMON.BTN_EDIT' | translate}} diff --git a/www/plugins/es/templates/registry/view_popover_actions.html b/www/plugins/es/templates/registry/view_popover_actions.html index aa6a69922..bb774ef5c 100644 --- a/www/plugins/es/templates/registry/view_popover_actions.html +++ b/www/plugins/es/templates/registry/view_popover_actions.html @@ -5,6 +5,12 @@ <ion-content scroll="false"> <div class="list item-text-wrap"> + <a class="item item-icon-left ink" + ng-click="showSharePopover($event)"> + <i class="icon ion-android-share"></i> + {{'COMMON.BTN_SHARE' | translate}} + </a> + <a class="item item-icon-left assertive ink" ng-if="canEdit" ng-click="delete()"> diff --git a/www/plugins/es/templates/registry/view_record.html b/www/plugins/es/templates/registry/view_record.html index f353872ed..7d8f94316 100644 --- a/www/plugins/es/templates/registry/view_record.html +++ b/www/plugins/es/templates/registry/view_record.html @@ -8,7 +8,7 @@ <i class="icon ion-android-create"></i> </button> <button class="button button-bar button-icon button-clear icon ion-android-more-vertical visible-xs visible-sm" - ng-click="actionsPopover.show($event)"> + ng-click="showActionsPopover($event)"> </button> </ion-nav-buttons> @@ -46,15 +46,11 @@ <h4> <i class="icon ion-clock" ng-if="formData.time"></i> <span translate>COMMON.SUBMIT_BY</span> - <a class="positive" ui-sref="app.wot_view_identity({pubkey:formData.issuer, uid:issuer.uid})"> - <span ng-if="issuer.uid"> - <i class="icon ion-person"></i> - {{issuer.uid}} - </span> - <span ng-if="!issuer.uid"> - <i class="icon ion-key"></i> - {{formData.issuer|formatPubkey}} - </span> + <a ng-class="{'positive': issuer.uid, 'dark': !issuer.uid}" + ui-sref="app.wot_view_identity({pubkey:issuer.pubkey, uid: issuer.name||issuer.uid})"> + <i class="icon" + ng-class="{'ion-person': issuer.uid, 'ion-key': !issuer.uid}"></i> + {{::issuer.name||issuer.uid||issuer.pubkey}} </a> <span> {{formData.time|formatFromNow}} @@ -67,22 +63,21 @@ <!-- Buttons bar--> <div class="item large-button-bar hidden-xs hidden-sm"> - <button class="button button-small button-stable icon ion-android-share" + <button class="button button-stable icon ion-android-share" ng-click="showSharePopover($event)"> - {{'COMMON.BTN_SHARE' | translate}} </button> - <button class="button button-small button-calm ink-dark" + <button class="button button-calm ink-dark" ng-if="formData.pubkey && !isUserPubkey(formData.pubkey)" ng-click="showTransferModal({pubkey:formData.pubkey, uid: formData.title})"> {{'COMMON.BTN_SEND_MONEY' | translate}} </button> - <button class="button button-small button-stable icon-left ink-dark" + <button class="button button-stable icon-left ink-dark" ng-if="canEdit" ng-click="delete()"> <i class="icon ion-trash-a assertive"></i> <span class="assertive"> {{'COMMON.BTN_DELETE' | translate}}</span> </button> - <button class="button button-small button-calm icon-left ion-android-create ink" + <button class="button button-calm icon-left ion-android-create ink" ng-if="canEdit" ng-click="edit()"> {{'COMMON.BTN_EDIT' | translate}} diff --git a/www/templates/wallet/popover_unit.html b/www/templates/wallet/popover_unit.html index 454f040df..ca68d56ed 100644 --- a/www/templates/wallet/popover_unit.html +++ b/www/templates/wallet/popover_unit.html @@ -5,13 +5,13 @@ ng-class="{ 'selected': !formData.useRelative}" ng-click="setUseRelative(false)"> <i class="icon" ng-class="{ 'ion-ios-checkmark-empty': !formData.useRelative}"></i> - {{walletData.currency| abbreviate}} + {{$root.walletData.currency| abbreviate}} </a> <a class="item item-icon-left" ng-class="{ 'selected': formData.useRelative}" ng-click="setUseRelative(true)"> <i class="icon" ng-class="{ 'ion-ios-checkmark-empty': formData.useRelative}"></i> - {{'COMMON.UD' | translate}}<sub>{{walletData.currency | abbreviate}}</sub></a> + {{'COMMON.UD' | translate}}<sub>{{$root.walletData.currency | abbreviate}}</sub></a> </div> </ion-content> </ion-popover-view> diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html index 7c3ba2623..65143b648 100644 --- a/www/templates/wallet/transfer_form.html +++ b/www/templates/wallet/transfer_form.html @@ -20,15 +20,15 @@ <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)) }"> - <ion-spinner icon="android" ng-if="!walletData.pubkey"></ion-spinner> - <span ng-if="walletData.pubkey && !walletData.isMember"> - {{walletData.pubkey| formatPubkey}} + <ion-spinner icon="android" ng-if="!$root.walletData.pubkey"></ion-spinner> + <span ng-if="$root.walletData.pubkey && !$root.walletData.isMember"> + {{$root.walletData.pubkey| formatPubkey}} </span> - <span ng-if="walletData.isMember"> - {{walletData.name||walletData.uid}} + <span ng-if="$root.walletData.isMember"> + {{$root.walletData.name||$root.walletData.uid}} </span> - <span ng-if="walletData.pubkey && !formData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> - <span ng-if="walletData.pubkey && formData.useRelative">{{convertedBalance | formatDecimal}} {{'COMMON.UD' | translate}}<sub>{{unit | abbreviate}}</sub></span> + <span ng-if="$root.walletData.pubkey && !formData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> + <span ng-if="$root.walletData.pubkey && formData.useRelative">{{convertedBalance | formatDecimal}} {{'COMMON.UD' | translate}}<sub>{{unit | abbreviate}}</sub></span> </span> </span> diff --git a/www/templates/wallet/view_wallet.html b/www/templates/wallet/view_wallet.html index a40bcdd19..520b23fe7 100644 --- a/www/templates/wallet/view_wallet.html +++ b/www/templates/wallet/view_wallet.html @@ -26,7 +26,7 @@ </i> <h3 class="light" ng-if="walletData.name">{{walletData.name}}</h3> <h3 class="light" ng-if="!walletData.name && walletData.isMember">{{walletData.uid}}</h3> - <h3 class="light" ng-if="!walletData.name && !walletData.isMember"><i class="icon ion-key"></i> {{::walletData.pubkey | formatPubkey}}</h3> + <h3 class="light" ng-if="!walletData.name && !walletData.isMember"><i class="icon ion-key"></i> {{walletData.pubkey | formatPubkey}}</h3> <h4 class="light"> <span ng-if="!$root.settings.useRelative">{{convertedBalance | formatInteger}} {{walletData.parameters.currency | abbreviate}}</span> <span ng-if="$root.settings.useRelative">{{convertedBalance | formatDecimal}} {{'COMMON.UD' | translate}}<sub>{{walletData.parameters.currency | abbreviate}}</sub></span> @@ -94,12 +94,13 @@ <!-- Public key --> <span id="wallet-pubkey" class="item item-icon-left item-text-wrap ink" + ng-if="showDetails" on-hold="copy(walletData.pubkey)" - copy-on-click="{{::walletData.pubkey}}"> + copy-on-click="{{walletData.pubkey}}"> <i class="icon ion-key"></i> <span translate>COMMON.PUBKEY</span> - <h4 id="pubkey" class="dark">{{::walletData.pubkey}}</h4> + <h4 id="pubkey" class="dark">{{walletData.pubkey}}</h4> </span> <!-- Errors transactions--> diff --git a/www/templates/wallet/view_wallet_tx_error.html b/www/templates/wallet/view_wallet_tx_error.html index 3766d80d0..5010919df 100644 --- a/www/templates/wallet/view_wallet_tx_error.html +++ b/www/templates/wallet/view_wallet_tx_error.html @@ -34,16 +34,16 @@ <span class="item item-divider"> <span translate>ACCOUNT.ERROR_TX_SENT</span> <div class="badge item-note"> - <span ng-if="!$root.settings.useRelative">({{walletData.currency | abbreviate}})</span> - <span ng-if="$root.settings.useRelative">({{'COMMON.UD' | translate}}<sub>{{walletData.currency | abbreviate}}</sub>)</span> + <span ng-if="!$root.settings.useRelative">({{$root.walletData.currency | abbreviate}})</span> + <span ng-if="$root.settings.useRelative">({{'COMMON.UD' | translate}}<sub>{{$root.walletData.currency | abbreviate}}</sub>)</span> </div> </span> - <span class="item" ng-if="!walletData.tx.errors.length"> + <span class="item" ng-if="!$root.walletData.tx.errors.length"> <h3 translate>ACCOUNT.NO_TX</h3> </span> - <span class="item ink item-badge-right" ng-repeat="tx in walletData.tx.errors | filter: filterNegative('amount')"> + <span class="item ink item-badge-right" ng-repeat="tx in $root.walletData.tx.errors | filter: filterNegative('amount')"> <h2> <i class="icon" ng-class="{'ion-clock': tx.valid, 'ion-close-circled assertive': !tx.valid}"> </i> <span ui-sref="app.wot_view_identity({pubkey:tx.pubkey, uid:tx.uid})" class="positive"> @@ -67,7 +67,7 @@ </h3> <div class="badge item-note assertive"> <span ng-if="!$root.settings.useRelative">{{::tx.amount | formatInteger}}</span> - <span ng-if="$root.settings.useRelative">{{::tx.amount/walletData.currentUD | formatDecimal}}</span> + <span ng-if="$root.settings.useRelative">{{::tx.amount/$root.walletData.currentUD | formatDecimal}}</span> </div > </span> @@ -75,16 +75,16 @@ <span class="item item-divider"> <span translate>ACCOUNT.ERROR_TX_RECEIVED</span> <div class="badge item-note"> - <span ng-if="!$root.settings.useRelative">({{walletData.currency | abbreviate}})</span> - <span ng-if="$root.settings.useRelative">({{'COMMON.UD' | translate}}<sub>{{walletData.currency | abbreviate}}</sub>)</span> + <span ng-if="!$root.settings.useRelative">({{$root.walletData.currency | abbreviate}})</span> + <span ng-if="$root.settings.useRelative">({{'COMMON.UD' | translate}}<sub>{{$root.walletData.currency | abbreviate}}</sub>)</span> </div> </span> - <span class="item" ng-if="!walletData.tx.errors.length"> + <span class="item" ng-if="!$root.walletData.tx.errors.length"> <h3 translate>ACCOUNT.NO_TX</h3> </span> - <span class="item ink item-badge-right" ng-repeat="tx in walletData.tx.errors | filter: filterPositive('amount')"> + <span class="item ink item-badge-right" ng-repeat="tx in $root.walletData.tx.errors | filter: filterPositive('amount')"> <h2> <i class="icon" ng-class="{'ion-clock': tx.valid, 'ion-close-circled assertive': !tx.valid}"> </i> <span ui-sref="app.wot_view_identity({pubkey:tx.pubkey, uid:tx.uid})" class="positive"> @@ -108,7 +108,7 @@ </h3> <div class="badge badge-assertive item-note"> <span ng-if="!$root.settings.useRelative">{{::tx.amount | formatInteger}}</span> - <span ng-if="$root.settings.useRelative">{{::tx.amount/walletData.currentUD | formatDecimal}}</span> + <span ng-if="$root.settings.useRelative">{{::tx.amount/$root.walletData.currentUD | formatDecimal}}</span> </div > </span> </div> diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index a172130d1..63482b3e4 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -7,7 +7,7 @@ <div class="content" ng-if="!loading"> <i class="avatar" ng-style="formData.avatarStyle" - ng-class="{'avatar-wallet': !formData.avatarStyle && walletData && !formData.isMember, 'avatar-member': !formData.avatarStyle && formData.isMember}"> + ng-class="{'avatar-wallet': !formData.avatarStyle && !formData.isMember, 'avatar-member': !formData.avatarStyle && formData.isMember}"> </i> <ng-if ng-if="formData.name"> <h3 class="light" ng-if="formData.name">{{::formData.name}}</h3> -- GitLab