1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Completely replaced the inline edition by dialog edition.

Add autocomplete for tags.
Directplay added on Radio and Smart Playlists.
Many code style fixed.
Removed all defined size (need to do that into CSS if needed).
Fixed other bugs found around..
This commit is contained in:
SUTJael 2013-11-24 22:01:21 +01:00
parent 1eb5bef9ab
commit aca49c658d
63 changed files with 1120 additions and 1346 deletions

View file

@ -18,15 +18,25 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title, cancel_title) {
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, edit_tag_choices) {
var parent = this;
parent.editFormId = 'form#' + edit_form_id;
parent.contentUrl = jsAjaxUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
parent.contentUrl = jsAjaxShowEditUrl + '?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>';
// Convert choices string ("tag0,tag1,tag2,...") to choices array
parent.editTagChoices = new Array();
if (edit_tag_choices != null && edit_tag_choices != '') {
var splitted = edit_tag_choices.split(',');
var i;
for (i = 0; i < splitted.length; ++i) {
parent.editTagChoices.push($.trim(splitted[i]));
}
}
parent.dialog_buttons = {};
this.dialog_buttons[save_title] = function() {
this.dialog_buttons[jsSaveTitle] = function() {
$.ajax({
url : parent.saveUrl,
type : 'POST',
@ -41,7 +51,7 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title
}
});
}
this.dialog_buttons[cancel_title] = function() {
this.dialog_buttons[jsCancelTitle] = function() {
$("#editdialog").dialog("close");
}
@ -60,7 +70,8 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title
$("#edit_tags").tagit({
allowSpaces: true,
singleField: true,
singleFieldDelimiter: ','
singleFieldDelimiter: ',',
availableTags: parent.editTagChoices
});
}
});
@ -76,44 +87,12 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title
}
$(window).resize(function() {
$("#editdialog").dialog("option", "position", ['center', 'center']);
$("#editdialog").dialog("option", "position", ['center', 'center']);
});
function showAddTagSlideout(elm) {
$(elm).show('slide', 500);
}
function closeAddTagSlideout(elm) {
$(elm).hide('slide', 500);
}
function saveTag(id, type, path) {
var tagName = $('#dialog_tag_item_tag_name_'+id).val();
if (tagName != null || tagName != '') {
ajaxPut(path + '/server/ajax.server.php?page=tag&action=add_tag_by_name&type=' + type + '&object_id=' + id + '&tag_name=' + tagName);
function check_inline_song_edit(type, song) {
var source = '#' + type + '_select_' + song;
if ($(source + ' option:selected').val() == -1) {
$(source).replaceWith('<input type="text" name="' + type + '_name" value="New ' + type + '" onclick="this.select();" />');
}
$('#dialog_tag_item_tag_name').val('');
$('#dialog_tag_item_' + id).hide('slide', 500);
$('#np_song_tags_' + id).append('<a href="javascript:void(0);" class="hover-remove tag_size2">' + tagName + '</a>')
}
function showAddTagDialog(id, type, path) {
$('#dialog_tag_item').dialog({
modal: true,
buttons: [
{
title: "Tag",
text: 'ok',
click: function () {
var tagName = $('#dialog_tag_item_tag_name').val();
if (tagName != null || tagName != '') {
ajaxPut(path + '/server/ajax.server.php?page=tag&action=add_tag_by_name&type=' + type + '&object_id=' + id + '&tag_name=' + tagName);
}
$('#dialog_tag_item_tag_name').val('');
$(this).dialog('close');
}
}
]
}).show();
}