forked from CGM_Public/pretix_original
PDF editor: Allow to easily change the page size
This commit is contained in:
@@ -717,6 +717,30 @@ var editor = {
|
||||
$("#source-container").hide();
|
||||
},
|
||||
|
||||
_create_empty_background: function () {
|
||||
$("#loading-container, #loading-upload").show();
|
||||
$("#loading-upload .progress").show();
|
||||
$('#loading-upload .progress-bar').css('width', 0);
|
||||
$("#fileupload").prop('disabled', true);
|
||||
$(".background-button").addClass("disabled");
|
||||
$.post(window.location.href, {
|
||||
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val(),
|
||||
'emptybackground': 'true',
|
||||
'width': $("#pdf-info-width").val(),
|
||||
'height': $("#pdf-info-height").val(),
|
||||
}, function (data) {
|
||||
if (data.status === "ok") {
|
||||
editor.uploaded_file_id = data.id;
|
||||
editor._replace_pdf_file(data.url);
|
||||
} else {
|
||||
alert(data.result.error || gettext("Error while uploading your PDF file, please try again."));
|
||||
$("#loading-container, #loading-upload").hide();
|
||||
}
|
||||
$("#fileupload").prop('disabled', false);
|
||||
$(".background-button").removeClass("disabled");
|
||||
}, 'json');
|
||||
},
|
||||
|
||||
init: function () {
|
||||
editor.$pdfcv = $("#pdf-canvas");
|
||||
editor.pdf_url = editor.$pdfcv.attr("data-pdf-url");
|
||||
@@ -738,6 +762,7 @@ var editor = {
|
||||
$("#source-container").hide();
|
||||
|
||||
|
||||
$("#pdf-empty").on("click", editor._create_empty_background);
|
||||
$('#fileupload').fileupload({
|
||||
url: location.href,
|
||||
dataType: 'json',
|
||||
@@ -750,7 +775,7 @@ var editor = {
|
||||
$("#loading-container, #loading-upload").hide();
|
||||
}
|
||||
$("#fileupload").prop('disabled', false);
|
||||
$(".fileinput-button").removeClass("disabled");
|
||||
$(".background-button").removeClass("disabled");
|
||||
},
|
||||
add: function (e, data) {
|
||||
data.formData = {
|
||||
@@ -760,7 +785,7 @@ var editor = {
|
||||
$("#loading-upload .progress").show();
|
||||
$('#loading-upload .progress-bar').css('width', 0);
|
||||
$("#fileupload").prop('disabled', true);
|
||||
$(".fileinput-button").addClass("disabled");
|
||||
$(".background-button").addClass("disabled");
|
||||
data.process().done(function () {
|
||||
data.submit();
|
||||
});
|
||||
|
||||
@@ -466,3 +466,6 @@ table td > .checkbox input[type="checkbox"] {
|
||||
}
|
||||
}
|
||||
|
||||
.help-inline {
|
||||
color: lighten($text-color, 25%); // lighten the text some for contrast
|
||||
}
|
||||
|
||||
@@ -61,3 +61,7 @@ body {
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
}
|
||||
.pdf-info .help-inline p {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user