Fix removing artist fields from upload form

This commit is contained in:
itismadness
2025-09-11 23:10:16 +00:00
committed by Spine
parent 9587776ed6
commit 774737c574
2 changed files with 14 additions and 13 deletions

View File

@@ -385,16 +385,20 @@ function AddArtistField() {
7: 6,
8: 7,
};
RoleField.selectedIndex = mapping[$("#importance_" + (ArtistCount - 1)).val()];
RoleField.selectedIndex = mapping[document.getElementById("importance_" + (ArtistCount - 1)).value];
let x = $('#artistfields').raw();
x.appendChild(document.createElement("br"));
x.appendChild(ArtistField);
x.append(' ');
x.appendChild(RoleField);
const x = document.getElementById('artistfields');
const div = document.createElement("div");
div.id = "artist_field_" + ArtistCount;
div.style.display = "inline";
div.appendChild(document.createElement("br"));
div.appendChild(ArtistField);
div.append(' ');
div.appendChild(RoleField);
x.appendChild(div);
if ($("#artist_0").data("gazelle-autocomplete")) {
$(ArtistField).live('focus', function() {
if (document.getElementById('artist_0').dataset.gazelleAutocomplete) {
ArtistField.addEventListener('focus', () => {
$(ArtistField).autocomplete({
serviceUrl : 'artist.php?action=autocomplete'
});
@@ -406,10 +410,7 @@ function RemoveArtistField() {
if (ArtistCount === 0) {
return;
}
let x = $('#artistfields').raw();
for (let i = 0; i < 3; i++) {
x.removeChild(x.lastChild);
}
document.getElementById("artist_field_" + ArtistCount).remove();
ArtistCount--;
}

View File

@@ -34,7 +34,7 @@
{% for role, artist_list in torrent.Artists %}
{% for artist in artist_list %}
<input type="text" id="artist_{{ loop.index0 }}" name="artists[]" size="45" value="{{ artist.name }}"{{ autocomplete(user, 'other') }}{{ disabled(is_uploaded) }} onblur="CheckVA();" />
<select id="importance" name="importance[]"{{ disabled(is_uploaded) }}>
<select id="importance_{{ loop.index0 }}" name="importance[]"{{ disabled(is_uploaded) }}>
<option value="{{ constant('ARTIST_MAIN') }}"{{ selected(role == constant('ARTIST_MAIN')) }}>Main</option>
<option value="{{ constant('ARTIST_GUEST') }}"{{ selected(role == constant('ARTIST_GUEST')) }}>Guest</option>
<option value="{{ constant('ARTIST_COMPOSER') }}"{{ selected(role == constant('ARTIST_COMPOSER')) }}>Composer</option>