diff --git a/data/interfaces/default/manageunmatched.html b/data/interfaces/default/manageunmatched.html index 59f36776..de090ab7 100644 --- a/data/interfaces/default/manageunmatched.html +++ b/data/interfaces/default/manageunmatched.html @@ -1,16 +1,20 @@ <%inherit file="base.html" /> <%! import headphones - import json - from headphones import db, helpers - myDB = db.DBConnection() - artist_json = {} - counter = 0 - artist_list = myDB.action("SELECT ArtistName from artists ORDER BY ArtistName COLLATE NOCASE") - for artist in artist_list: - artist_json[counter] = artist['ArtistName'] - counter+=1 - json_artists = json.dumps(artist_json) + # Removed direct DB imports and queries from template. + # These operations (fetching artists and creating json_artists) + # should be performed in the Python view/controller and passed + # to the template as part of its context. + # import json + # from headphones import db, helpers + # myDB = db.DBConnection() + # artist_json = {} + # counter = 0 + # artist_list = myDB.action("SELECT ArtistName from artists ORDER BY ArtistName COLLATE NOCASE") + # for artist in artist_list: + # artist_json[counter] = artist['ArtistName'] + # counter+=1 + # json_artists = json.dumps(artist_json) %> <%def name="headerIncludes()"> @@ -29,97 +33,109 @@

Manage Unmatched Albums

- +
<%-- Changed ID for clarity --%> - - + + - <% count_albums=0 %> + <% count_albums=0 %> <%-- Still useful for unique IDs if needed, but aiming for generic dialogs --%> %for album in unmatchedalbums: <% - old_artist_clean = album['ArtistName'].replace('&','%26').replace("'","%27") - old_album_clean = album['AlbumTitle'].replace('&','%26').replace("'","%27") - old_artist_js = album['ArtistName'].replace("'","\\'").replace('"','\\"') - old_album_js = album['AlbumTitle'].replace("'","\\'").replace('"','\\"') + # Pre-escape for direct use in data-attributes where JS string is needed. + # URL encoding will happen in JS with encodeURIComponent. + old_artist_js_str = album['ArtistName'].replace("'","\\'").replace('"','"') + old_album_js_str = album['AlbumTitle'].replace("'","\\'").replace('"','"') %> - - <% count_albums+=1 %> %endfor
Local ArtistLocal AlbumLocal ArtistLocal Album
${album['ArtistName']}
- - - - - +
+ ${album['ArtistName']}
+ <%-- Data attributes to pass context to JS --%> + +
${album['AlbumTitle']}
- - - - - +
+ ${album['AlbumTitle']}
+ +
+ + <%-- Generic Ignore Confirmation Dialog --%> + + + <%-- Generic Match Dialog --%> + + <%def name="headIncludes()"> + ${parent.headIncludes()} <%-- Ensure parent head includes are kept --%> <%def name="javascriptIncludes()"> + ${parent.javascriptIncludes()} <%-- Ensure parent javascript includes are kept --%>