Commit graph

7 commits

Author SHA1 Message Date
Bartosz Dziewoński
cfd6ffe7bb Introduce PagerNavigationBuilder for making pagination links
We had several implementations of almost identical paging links:

* PrevNextNavigationRenderer: The nicest one, somewhat recently added
  (4ca72763ec). Unfortunately it was also the least featureful: only
  supporting paging by numeric offset and not by index, and not able
  to generate "first"/"last" links. Also, I didn't realize that it
  exists when working on 94553a1bcb and b95d208340, so it was missing
  those changes too.

* IndexPager/ReverseChronologicalPager/AlphabeticPager: These have
  been here forever. The most featureful, but not configurable, so
  a large part of the implementation was copy-pasted in two classes.

* SpecialWhatLinksHere: Through some accident of history, this one
  special page ended up with its own implementation???

They are all replaced to use the new PagerNavigationBuilder.
It may be slightly too much, but I had fun writing it.

Notable changes compared to PrevNextNavigationRenderer:
* Adds <div class="mw-pager-navigation-bar"> wrapper around the
  navigation and <span class="…"> wrappers on inactive links
* The current limit link is made inactive
  (like the "prev" link when on first page, etc.)

Notable changes compared to ...Pager/...Pager/...Pager:
* Does not generate useless tooltips that contain only the
  title of the page, can use custom tooltips
* The current limit link is made inactive
  (like the "prev" link when on first page, etc.)
* All links have query parameters in a consistent order:
  ?title= &... &dir= &offset= &limit= (some of them are optional)

These changes affect many special pages and actions. I tested on:
* Special:Contributions (ReverseChronologicalPager)
* action=history (ReverseChronologicalPager)
* Special:Categories (AlphabeticPager)
* Special:WantedPages (PrevNextNavigationRenderer)
* Special:Search (PrevNextNavigationRenderer)
* Special:WhatLinksHere

Bug: T308364
Change-Id: Ic75bd597b210e14612ca3aebb531b659897e8294
2022-09-05 16:10:36 -04:00
C. Scott Ananian
35cb2e524b tests: don't assume wgLanguageCode is 'en'
Change-Id: Ic748489309a1c8ff0f916b3f55aacc93ca128ea3
2022-07-21 19:32:41 -04:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
Daimona Eaytoy
f5529400cc Stop using assertContains with string haystack
This was done automatically by replacing every assertContains with
string *needle*. Then verifying the results.

Bug: T192167
Change-Id: Id8cbbf3b01e948f80046714183cc299f86be21fd
2019-12-15 00:22:44 +00:00
Aryeh Gregor
0de9c47b50 Remove Language::factory and getParentLanguage use
Change-Id: I11f8801ef47ec1a1f63d840116e69667e6f3ae3c
2019-10-27 12:34:28 +02:00
clarakosi
4ca72763ec Refactor buildPrevNextNavigation
Refactored buildPrevNextNavigation() into standalone helper class,
PrevNextNavigationRenderer, to be used by both SpecialPages and Pagers.

Bug:T207977
Change-Id: Ic49837a451f795ec203e867961ec1c69075cc91a
2019-06-05 19:32:27 -04:00