Page MenuHomePhabricator

Vector should encapsulate code inside components
Closed, DuplicatePublic

Description

Most of Vector's code involves taking data from core and transforming it for Vector's templates. This code is currently distributed between SkinVector, SkinVector22 and SkinVectorLegacy classes.

The goal of this separation is to ideally create a system whereby we can transform the presentation of any menu (i.e from tabs to dropdown) without modifying the underlying data structure (whether or not this will actually work remains to be seen).

Going forward we think it would be better to organize code using templates

Benefits

  • Various component data is in the global scope making it harder to reason with templates and easier to break them. For example the input-location template value should be part of data-search-box but isn't.
  • Easier to upstream code from Vector to core and vice versa.
  • Component classes would match template names, making it easier to refer to the data a template has available.

GOALS

  • Removal of SkinVector class will fully isolate old and new Vector
  • Components will scope data to the component they serve
  • Components will provide a language more consistent with Vector's abstraction than MediaWiki core menu API

TODO

(In suggested sequenced order)

Developer notes

Rough proof of concept patches:

Event Timeline

Change 850293 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] [Components] Introduce VectorComponent and MainMenu components

https://gerrit.wikimedia.org/r/850293

Change 850293 merged by jenkins-bot:

[mediawiki/skins/Vector@master] [Components] Introduce VectorComponent and MainMenu components

https://gerrit.wikimedia.org/r/850293

Change 850197 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] [Template] Move search template code into component

https://gerrit.wikimedia.org/r/850197

Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: Mabualruz.
Jdlrobson updated the task description. (Show Details)

Change 850197 merged by jenkins-bot:

[mediawiki/skins/Vector@master] [Template] Move search template code into component

https://gerrit.wikimedia.org/r/850197

Change 865212 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Setup placeholder components to guide future development

https://gerrit.wikimedia.org/r/865212

Change 865212 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Setup placeholder components to guide future development

https://gerrit.wikimedia.org/r/865212

Change 865730 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Introduce UserLinks and LanguageButton components

https://gerrit.wikimedia.org/r/865730

Change 865730 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Introduce UserLinks and LanguageButton components

https://gerrit.wikimedia.org/r/865730