mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
1403217ca4
This commit includes several changes to make hashtags work when "lazy load categories" is enabled. The previous hashtag implementation use the category colors CSS variables, but these are not defined when the site setting is enabled because categories are no longer preloaded. This commit implements two fundamental changes: 1. load colors together with the other hashtag information 2. load cooked hashtag data asynchronously The first change is implemented by adding "colors" to the HashtagItem model. It is a list because two colors are returned for subcategories: the color of the parent category and subcategory. The second change is implemented on the server-side in a new route /hashtags/by-ids and on the client side by loading previously unseen hashtags, generating the CSS on the fly and injecting it into the page. There have been minimal changes outside of these two fundamental ones, but a refactoring will be coming soon to reuse as much of the code and maybe favor use of `style` rather than injecting CSS into the page, which can lead to page rerenders and indefinite grow of the styles. |
||
---|---|---|
.. | ||
helpers_spec.rb |