Requests for comment/Custom inter-namespace tabs

From MediaWiki.org
Jump to: navigation, search
General2012-11-17MZMcBride, Wizardist13228completeneeds review
Request for comment
Custom inter-namespace tabs
Component General
Creation date 2012-11-17
Author(s) MZMcBride, Wizardist
Bug number 13228
Document status complete
Implementation status needs review

This is a request for comment about adding custom inter-namespace tabs (bugzilla:13228).

Background[edit | edit source]

Certain wikis currently have an additional namespace tied to the classic (and traditional) article–talk combination. For example, on the English Wikinews, there's a third tab for "Opinions" which leads to a corresponding page in the Comments namespace.

The current implementation has issues, namely:

  • it's in JavaScript (n:MediaWiki:Comments.js) which means that
    • it's available only to JavaScript-enabled browsers;
    • it's doing an extra AJAX request for tab color; and
    • it's a pain in the ass to localize and customize per project.

Use-cases[edit | edit source]

  • "Opinions" tab for the Comments namespace on the English Wikinews
  • "Citations" tab for the Citations: namespace alongside the ns:0 and Talk namespaces on English Wiktionary

Considerations[edit | edit source]

  • Put code in a MediaWiki extension or in core???
  • Localizable tab name
  • Configurable in LocalSettings.php with an array or something?
  • Tab has to account for page existence

Plan[edit | edit source]

The considerations above need to be resolved. Once they have been, this should no more than an hour's worth of coding time, I think. It'll be much more time trying to get the code reviewed and deployed than it will be the write the damn feature.

There's code at User:Svippong/AdditionalTabs and at <https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/CommentPages.git;a=summary>, also #37569. Given changes to MediaWiki, however, it may make sense to start from scratch. Again, it depends how this is going to be implemented (extension or in core).

Implementations[edit | edit source]

JavaScript[edit | edit source]

Code base: n:MediaWiki:Comments.js.

Pros:

  • no need to mess with server-side

Cons:

  • available only to JavaScript-enabled browsers
  • inconfigurable
  • excessive API requests
  • inconsistent localization

Status:    Deployed at production

Core[edit | edit source]

Patch-set: I14351aa5.

Pros:

  • localizable

Cons:

  • configuration in MediaWiki namespace
  • hackish implementation & redundant core feature
  • doesn't cover JavaScript implementation

Status:    Abandoned in Gerrit

Extension[edit | edit source]

See documentation: Extension:NamespaceRelations.

Features:

  • localizable
  • multiple custom tabs per Subject
  • allows to decide whether to show tab on Main Page (if attached to Main namespace)
  • additional query params attached for red-link tabs
  • tab sorting (e.g. Opinions|Article|Talk)
  • allows to hide Talk tab

Status:    Waiting for code review