Lua-Modules icon indicating copy to clipboard operation
Lua-Modules copied to clipboard

feat(filterButtons): support template expansions

Open mbergen opened this issue 1 year ago • 4 comments

Summary

Adds the functionality for template expansion upon filter button change.

Usage: <div data-filter-expansion-template="TemplateName" data-filter-groups="group1,group2">Default content</div> will lead to wikitext of {{TemplateName|group1=options|group2=options}} where options is a comma-separated list of all active filters for that group.

How did you test this change?

http://darkrai.wiki.tldev.eu/rocketleague/User:SyntacticSalt/Test (http://darkrai.wiki.tldev.eu/commons/MediaWiki:Common.js/FilterButtons.js)

mbergen avatar Apr 30 '24 17:04 mbergen

Open questions:

  • [x] Should there be a specific behavior for "curated"? Currently, the filter options enabled before switching to "curated" will be used.
  • [x] My initial prototype (pre-refactor) tried to further reduce API calls by a) not expanding the template when the filter buttons are equivalent to the default filter button settings b) not expanding the template when perhaps only unrelated filter categories changed Do we want/need that again? - not implemented

mbergen avatar Apr 30 '24 17:04 mbergen

Will review tomorrow morning.

iMarbot avatar Apr 30 '24 17:04 iMarbot

Why the need for inversion of the logic?

iMarbot avatar May 04 '24 10:05 iMarbot

Why the need for inversion of the logic?

Was only needed for the curated part, reverted the rest

mbergen avatar May 04 '24 11:05 mbergen