Updated js functionality for adding shows to POST show image to ShowController on success
This commit is contained in:
parent
4e545dfe9f
commit
f73432931c
1 changed files with 20 additions and 14 deletions
|
@ -8,7 +8,6 @@ function openAddShowForm() {
|
||||||
if($("#add-show-form").length == 1) {
|
if($("#add-show-form").length == 1) {
|
||||||
if( ($("#add-show-form").css('display')=='none')) {
|
if( ($("#add-show-form").css('display')=='none')) {
|
||||||
$("#add-show-form").show();
|
$("#add-show-form").show();
|
||||||
$("#upload").prop("accept", "image/*");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var windowWidth = $(window).width();
|
var windowWidth = $(window).width();
|
||||||
|
@ -627,25 +626,30 @@ function setAddShowEvents(form) {
|
||||||
}
|
}
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
var start_date = $("#add_show_start_date").val();
|
var start_date = $("#add_show_start_date").val(),
|
||||||
var end_date = $("#add_show_end_date").val();
|
end_date = $("#add_show_end_date").val(),
|
||||||
var action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
||||||
|
|
||||||
var image = new FormData();
|
var image = new FormData();
|
||||||
image.append('show-image', $('#upload')[0].files[0]);
|
image.append('file', $('#upload')[0].files[0]);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: action,
|
url: action,
|
||||||
data: {format: "json", data: data, hosts: hosts, days: days},
|
data: {format: "json", data: data, hosts: hosts, days: days},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
$.ajax({
|
if (json.showId) { // Successfully added the show
|
||||||
url: '/Schedule/upload-image',
|
var imageAction = '/rest/show/' + json.showId + '/upload-image';
|
||||||
data: image,
|
|
||||||
cache: false,
|
// perform a second post in order to send the show image
|
||||||
contentType: false,
|
$.ajax({
|
||||||
processData: false,
|
url: imageAction,
|
||||||
type: 'POST'
|
data: image,
|
||||||
});
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
type: 'POST'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$('#schedule-add-show').unblock();
|
$('#schedule-add-show').unblock();
|
||||||
|
|
||||||
|
@ -781,6 +785,8 @@ function setAddShowEvents(form) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since Zend's setAttrib won't apply through the wrapper, set accept=image/* here
|
||||||
|
$("#upload").prop("accept", "image/*");
|
||||||
var bgColorEle = $("#add_show_background_color");
|
var bgColorEle = $("#add_show_background_color");
|
||||||
var textColorEle = $("#add_show_color");
|
var textColorEle = $("#add_show_color");
|
||||||
$('#add_show_name').bind('input', 'change', function(){
|
$('#add_show_name').bind('input', 'change', function(){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue