URL of image for pay button

This commit is contained in:
rockstardev
2018-08-22 10:52:17 +02:00
parent b1fcf4524a
commit 9a5034c13c
3 changed files with 17 additions and 5 deletions

View File

@@ -32,7 +32,8 @@ namespace BTCPayServer.Controllers
Currency = DEFAULT_CURRENCY,
ButtonSize = 2,
UrlRoot = appUrl,
CurrencyDropdown = currencyDropdown
CurrencyDropdown = currencyDropdown,
PayButtonImageUrl = appUrl + "/img/paywithbtcpay.png"
};
return View(model);
}

View File

@@ -21,8 +21,9 @@ namespace BTCPayServer.Models.AppViewModels
[EmailAddress]
public string NotifyEmail { get; set; }
//
// Data that influences Pay Button UI, but not invoice creation
public string UrlRoot { get; set; }
public List<string> CurrencyDropdown { get; set; }
public string PayButtonImageUrl { get; set; }
}
}

View File

@@ -42,6 +42,13 @@
<input name="orderId" type="text" class="form-control" id="inputAddress" placeholder="(optional)"
v-model="srvModel.orderId" v-on:change="inputChanges">
</div>
<div class="form-group">
<label>Pay Button Image Url</label>
<input name="payButtonImageUrl" type="text" class="form-control" id="inputAddress"
v-model="srvModel.payButtonImageUrl" v-on:change="inputChanges"
v-validate="'required|url'" :class="{'is-invalid': errors.has('payButtonImageUrl') }">
<small class="text-danger">{{ errors.first('payButtonImageUrl') }}</small>
</div>
<div class="form-group">
<label>Button Size</label>
<div style="vertical-align:top; font-size:12px; display:flex;">
@@ -145,7 +152,8 @@
en: {
attributes: {
price: 'Price', checkoutDesc: 'Checkout Description', orderId: 'Order Id',
serverIpn: 'Server IPN', notifyEmail: 'Send Email Notifications', browserRedirect: 'Browser Redirect'
serverIpn: 'Server IPN', notifyEmail: 'Send Email Notifications', browserRedirect: 'Browser Redirect',
payButtonImageUrl: "Pay Button Image Url"
}
}
};
@@ -197,8 +205,7 @@
} else if (srvModel.buttonSize == 2) {
width = "209px";
}
$("#previewButton").css("width", width);
html += '\n &lt;input type="image" src="' + srvModel.urlRoot + '/img/paywithbtcpay.png" name="submit" style="width:' + width +
html += '\n &lt;input type="image" src="' + srvModel.payButtonImageUrl + '" name="submit" style="width:' + width +
'" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor"&gt;';
html += '\n&lt;/form&gt;';
@@ -209,6 +216,9 @@
hljs.highlightBlock(block);
});
$("#previewButton").css("width", width);
$("#previewButton").attr("src", srvModel.payButtonImageUrl);
return html;
}