1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 02:09:23 +02:00

Artist/Album/Song edition working.

Tag are now editable through the same dialog.
This commit is contained in:
SUTJael 2013-11-22 18:58:06 +01:00
parent cb690e5eee
commit 3134e3ca8e
19 changed files with 258 additions and 90 deletions

View file

@ -19,23 +19,33 @@
//
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title, cancel_title) {
var contentUrl = jsAjaxUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
var saveUrl = jsAjaxUrl + '?action=edit_object&id=' + edit_id + '&type=' + edit_type;
var cancelUrl = jsAjaxUrl + '?action=cancel_edit_object&id=' + edit_id + '&type=' + edit_type; //No useful I think
var editDialogId = '<div id="editdialog"></div>';
var parent = this;
parent.editFormId = 'form#' + edit_form_id;
parent.contentUrl = jsAjaxUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
parent.saveUrl = jsAjaxUrl + '?action=edit_object&id=' + edit_id + '&type=' + edit_type;
parent.editDialogId = '<div id="editdialog"></div>';
var dialog_buttons = {};
dialog_buttons[save_title] = function() {
$(parent.edit_form_id).submit();
ajaxPut(parent.saveUrl);
$("#editdialog").dialog("close");
parent.dialog_buttons = {};
this.dialog_buttons[save_title] = function() {
$.ajax({
url : parent.saveUrl,
type : 'POST',
data : $(parent.editFormId).serializeArray(),
success : function(resp){
$("#editdialog").dialog("close");
// Need to replace current div instead of refreshing frame.
window.location.reload();
},
error : function(resp){
$("#editdialog").dialog("close");
}
});
}
dialog_buttons[cancel_title] = function() {
this.dialog_buttons[cancel_title] = function() {
$("#editdialog").dialog("close");
}
$(editDialogId).dialog({
$(parent.editDialogId).dialog({
title: edit_title,
modal: true,
dialogClass: 'editdialogstyle',
@ -43,8 +53,16 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title
width: 600,
autoOpen: false,
open: function () {
$(this).load(contentUrl, function() {
$(this).load(parent.contentUrl, function() {
$(this).dialog('option', 'position', 'center');
if ($('#edit_tags').length > 0) {
$("#edit_tags").tagit({
allowSpaces: true,
singleField: true,
singleFieldDelimiter: ','
});
}
});
},
close: function (e) {