View Single Post
Old 11-17-2023, 09:54 PM   #41
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,467
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Wiggo View Post
I've tried to add an icon to a column for has_notes similar to extra_files

Code:
if has_extra_files() then icon = add_icon(icon, 'extra_files.png') fi;
but this doen't work. Is it possible to show an icon for has_notes regardless the type of notes (author,tag, series...)?
This template returns the list of lookup names with items on the book that have notes. If none do, return the empty string. If you want to use it, make it a stored template and call it in the icon template.

I don't know if the performance will be acceptable, especially if lots of items in lots of columns have notes.
Code:
python:
def evaluate(book, context):
	db = context.db.new_api
	notes_on_book = db.items_with_notes_in_book(book.id)
	return '' if not notes_on_book else ', '.join(notes_on_book.keys())
chaley is offline   Reply With Quote