Skip to content
Snippets Groups Projects
Commit 2d4cbf35 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Transfer: display comment warning only when a comment is filled.

parent 805c1cd6
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment