send form

This commit is contained in:
Matias Alejo Garcia 2015-01-03 19:41:01 -03:00
commit 22a533377b
4 changed files with 259 additions and 228 deletions

View file

@ -77,7 +77,7 @@
<span translate> <strong class="size-16">Network Error</strong>.<br> Attempting to reconnect..</span> <span translate> <strong class="size-16">Network Error</strong>.<br> Attempting to reconnect..</span>
</span> </span>
<div ng-controller="SidebarController" ng-show="$root.iden && !$root.hideNavigation"> <div ng-controller="SidebarController" ng-show="$root.iden && !$root.hideNavigation && !$root.wpInputFocused">
<nav class="tab-bar"> <nav class="tab-bar">
<section class="left-small"> <section class="left-small">
<a class="left-off-canvas-toggle menu-icon" ><span></span></a> <a class="left-off-canvas-toggle menu-icon" ><span></span></a>
@ -98,8 +98,7 @@
<div ng-include="'views/includes/sidebar-mobile.html'"></div> <div ng-include="'views/includes/sidebar-mobile.html'"></div>
</nav> </nav>
<div <div ng-if="$root.iden"
ng-if="$root.iden"
ng-include="'views/includes/sidebar.html'" ng-include="'views/includes/sidebar.html'"
role='navigation' role='navigation'
class="sidebar"></div> class="sidebar"></div>
@ -116,10 +115,10 @@
class="head show-for-large-up" class="head show-for-large-up"
ng-include="'views/includes/head.html'" ng-include="'views/includes/head.html'"
ng-if="$root.iden" ng-if="$root.iden"
ng-class="{'dni':$root.hideNavigation}" ng-class="{'dni':$root.hideNavigation || $root.wpInputFocused}"
></div> ></div>
<section ng-class="{'main':$root.iden && !$root.starting && !$root.hideNavigation}" ng-view></section> <section ng-class="{'main':$root.iden && !$root.starting && !$root.hideNavigation && !$root.wpInputFocused}" ng-view></section>
<a class="exit-off-canvas"></a> <a class="exit-off-canvas"></a>

View file

