Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit c55b8ba

Browse files
committed
add to transaction modal
1 parent d07d6a2 commit c55b8ba

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

js/templates/transactionModal.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ <h3 class="txt-bright"><%= polyglot.t('CheckExchanges') %> </h3>
4141
<div class="modal-hero js-transactionPay background1">
4242
<div class="positionTop width100 padding20">
4343
<img class="pull-left qrCode js-transactionPayQRCode" height="180" width="180" src="imgs/defaultItem.png"/>
44-
<div class="pull-left rowtop20 pad20Left txt-bright" style="width:255px;">
45-
<div class="txt-center row20 textSize16px">
44+
<div class="pull-left pad20Left txt-bright" style="width:255px;">
45+
<div class="txt-center row10 textSize16px">
4646
<%= polyglot.t('buyFlow.SendBTCtoAddress', {amount: ob.buyer_order.order.payment.amount}) %>
4747
</div>
48-
<div class="txt-center row20">
48+
<div class="txt-center row10">
4949
<a class="textSize11px"
5050
href="bitcoin:<%= ob.buyer_order.order.payment.address %>?amount=<%= ob.buyer_order.order.payment.amount %>&message=<%= ob.vendor_offer.listing.item.title %>">
5151
<%= ob.buyer_order.order.payment.address %>
5252
</a>
5353
</div>
54+
<div class="txt-center row10">
55+
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput">
56+
<label for="BuyWizardQRDetailsInput" class="textSize11px"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label>
57+
</div>
5458
<a class="btn btn-txt btn-wide row10 js-transactionPayCopy"><i class="ion-clipboard"></i> <%= polyglot.t('buyFlow.CopyAddress') %></a>
5559
<a class="btn btn-txt btn-wide row10 js-externalLink"
5660
href="bitcoin:<%= ob.buyer_order.order.payment.address %>?amount=<%= ob.buyer_order.order.payment.amount %>&message=<%= ob.vendor_offer.listing.item.title %>">

js/views/buyWizardVw.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module.exports = baseVw.extend({
201201

202202
//set the QR details checkbox
203203
var QRtoggleVal = localStorage.getItem('AdditionalPaymentData') != "false" ? true : false;
204-
this.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
204+
self.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
205205
});
206206
return this;
207207
},
@@ -535,8 +535,6 @@ module.exports = baseVw.extend({
535535
if(localStorage.getItem('AdditionalPaymentData') != "false") {
536536
payHREF += "&label="+storeName+"&message="+message;
537537
}
538-
539-
console.log(payHREF)
540538

541539
this.hideMaps();
542540
this.$el.find('.js-buyWizardPay').removeClass('hide');

js/views/transactionModalVw.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module.exports = baseVw.extend({
5858
'blur .js-transactionDiscussionSendText': 'blurInput',
5959
'blur input': 'validateInput',
6060
'blur textarea': 'validateInput',
61+
'click #BuyWizardQRDetailsInput': 'toggleQRDetails',
6162
'keydown #transactionDiscussionSendText': 'onKeydownDiscussion',
6263
'keyup #transactionDiscussionSendText': 'onKeyupDiscussion'
6364
},
@@ -166,6 +167,9 @@ module.exports = baseVw.extend({
166167
self.getDiscussion();
167168
self.discussionScroller = self.$('.js-discussionScroller');
168169
self.moderatorPercentage = self.model.get('displayModerator').feeDecimal;
170+
//set the QR details checkbox
171+
var QRtoggleVal = localStorage.getItem('AdditionalPaymentData') != "false" ? true : false;
172+
self.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
169173
});
170174
},
171175

@@ -205,12 +209,24 @@ module.exports = baseVw.extend({
205209
}
206210
},
207211

212+
toggleQRDetails: function(){
213+
var toggleInput = this.$('#BuyWizardQRDetailsInput'),
214+
toggleVal = toggleInput.prop('checked');
215+
localStorage.setItem('AdditionalPaymentData', toggleVal);
216+
this.showPayment();
217+
},
218+
208219
showPayment: function(){
209220
var totalBTCPrice = 0,
210221
payHREF,
211222
dataURI;
212223
if(this.model.get('buyer_order')){
213-
payHREF = "bitcoin:" + this.model.get('buyer_order').order.payment.address + "?amount=" + this.model.get('buyer_order').order.payment.amount + "&message=" + this.model.get('vendor_offer').listing.item.title.substring(0, 20);
224+
payHREF = "bitcoin:" + this.model.get('buyer_order').order.payment.address + "?amount=" + this.model.get('buyer_order').order.payment.amount;
225+
226+
if(localStorage.getItem('AdditionalPaymentData') != "false") {
227+
payHREF += "&message=" + this.model.get('vendor_offer').listing.item.title.substring(0, 20) + " " + this.orderID;
228+
}
229+
214230
dataURI = qr(payHREF, {type: 10, size: 10, level: 'M'});
215231
this.$el.find('.js-transactionPayQRCode').attr('src', dataURI);
216232
} else {

0 commit comments

Comments
 (0)