From 2d4cbf35a43fb10b5bf9cb61b12385b02bdb8ab7 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Fri, 8 Jun 2018 18:20:22 +0200 Subject: [PATCH] Transfer: display comment warning only when a comment is filled. --- www/js/controllers/transfer-controllers.js | 11 +++++++++-- www/templates/wallet/transfer_form.html | 17 +++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index c881bd309..dc4a2b654 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -69,10 +69,13 @@ function TransferController($scope, $controller, UIUtils, csWot, csWallet) { if (state.stateParams.comment) { parameters.comment = state.stateParams.comment; } + if (state.stateParams.restPub) { + parameters.restPub = state.stateParams.restPub; + } } // Make sure wallet is loaded - csWallet.login({sources: true}) + return csWallet.login({sources: true}) // If pubkey, get the uid (+ name, avatar) .then(function(data) { @@ -119,7 +122,8 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc amount: null, comment: null, useRelative: csSettings.data.useRelative, - useComment: false + useComment: false, + restPub: null }; $scope.udAmount = null; $scope.minAmount = minQuantitativeAmount; @@ -167,6 +171,9 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc $scope.formData.useComment=true; $scope.formData.comment = parameters.comment; } + if (parameters.restPub) { + $scope.formData.restPub = parameters.restPub; + } }; // Read default parameters $scope.setParameters(parameters); diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html index fb01757fb..4a9666afe 100644 --- a/www/templates/wallet/transfer_form.html +++ b/www/templates/wallet/transfer_form.html @@ -118,13 +118,14 @@ id="{{commentInputId}}" name="comment" ng-model="formData.comment" + ng-model-options="{ debounce: 650 }" ng-maxlength="255" ng-pattern="commentPattern" ng-focus="hideDigitKeyboard()"> </textarea> </label> <div class="form-errors" - ng-show="form.$submitted && form.comment.$error" + ng-show="form.comment.$error" ng-messages="form.comment.$error"> <div class="form-error" ng-message="maxlength"> <span translate="ERROR.FIELD_TOO_LONG"></span> @@ -135,18 +136,18 @@ </div> <!-- Warn comment is public --> - <div class="item item-icon-left item-text-wrap hidden-xs hidden-sm"> - <i class="icon ion-ios-information-outline positive"></i> - <h4 class="positive" translate>TRANSFER.WARN_COMMENT_IS_PUBLIC</h4> + <div class="item item-icon-left item-text-wrap item-no-border hidden-xs hidden-sm"> + <div class=" animate-fade-in animate-show-hide ng-hide" ng-show="formData.comment && formData.comment.length || form.comment.$invalid"> + <i class="icon ion-android-alert positive"></i> + <h4 class="positive" translate>TRANSFER.WARN_COMMENT_IS_PUBLIC</h4> + </div> </div> - <div class="item item-icon-left item-text-wrap visible-xs visible-sm" ng-if="formData.useComment"> - <i class="icon ion-ios-information-outline positive"></i> + <div class="item item-icon-left item-text-wrap item-no-border visible-xs visible-sm" ng-if="formData.useComment"> + <i class="icon ion-android-alert positive"></i> <h4 class="positive" translate>TRANSFER.WARN_COMMENT_IS_PUBLIC</h4> </div> </div> - - <div class="padding hidden-xs text-right"> <button class="button button-clear button-dark ink" ng-click="cancel()" type="button" translate>COMMON.BTN_CANCEL -- GitLab