@ -19,6 +19,9 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.minPasswordStrength = _.isUndefined(config.minPasswordStrength) ? $scope.minPasswordStrength = _.isUndefined(config.minPasswordStrength) ?
4 : config.minPasswordStrength; 4 : config.minPasswordStrength;
//TODO
$scope.minPasswordStrength = 1;
pinService.makePinInput($scope, 'newpin', function(newValue) { pinService.makePinInput($scope, 'newpin', function(newValue) {
_firstpin = newValue; _firstpin = newValue;
$scope.hideForWP = 0; $scope.hideForWP = 0;
@ -55,15 +58,14 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
}); });
}; };
$scope.formFocus = function() { $scope.formFocus = function() {
if ($scope.isWindowsPhoneApp) { if (!$scope.isWindowsPhoneApp) return
$scope.hideForWP = true; $scope.hideForWP = true;
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
}, 1); }, 1);
}
}; };
$scope.createPin = function(pin) { $scope.createPin = function(pin) {
preconditions.checkArgument(pin); preconditions.checkArgument(pin);
preconditions.checkState($rootScope.iden); preconditions.checkState($rootScope.iden);

View file

@ -13,6 +13,13 @@ angular.module('copayApp.controllers').controller('SendController',
preconditions.checkState(w.settings.unitToSatoshi); preconditions.checkState(w.settings.unitToSatoshi);
$scope.isMobile = isMobile.any();
$scope.isWindowsPhoneApp = isMobile.Windows() && isCordova;
// TODO
$scope.isWindowsPhoneApp = 1;
$rootScope.wpInputFocused = false;
$scope.isShared = w.isShared(); $scope.isShared = w.isShared();
$scope.requiresMultipleSignatures = w.requiresMultipleSignatures(); $scope.requiresMultipleSignatures = w.requiresMultipleSignatures();
$rootScope.title = $scope.requiresMultipleSignatures ? 'Send Proposal' : 'Send'; $rootScope.title = $scope.requiresMultipleSignatures ? 'Send Proposal' : 'Send';
@ -44,8 +51,31 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.isRateAvailable = true; $scope.isRateAvailable = true;
$scope.$digest(); $scope.$digest();
}); });
};
$scope.formFocus = function(what) {
if (!$scope.isWindowsPhoneApp) return
if (!what) {
$rootScope.wpInputFocused = false;
$scope.hideAddress = false;
$scope.hideAmount = false;
} else {
$rootScope.wpInputFocused = true;
if (what == 'amount') {
$scope.hideAddress = true;
} else if (what == 'msg') {
$scope.hideAddress = true;
$scope.hideAmount = true;
} }
}
$timeout(function() {
$rootScope.$digest();
}, 1);
};
$scope.setInputs = function() { $scope.setInputs = function() {
var w = $rootScope.wallet; var w = $rootScope.wallet;
var unitToSat = w.settings.unitToSatoshi; var unitToSat = w.settings.unitToSatoshi;

View file

@ -1,6 +1,6 @@
<div class="send" ng-controller="SendController" ng-init="init()"> <div class="send" ng-controller="SendController" ng-init="init()">
<div class="row hide-for-large-up" > <div class="row hide-for-large-up" ng-hide="$root.wpInputFocused" >
<div class="large-10 medium-10 small-9 columns"> <div class="large-10 medium-10 small-9 columns">
<h1>{{$root.title}}</h1> <h1>{{$root.title}}</h1>
</div> </div>
@ -33,7 +33,7 @@
<div class="large-8 large-centered columns"> <div class="large-8 large-centered columns">
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate> <form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
<div class="panel"> <div class="panel">
<div class="box-notification" ng-show="error"> <div class="box-notification" ng-show="error && !hideForWP ">
<div class="box-icon error"> <div class="box-icon error">
<i class="fi-x size-24"></i> <i class="fi-x size-24"></i>
</div> </div>
@ -52,7 +52,7 @@
<a class="close-notification text-success" ng-click="success=null">&#215;</a> <a class="close-notification text-success" ng-click="success=null">&#215;</a>
</div> </div>
<div ng-if="!_merchantData"> <div ng-if="!_merchantData" ng-hide="hideAddress">
<div class="row collapse"> <div class="row collapse">
<label for="address" class="left" > <label for="address" class="left" >
@ -73,13 +73,13 @@
</div> </div>
<div class="input"> <div class="input">
<input type="text" id="address" name="address" ng-disabled="loading || lockAddress" placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required> <input type="text" id="address" name="address" ng-disabled="loading || lockAddress" placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="formFocus('address')" ng-blur="formFocus(false)">
<a class="postfix" ng-click="openAddressBook()"><i class="fi-address-book size-24"></i></a> <a class="postfix" ng-click="openAddressBook()"><i class="fi-address-book size-24"></i></a>
</div> </div>
<div id="scanner" class="row" ng-if="showScanner" ng-include="'views/includes/scanner.html'"> <div id="scanner" class="row" ng-if="showScanner" ng-include="'views/includes/scanner.html'">
</div> </div>
</div> </div>
<div ng-show="_merchantData"> <div ng-show="_merchantData && !hideAddress">
<div class="row collapse" ng-click="openPPModal(_merchantData)"> <div class="row collapse" ng-click="openPPModal(_merchantData)">
<label for="domain"> <label for="domain">
@ -93,7 +93,7 @@
</div> </div>
</div> </div>
<div class="row" ng-init="showAlternative = false"> <div class="row" ng-init="showAlternative = false" ng-hide="hideAmount">
<div class="large-12 medium-12 columns"> <div class="large-12 medium-12 columns">
<div class="m5b right" ng-hide="sendForm.amount.$pristine"> <div class="m5b right" ng-hide="sendForm.amount.$pristine">
<span translate class="has-error right size-12" ng-show="sendForm.amount.$invalid"> <span translate class="has-error right size-12" ng-show="sendForm.amount.$invalid">
@ -110,7 +110,7 @@
</label> </label>
<div class="input"> <div class="input">
<input type="number" id="amount" ng-disabled="loading || lockAmount" name="amount" placeholder="{{'Amount'|translate}}" ng-minlength="0.00000001" ng-maxlength="10000000000" ng-model="_amount" valid-amount required autocomplete="off"> <input type="number" id="amount" ng-disabled="loading || lockAmount" name="amount" placeholder="{{'Amount'|translate}}" ng-minlength="0.00000001" ng-maxlength="10000000000" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="formFocus('amount')" ng-blur="formFocus(false)">
<a class="postfix" ng-click="showAlternative = true">{{$root.wallet.settings.unitName}}</a> <a class="postfix" ng-click="showAlternative = true">{{$root.wallet.settings.unitName}}</a>
</div> </div>
</div> </div>
@ -118,7 +118,7 @@
<label for="alternative"><span translate>Amount in</span> {{ alternativeName }} <label for="alternative"><span translate>Amount in</span> {{ alternativeName }}
</label> </label>
<div class="input"> <div class="input">
<input type="number" id="alternative" ng-disabled="loading || !isRateAvailable || lockAmount" name="alternative" placeholder="{{'Amount'|translate}}" ng-model="_alternative" requiredautocomplete="off"> <input type="number" id="alternative" ng-disabled="loading || !isRateAvailable || lockAmount" name="alternative" placeholder="{{'Amount'|translate}}" ng-model="_alternative" requiredautocomplete="off" ng-focus="formFocus('amount')" ng-blur="formFocus(false)">
<a class="postfix" ng-click="showAlternative = false"> {{ alternativeName }}</a> <a class="postfix" ng-click="showAlternative = false"> {{ alternativeName }}</a>
</div> </div>
</div> </div>
@ -131,8 +131,8 @@
<small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small> <small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small>
</label> </label>
<div class="input"> <div class="input">
<textarea id="comment" ng-disabled="loading" name="comment" ng-if="isShared" placeholder="Leave a private message to your copayers" ng-maxlength="100" ng-model="_comment"></textarea> <textarea id="comment" ng-disabled="loading" name="comment" ng-if="isShared" placeholder="Leave a private message to your copayers" ng-maxlength="100" ng-model="_comment" ng-focus="formFocus('msg')" ng-blur="formFocus(false)"></textarea>
<textarea id="comment" ng-disabled="loading" name="comment" ng-if="!isShared" placeholder="Add a private comment to identify the transaction" ng-maxlength="100" ng-model="_comment"></textarea> <textarea id="comment" ng-disabled="loading" name="comment" ng-if="!isShared" placeholder="Add a private comment to identify the transaction" ng-maxlength="100" ng-model="_comment" ng-focus="formFocus('msg')" ng-blur="formFocus(false)"></textarea>
</div> </div>
</div> </div>
</div> </div>