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';
|
'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 unitToSatoshi;
|
||||||
var satToUnit;
|
var satToUnit;
|
||||||
var unitDecimals;
|
var unitDecimals;
|
||||||
var satToBtc;
|
var satToBtc;
|
||||||
var SMALL_FONT_SIZE_LIMIT = 10;
|
var SMALL_FONT_SIZE_LIMIT = 10;
|
||||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||||
|
var MENU_ITEM_HEIGHT = 55;
|
||||||
|
|
||||||
$scope.$on('$ionicView.leave', function() {
|
$scope.$on('$ionicView.leave', function() {
|
||||||
angular.element($window).off('keydown');
|
angular.element($window).off('keydown');
|
||||||
|
|
@ -14,6 +15,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.isGiftCard = data.stateParams.isGiftCard;
|
$scope.isGiftCard = data.stateParams.isGiftCard;
|
||||||
|
$scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send';
|
||||||
$scope.isWallet = data.stateParams.isWallet;
|
$scope.isWallet = data.stateParams.isWallet;
|
||||||
$scope.cardId = data.stateParams.cardId;
|
$scope.cardId = data.stateParams.cardId;
|
||||||
$scope.toAddress = data.stateParams.toAddress;
|
$scope.toAddress = data.stateParams.toAddress;
|
||||||
|
|
@ -73,14 +75,28 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$ionicScrollDelegate.resize();
|
$ionicScrollDelegate.resize();
|
||||||
});
|
}, 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.showSendMaxSelector = function() {
|
$scope.showSendMaxMenu = function($event) {
|
||||||
$scope.sendMax = true;
|
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', {
|
$state.transitionTo('tabs.send.confirm', {
|
||||||
isWallet: $scope.isWallet,
|
isWallet: $scope.isWallet,
|
||||||
toAmount: null,
|
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-back-button>
|
</ion-nav-back-button>
|
||||||
<ion-nav-buttons side="secondary">
|
<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>
|
<i class="icon ion-ios-more"></i>
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
|
|
@ -98,9 +98,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</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>
|
</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