2012-09-19 10:07:19 +03:00
|
|
|
var seriesEditorUrl = '../Series/Edit';
|
|
|
|
var saveSeriesEditorUrl = '../Series/Edit';
|
2012-09-12 08:52:25 +03:00
|
|
|
var seriesDeleteUrl = '../Series/Delete';
|
2012-02-23 00:41:47 +03:00
|
|
|
|
|
|
|
$("#seriesEditor").dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto',
|
|
|
|
width: 670,
|
|
|
|
resizable: false,
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Delete": {
|
|
|
|
text: "Delete",
|
|
|
|
class: "ui-delete-button",
|
|
|
|
click: function () {
|
2012-09-04 03:51:07 +03:00
|
|
|
$(this).dialog("close");
|
|
|
|
|
|
|
|
//Get the SeriesId and Title
|
|
|
|
var seriesId = $('#SeriesId').val();
|
|
|
|
var title = $('[aria-labelledby="ui-dialog-title-seriesEditor"]').find('#ui-dialog-title-seriesEditor').text();
|
2012-02-23 00:41:47 +03:00
|
|
|
|
2012-09-04 03:51:07 +03:00
|
|
|
//Fill in the view
|
|
|
|
$('#seriesDelete').children('.seriesId').val(seriesId);
|
|
|
|
$('#seriesDelete').children('.seriesTitle').html(title);
|
|
|
|
|
|
|
|
$("#seriesDelete").dialog("open");
|
2012-02-23 00:41:47 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"Save": function () {
|
|
|
|
//Save the form
|
|
|
|
$('#SeriesEditorForm').submit();
|
|
|
|
afterSave();
|
|
|
|
|
|
|
|
$(this).dialog("close");
|
|
|
|
},
|
|
|
|
Cancel: function () {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#seriesDelete").dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
resizable: false,
|
|
|
|
height: 'auto',
|
|
|
|
width: 450,
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Delete": function () {
|
|
|
|
var seriesId = $('.seriesId').val();
|
2012-09-05 08:48:10 +03:00
|
|
|
var deleteFiles = $('#DeleteFromDisk').is(':checked');
|
2012-02-23 00:41:47 +03:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: seriesDeleteUrl,
|
2012-09-04 03:51:07 +03:00
|
|
|
data: { seriesId: seriesId, deleteFiles: deleteFiles },
|
2012-02-23 00:41:47 +03:00
|
|
|
success: function (data) {
|
|
|
|
afterDelete(seriesId);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(this).dialog("close");
|
|
|
|
},
|
|
|
|
Cancel: function () {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".editButton").live('click', function () {
|
|
|
|
//Get the SeriesId and Title
|
|
|
|
var seriesId = parseInt($(this).attr("value"));
|
|
|
|
var title = $(this).attr("rel");
|
|
|
|
|
|
|
|
//Set the title of the dialog
|
|
|
|
$("#seriesEditor").dialog("option", "title", title);
|
|
|
|
|
|
|
|
//Pre-populate the view with ajax
|
|
|
|
$('#seriesEditor').html('<div style="text-align: center; width: 100%; height: 100%;"><img src="../../Content/Images/ajax-loader.gif" style="padding-top: 120px;" /></div>');
|
|
|
|
|
|
|
|
//Get the view
|
|
|
|
$.ajax({
|
|
|
|
url: seriesEditorUrl,
|
|
|
|
data: { seriesId: seriesId },
|
|
|
|
success: function (data) {
|
|
|
|
$('#seriesEditor').html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//Open the dialog
|
|
|
|
$("#seriesEditor").dialog("open");
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".deleteButton").live('click', function () {
|
|
|
|
//Get the SeriesId and Title
|
|
|
|
var seriesId = parseInt($(this).attr("value"));
|
|
|
|
var title = $(this).attr("rel");
|
|
|
|
|
|
|
|
//Fill in the view
|
|
|
|
$('#seriesDelete').children('.seriesId').val(seriesId);
|
|
|
|
$('#seriesDelete').children('.seriesTitle').html(title);
|
|
|
|
|
|
|
|
//Open the dialog
|
|
|
|
$("#seriesDelete").dialog("open");
|
|
|
|
});
|