View Single Post
Old 03-08-2025, 06:15 PM   #86
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question: When multiple categories share one icon (E.g. in #fanficcat, display a game controller for all games without an individual icon), what's the best way to do this?

For column icons, I was using a regex (foo|bar|xyz), but I find that's hard to maintain.
I can think of three ways to do this:
  • Assign the icon to each category (and children if needed), not worrying about the duplication of icons on the hard disk. This is the most direct method. It suffers from not being able to change the icon for all usages in one operation. Its advantage is you can quickly fix seeing the wrong icon for a category directly in the tag browser.
  • Write a template that checks the item_value and picks the icon. This is probably very similar to what you are doing with column icons. You could use a switch-if checking single values instead of a regexp.
  • Write a template that picks an icon for a category. Override the template by directly assigning other icons to categories. It isn't obvious that this would be better than either of the above.
Personally, I would use the first method, assuming I'm not frequently changing the actual stored icon that goes with a category and categories don't come and go frequently.

Last edited by chaley; 03-09-2025 at 09:37 AM. Reason: Clarity
chaley is offline   Reply With Quote