Merge pull request #5351 from JDonadio/ref/remove-menu-popover
remove menu popover
This commit is contained in:
commit
ec199aa1ff
10 changed files with 126 additions and 68 deletions
|
|
@ -1,9 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicPopover, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) {
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) {
|
||||
var UNUSED_ADDRESS_LIMIT = 5;
|
||||
var BALANCE_ADDRESS_LIMIT = 5;
|
||||
var MENU_ITEM_HEIGHT = 55;
|
||||
var config;
|
||||
var unitName;
|
||||
var unitToSatoshi;
|
||||
|
|
@ -121,36 +120,13 @@ angular.module('copayApp.controllers').controller('addressesController', functio
|
|||
}, 10);
|
||||
};
|
||||
|
||||
$scope.showMenu = function(allAddresses, $event) {
|
||||
var scanObj = {
|
||||
text: gettextCatalog.getString('Scan addresses for funds'),
|
||||
action: scan,
|
||||
};
|
||||
|
||||
var sendAddressesObj = {
|
||||
text: gettextCatalog.getString('Send addresses by email'),
|
||||
action: sendByEmail,
|
||||
}
|
||||
|
||||
$scope.items = allAddresses ? [sendAddressesObj] : [scanObj];
|
||||
$scope.height = $scope.items.length * MENU_ITEM_HEIGHT;
|
||||
|
||||
$ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.menu = popover;
|
||||
$scope.menu.show($event);
|
||||
});
|
||||
};
|
||||
|
||||
var scan = function() {
|
||||
$scope.scan = function() {
|
||||
walletService.startScan($scope.wallet);
|
||||
$scope.menu.hide();
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home');
|
||||
};
|
||||
|
||||
var sendByEmail = function() {
|
||||
$scope.sendByEmail = function() {
|
||||
function formatDate(ts) {
|
||||
var dateObj = new Date(ts * 1000);
|
||||
if (!dateObj) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, $ionicPopover, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) {
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) {
|
||||
var unitToSatoshi;
|
||||
var satToUnit;
|
||||
var unitDecimals;
|
||||
var satToBtc;
|
||||
var SMALL_FONT_SIZE_LIMIT = 10;
|
||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||
var MENU_ITEM_HEIGHT = 55;
|
||||
|
||||
$scope.$on('$ionicView.leave', function() {
|
||||
angular.element($window).off('keydown');
|
||||
|
|
@ -29,6 +28,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.toEmail = data.stateParams.toEmail;
|
||||
$scope.showAlternativeAmount = !!$scope.cardId || !!$scope.isGiftCard || !!$scope.isGlidera;
|
||||
$scope.toColor = data.stateParams.toColor;
|
||||
$scope.showSendMax = false;
|
||||
|
||||
$scope.customAmount = data.stateParams.customAmount;
|
||||
|
||||
|
|
@ -93,25 +93,12 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}, 10);
|
||||
});
|
||||
|
||||
$scope.showSendMaxMenu = function($event) {
|
||||
var sendMaxObj = {
|
||||
text: gettextCatalog.getString('Send max amount'),
|
||||
action: setSendMax,
|
||||
};
|
||||
|
||||
$scope.items = [sendMaxObj];
|
||||
$scope.height = $scope.items.length * MENU_ITEM_HEIGHT;
|
||||
|
||||
$ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.menu = popover;
|
||||
$scope.menu.show($event);
|
||||
});
|
||||
$scope.showSendMaxMenu = function() {
|
||||
$scope.showSendMax = true;
|
||||
};
|
||||
|
||||
function setSendMax() {
|
||||
$scope.menu.hide();
|
||||
$scope.sendMax = function() {
|
||||
$scope.showSendMax = false;
|
||||
$state.transitionTo('tabs.send.confirm', {
|
||||
isWallet: $scope.isWallet,
|
||||
toAmount: null,
|
||||
|
|
@ -205,11 +192,11 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
};
|
||||
|
||||
function fromFiat(val) {
|
||||
return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals), 10);
|
||||
return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals));
|
||||
};
|
||||
|
||||
function toFiat(val) {
|
||||
return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10);
|
||||
return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2));
|
||||
};
|
||||
|
||||
function evaluate(val) {
|
||||
|
|
|
|||
25
src/js/directives/itemSelector.js
Normal file
25
src/js/directives/itemSelector.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('itemSelector', function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'views/includes/itemSelector.html',
|
||||
transclude: true,
|
||||
scope: {
|
||||
show: '=itemSelectorShow',
|
||||
onSelect: '=itemSelectorOnSelect'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.hide = function() {
|
||||
scope.show = false;
|
||||
};
|
||||
scope.sendMax = function() {
|
||||
$timeout(function() {
|
||||
scope.hide();
|
||||
}, 100);
|
||||
scope.onSelect();
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
61
src/sass/views/includes/itemSelector.scss
Normal file
61
src/sass/views/includes/itemSelector.scss
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
item-selector {
|
||||
|
||||
$border-color: #EFEFEF;
|
||||
|
||||
.bp-action-sheet__sheet {
|
||||
padding-left: 2rem;
|
||||
padding-right: .75rem;
|
||||
}
|
||||
|
||||
.item-selector {
|
||||
.option {
|
||||
border: 0;
|
||||
padding-right: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 1px;
|
||||
overflow: visible;
|
||||
|
||||
> i {
|
||||
color: #647ce8;
|
||||
padding: 0 0 5px 0;
|
||||
margin-left: -5px;
|
||||
|
||||
> img {
|
||||
height: 39px;
|
||||
width: 39px;
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-selector-inner {
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
|
||||
&::after {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: $border-color;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
content: '';
|
||||
}
|
||||
|
||||
.check {
|
||||
padding: 0 1.2rem;
|
||||
}
|
||||
}
|
||||
.item-selector-details {
|
||||
flex-grow: 1;
|
||||
|
||||
.item-selector-name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
@import "includes/tx-details";
|
||||
@import "includes/txp-details";
|
||||
@import "includes/tx-status";
|
||||
@import "includes/itemSelector";
|
||||
@import "includes/walletSelector";
|
||||
@import "integrations/coinbase";
|
||||
@import "integrations/glidera";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue