mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Added validation for voucher generation field (#373)
* Check voucher count input field before generating * changed voucher-bulk-codes-num to numeric type * Added Jan Felix to AUTHORS * replaced alert by validation colors * added another formatting reset ...so that it does not stay red if someone submits something valid
This commit is contained in:
committed by
Raphael Michel
parent
d4b3bf4370
commit
63bdb397e7
1
AUTHORS
1
AUTHORS
@@ -21,3 +21,4 @@ an awesome project. Thank you all!
|
|||||||
Tobias Kunze <rixx@cutebit.de>
|
Tobias Kunze <rixx@cutebit.de>
|
||||||
Oliver Knapp <github@oliverknapp.de>
|
Oliver Knapp <github@oliverknapp.de>
|
||||||
Vishal Sodani <vishalsodani@rediffmail.com>
|
Vishal Sodani <vishalsodani@rediffmail.com>
|
||||||
|
Jan Felix Wiebe <git@jfwie.be>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-7 col-sm-12 col-md-offset-3">
|
<div class="col-md-7 col-sm-12 col-md-offset-3">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control input-xs"
|
<input type="number" class="form-control input-xs"
|
||||||
id="voucher-bulk-codes-num"
|
id="voucher-bulk-codes-num"
|
||||||
placeholder="{% trans "Number" %}">
|
placeholder="{% trans "Number" %}">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
|
|||||||
@@ -96,12 +96,21 @@ $(function () {
|
|||||||
|
|
||||||
// Vouchers
|
// Vouchers
|
||||||
$("#voucher-bulk-codes-generate").click(function () {
|
$("#voucher-bulk-codes-generate").click(function () {
|
||||||
var url = $(this).attr("data-rng-url"),
|
var num = $("#voucher-bulk-codes-num").val();
|
||||||
num = $("#voucher-bulk-codes-num").val();
|
if (num != "") {
|
||||||
$("#id_codes").html("Generating...");
|
$(".form-group:has(#voucher-bulk-codes-num)").addClass("has-error");
|
||||||
$.getJSON(url + '?num=' + num, function (data) {
|
var url = $(this).attr("data-rng-url");
|
||||||
$("#id_codes").val(data.codes.join("\n"));
|
$("#id_codes").html("Generating...");
|
||||||
});
|
$.getJSON(url + '?num=' + num, function (data) {
|
||||||
|
$("#id_codes").val(data.codes.join("\n"));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$(".form-group:has(#voucher-bulk-codes-num)").addClass("has-error");
|
||||||
|
$("#voucher-bulk-codes-num").focus();
|
||||||
|
setTimeout(function() {
|
||||||
|
$(".form-group:has(#voucher-bulk-codes-num)").removeClass("has-error");
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#ajaxerr").on("click", ".ajaxerr-close", ajaxErrDialog.hide);
|
$("#ajaxerr").on("click", ".ajaxerr-close", ajaxErrDialog.hide);
|
||||||
|
|||||||
Reference in New Issue
Block a user