replace selector for menu popover
This commit is contained in:
parent
b61f0785bf
commit
a7b2dc24af
5 changed files with 22 additions and 70 deletions
|
|
@ -1,12 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService) {
|
||||
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) {
|
||||
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');
|
||||
|
|
@ -14,6 +15,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isGiftCard = data.stateParams.isGiftCard;
|
||||
$scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send';
|
||||
$scope.isWallet = data.stateParams.isWallet;
|
||||
$scope.cardId = data.stateParams.cardId;
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
|
|
@ -73,14 +75,28 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
});
|
||||
}, 10);
|
||||
});
|
||||
|
||||
$scope.showSendMaxSelector = function() {
|
||||
$scope.sendMax = true;
|
||||
$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.setSendMax = function() {
|
||||
function setSendMax() {
|
||||
$scope.menu.hide();
|
||||
$state.transitionTo('tabs.send.confirm', {
|
||||
isWallet: $scope.isWallet,
|
||||
toAmount: null,
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('sendMaxSelector', function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'views/includes/sendMaxSelector.html',
|
||||
transclude: true,
|
||||
scope: {
|
||||
show: '=sendMaxSelectorShow',
|
||||
wallet: '=sendMaxSelectorWallet',
|
||||
onSelect: '=sendMaxSelectorOnSelect'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.hide = function() {
|
||||
scope.show = false;
|
||||
};
|
||||
scope.setSendMax = function() {
|
||||
$timeout(function() {
|
||||
scope.hide();
|
||||
}, 100);
|
||||
scope.onSelect();
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
send-max-selector {
|
||||
|
||||
.bp-action-sheet__sheet {
|
||||
padding-left: 2rem;
|
||||
padding-right: .75rem;
|
||||
}
|
||||
|
||||
.max-selector {
|
||||
a.item {
|
||||
border: none;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
span {
|
||||
&.item-note {
|
||||
color: #3A3A3A;
|
||||
font-family: "Roboto-Light";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<ion-nav-back-button>
|
||||
</ion-nav-back-button>
|
||||
<ion-nav-buttons side="secondary">
|
||||
<button class="button back-button" ng-click="showSendMaxSelector()">
|
||||
<button class="button back-button" ng-click="showSendMaxMenu($event)" ng-if="showMenu">
|
||||
<i class="icon ion-ios-more"></i>
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
@ -98,9 +98,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
<send-max-selector
|
||||
send-max-selector-wallet="wallet"
|
||||
send-max-selector-show="sendMax"
|
||||
send-max-selector-on-select="setSendMax">
|
||||
</send-max-selector>
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
<action-sheet action-sheet-show="show" class="max-selector">
|
||||
<div class="header" translate>Shortcuts</div>
|
||||
<a class="item item-icon-left item-icon-right" ng-click="setSendMax()">
|
||||
<i class="icon ion-ios-navigate-outline"></i>
|
||||
<span translate>Send max amount</span>
|
||||
<span class="item-note">{{wallet.status.availableBalanceStr}}</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</a>
|
||||
<div class="button button-block" ng-click="hide()">
|
||||
<span translate>Cancel</span>
|
||||
</div>
|
||||
</action-sheet>
|
||||
Loading…
Add table
Add a link
Reference in a new issue