Added show_logo_name field to data object to avoid deleting current logo when none is being uploaded

This commit is contained in:
Duncan Sommerville 2014-09-18 10:32:56 -04:00
parent 1cf3a5ca3a
commit 096556fa74
2 changed files with 12 additions and 6 deletions

View file

@ -236,12 +236,14 @@ function setAddShowEvents(form) {
// If we're adding a new show, hide the "Current Logo" element/label
if ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show") {
$("#show_logo_current-element").show();
$("#show_logo_current-label").show();
// Display the current show logo if it exists
if ($("#show_logo_current").attr("src") !== "") {
$("#show_logo_current-element").show();
$("#show_logo_current-label").show();
$("#show_logo_current").show();
} else {
$("#show_logo_current-element").hide();
$("#show_logo_current-label").hide();
$("#show_logo_current").hide();
}
} else {
@ -668,6 +670,7 @@ function setAddShowEvents(form) {
&& $('#upload')[0].files[0]) {
image = new FormData();
image.append('file', $('#upload')[0].files[0]);
data['show_logo_name'] = $('#upload')[0].files[0].name;
}
$.ajax({