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

Commit d07d6a2

Browse files
committed
working toggle
1 parent 71a5f72 commit d07d6a2

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

js/templates/buyWizard.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ <h3 class="txt-bright padding30"><%= polyglot.t('CheckExchanges') %> </h3>
3434
<a class="textSize16px js-buyWizardPayLink"><span class="js-buyWizardPayURL"></span></a>
3535
</div>
3636
<div class="txt-center row10">
37-
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput"><label for="BuyWizardQRDetailsInput"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label></input>
37+
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput">
38+
<label for="BuyWizardQRDetailsInput" class="textSize11px"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label>
3839
</div>
3940
<a class="btn btn-txt btn-wide row10 js-buyWizardPayCopy"><i class="ion-clipboard"></i> <%= polyglot.t('buyFlow.CopyAddress') %></a>
4041
<a class="btn btn-txt btn-wide row10 js-buyWizardPayLink"><i class="ion-link"></i> <%= polyglot.t('buyFlow.OpenAddress') %></a>

js/templates/pageNav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
126126
<a class="js-navRestart">
127127
<span class="ion-refresh fontSize11 marginRight2 textOpacity1"></span>
128128
<%= polyglot.t('nav.restart') %>
129-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.restart.toUpperCase() %></span>
129+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.restart.toUpperCase() %></span>
130130
</a>
131131
<hr/>
132132
<a class="js-showAboutModal">

js/utils/setTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = function(primaryColor, secondaryColor, backgroundColor, textCol
5656
"#ov1 #userPage input[type='radio'].fieldItem.starRating + label:before { color: " + textColor + "; background: none; box-shadow: none;}" +
5757
"#ov1 #userPage input[type='radio'].fieldItem.starRating:checked + label:before { background: none; box-shadow: none;}" +
5858
"#ov1 #userPage .starRating:before { color: " + textColor + ";}" +
59-
"#ov1 #userPage input[type='checkbox'].fieldItem:checked + label:before { color: " + textColor + "; box-shadow: inset 0 0 0 4px " + primaryColor + ";}" +
59+
//"#ov1 #userPage input[type='checkbox'].fieldItem:checked + label:before { color: " + textColor + "; box-shadow: inset 0 0 0 4px " + primaryColor + ";}" +
6060
"#ov1 #userPage input[type='number'].fieldItem { color: " + textColor + ";}" +
6161
"#ov1 #userPage input[type='number'].spinButtons::-webkit-inner-spin-button:before { color: " + textColor + ";}" +
6262
"#ov1 #userPage input[type='number'].spinButtons::-webkit-inner-spin-button:after { color: " + textColor + ";}" +

js/views/buyWizardVw.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module.exports = baseVw.extend({
5656
'click .js-buyWizardCloseSummary': 'closeWizard',
5757
'click input[name="radioPaymentType"]': 'changePaymentType',
5858
'blur .js-buyWizardPostalInput': 'updateMap',
59+
'click #BuyWizardQRDetailsInput': 'toggleQRDetails',
5960
'blur input': 'validateInput'
6061
},
6162

@@ -73,6 +74,7 @@ module.exports = baseVw.extend({
7374
this.orderID = "";
7475
this.model.set('selectedModerator', "");
7576
this.model.updateAttributes();
77+
this.cachePayData = "";
7678

7779
//create the country select list
7880
this.countryList = countries.get('countries');
@@ -197,6 +199,9 @@ module.exports = baseVw.extend({
197199
$(".js-BuyWizardWallets").randomize();
198200
}
199201

202+
//set the QR details checkbox
203+
var QRtoggleVal = localStorage.getItem('AdditionalPaymentData') != "false" ? true : false;
204+
this.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
200205
});
201206
return this;
202207
},
@@ -485,6 +490,7 @@ module.exports = baseVw.extend({
485490
success: function(data){
486491
if(data.success == true){
487492
self.showPayAddress(data);
493+
self.cachePayData = data; //cache the data for the QR Details toggle
488494
} else {
489495
messageModal.show(window.polyglot.t('errorMessages.contractError'), window.polyglot.t('errorMessages.sellerError') +" " +
490496
window.polyglot.t('errorMessages.checkPurchaseData') + "\n\n Reason: " + data.reason);
@@ -499,8 +505,21 @@ module.exports = baseVw.extend({
499505
});
500506
},
501507

508+
toggleQRDetails: function(){
509+
var toggleInput = this.$('#BuyWizardQRDetailsInput'),
510+
toggleVal = toggleInput.prop('checked');
511+
localStorage.setItem('AdditionalPaymentData', toggleVal);
512+
this.showPayAddress();
513+
},
514+
502515
showPayAddress: function(data){
503-
"use strict";
516+
data = data || this.cachePayData;
517+
518+
if(!data) {
519+
throw new Error('Data must be provided to the showPayAddress function');
520+
return;
521+
}
522+
504523
var totalBTCPrice = 0,
505524
storeName = encodeURI(this.model.get('page').profile.name),
506525
message = encodeURI(this.model.get('vendor_offer').listing.item.title.substring(0, 20) + " "+data.order_id),
@@ -515,7 +534,9 @@ module.exports = baseVw.extend({
515534
payHREF = "bitcoin://"+ data.payment_address+"?amount="+totalBTCPrice;
516535
if(localStorage.getItem('AdditionalPaymentData') != "false") {
517536
payHREF += "&label="+storeName+"&message="+message;
518-
}
537+
}
538+
539+
console.log(payHREF)
519540

520541
this.hideMaps();
521542
this.$el.find('.js-buyWizardPay').removeClass('hide');

0 commit comments

Comments
 (0)