remove menu popover

This commit is contained in:
Javier 2016-12-27 12:44:47 -03:00
commit 12a6907af6
9 changed files with 127 additions and 69 deletions

View file

@ -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) {

View file

@ -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,11 @@ 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() {
$state.transitionTo('tabs.send.confirm', {
isWallet: $scope.isWallet,
toAmount: null,
@ -205,11 +191,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) {

View file

@ -0,0 +1,25 @@
'use strict';
angular.module('copayApp.directives')
.directive('sendMax', function($timeout) {
return {
restrict: 'E',
templateUrl: 'views/includes/sendMax.html',
transclude: true,
scope: {
show: '=sendMaxShow',
onSelect: '=sendMaxOnSelect'
},
link: function(scope, element, attrs) {
scope.hide = function() {
scope.show = false;
};
scope.sendMax = function() {
$timeout(function() {
scope.hide();
}, 100);
scope.onSelect();
};
}
};
});

View file

@ -0,0 +1,61 @@
send-max-selector {
$border-color: #EFEFEF;
.bp-action-sheet__sheet {
padding-left: 2rem;
padding-right: .75rem;
}
.send-max-selector {
.option {
border: 0;
padding-right: 0;
padding-top: 0;
padding-left: 65px;
padding-bottom: 0;
margin-bottom: 1px;
overflow: visible;
> i {
padding: 0;
margin-left: -5px;
> img {
height: 39px;
width: 39px;
padding: 4px;
}
}
}
.send-max-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;
}
}
.send-max-details {
flex-grow: 1;
.send-max-name {
padding-bottom: 5px;
}
}
}
}

View file

@ -3,11 +3,6 @@
<ion-nav-title>{{'Wallet Addresses' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="showMenu(false, $event)">
<i class="icon ion-ios-more"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-content>
@ -31,7 +26,7 @@
</div>
<div class="list">
<div class="item item-icon-right view-all" ng-show="viewAll.value" ng-click="requestSpecificAmount()">
<div class="item item-icon-right view-all" ng-click="requestSpecificAmount()">
<span translate>Request Specific amount</span>
<i class="icon ion-ios-arrow-thin-right"></i>
</div>
@ -39,6 +34,9 @@
<span translate>View All Addresses</span>
<i class="icon ion-ios-arrow-thin-right"></i>
</div>
<div class="item view-all" ng-show="latestWithBalance[0]" ng-click="scan()">
<span translate>Scan addresses for funds</span>
</div>
<div class="item item-divider item-icon-right" ng-click="newAddress()">
<span translate>Unused Addresses</span>
<i class="icon ion-ios-plus-empty"></i>

View file

@ -3,17 +3,20 @@
<ion-nav-title>{{'All Addresses' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="showMenu(true, $event)" ng-hide="!isCordova && allAddressesView">
<i class="icon ion-ios-more"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<div class="addr-list list">
<div class="item item-divider"></div>
<div ng-show="isCordova && allAddresses[0]">
<div class="item view-all" ng-click="sendByEmail()">
<span translate>Send addresses by email</span>
</div>
<div class="item item-divider"></div>
</div>
<div class="item" ng-repeat="a in allAddresses track by $index" copy-to-clipboard="a.address">
{{a.address}}
<div class="addr-path" ng-if="!a.balanceStr">

View file

@ -6,7 +6,7 @@
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="showSendMaxMenu($event)" ng-if="showMenu">
<button class="button back-button" ng-click="showSendMaxMenu()" ng-if="showMenu">
<i class="icon ion-ios-more"></i>
</button>
</ion-nav-buttons>
@ -120,4 +120,8 @@
</div>
</div>
</ion-content>
<send-max
send-max-show="showSendMax"
send-max-on-select="sendMax">
</send-max>
</ion-view>

View file

@ -1,9 +0,0 @@
<ion-popover-view ng-style="{'height': height + 'px'}" id="menu-popover">
<ion-content>
<div class="list">
<div class="item" ng-repeat="i in items track by $index" ng-click="i.action()">
{{i.text}}
</div>
</div>
</ion-content>
</ion-popover-view>

View file

@ -0,0 +1,14 @@
<action-sheet action-sheet-show="show" class="send-max-selector">
<img class="back-arrow" src="img/icon-back-arrow.svg" ng-click="hide()">
<a class="item item-icon-left item-big-icon-left item-icon-right send-max no-border" ng-click="onSelect()">
<i class="icon ion-ios-speedometer-outline"></i>
<div class="send-max-inner">
<div class="send-max-details">
<div class="send-max-name" translate>Send max amount</div>
</div>
<i class="icon">
<img class="check" src="img/icon-check-selected.svg">
</i>
</div>
</a>
</action-sheet>