Page MenuHomePhabricator

Cosmos skin: Work on getting rid of the nasty Cosmos\Icon class
Open, MediumPublic

Description

The Cosmos\Icon class does some nasty work and quite a hack. We should work on using OOUI icons to replace these other icons, to fit the MediaWiki conventions.

Event Timeline

SamanthaNguyen moved this task from Incoming / Backlog to Code hygiene on the Cosmos board.

Ultimately the goal should be that we can just store plain SVG files under resources and load them through ResourceLoader. Currently the icon SVG data is stored in a nested associative array, but that's not very nice to have. See https://www.mediawiki.org/wiki/Manual:ResourceLoaderImageModule.php

(We also don't need to necessarily use OOUI icons and is actually more out of scope for this task, but could be something to consider in the future)

SamanthaNguyen added a comment.EditedOct 15 2020, 6:05 AM

Switching to ResourceLoaderImageModule would slightly change behavior as they would have to be applied as a background image via the CSS background-image property.

To ensure we can keep the same behavior (for now), we should keep outputting the SVG files into the HTML DOM. We can parse an SVG string to a DOM tree, and then modify the attributes that way.

SamanthaNguyen triaged this task as Medium priority.Oct 17 2020, 4:15 PM