Flip all_albums.json to id:name map.
This commit is contained in:
		
							parent
							
								
									53e8030186
								
							
						
					
					
						commit
						d091efb619
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -197,7 +197,7 @@ def post_album_show_in_folder(album_id): | ||||||
| @site.route('/all_albums.json') | @site.route('/all_albums.json') | ||||||
| @decorators.cached_endpoint(max_age=15) | @decorators.cached_endpoint(max_age=15) | ||||||
| def get_all_album_names(): | def get_all_album_names(): | ||||||
|     all_albums = {album.display_name: album.id for album in common.P.get_albums()} |     all_albums = {album.id: album.display_name for album in common.P.get_albums()} | ||||||
|     response = {'albums': all_albums} |     response = {'albums': all_albums} | ||||||
|     return jsonify.make_json_response(response) |     return jsonify.make_json_response(response) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,9 +21,9 @@ function init_datalist() | ||||||
|     document.body.appendChild(datalist); |     document.body.appendChild(datalist); | ||||||
| 
 | 
 | ||||||
|     const fragment = document.createDocumentFragment(); |     const fragment = document.createDocumentFragment(); | ||||||
|     for (const album_name in album_autocomplete.albums) |     for (const album_id in album_autocomplete.albums) | ||||||
|     { |     { | ||||||
|         const album_id = album_autocomplete.albums[album_name]; |         const album_name = album_autocomplete.albums[album_id]; | ||||||
|         const option = document.createElement("option"); |         const option = document.createElement("option"); | ||||||
|         option.value = album_id; |         option.value = album_id; | ||||||
|         option.innerText = album_name; |         option.innerText = album_name; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue