Commit graph

40 commits

Author SHA1 Message Date
polishdeveloper efe0ec6356 Deprecation: Deprecate Vector specific hooks
Vector provides two vector specific hooks:
 - VectorAfterToolbox
 - VectorBeforeToolbox

Instead of supporting Vector specific stuff we should aim
for a nice global skin api and allow other 3rd party to
extend MediaWiki functionality no matter which skin is currently
on.

Bug: T240062
Change-Id: I245f1316e79f814ba04f4e0a0223d4f0596cf39e
2020-01-24 16:20:50 +00:00
jdlrobson 80b5ccc634 Dev: Break Footer out into template
Add a new Footer template for modelling the footer of
Vector.

Bug: T240062
Change-Id: I60a243abeb5650542ca6f6fac8401a622faaabac
2020-01-17 13:10:37 -08:00
jdlrobson 9f82f58ea9 Dev: Include closed body and html tags in getTrail
This will allow us to render in Storybook without having issues
with unclosed tags. it also mirrors how html-headelement works
(obscuring the opening of the body and html tags)

Bug: T240062
Bug: T242674
Change-Id: I216a920c68bf3da9de55a75fc53451c68c9cc753
2020-01-17 19:16:32 +00:00
jenkins-bot 4ce1e8c1f2 Merge "SkinTemplateToolboxEnd hook output not displaying in Vector" 2020-01-14 22:58:53 +00:00
jdlrobson f416e21bc5 SkinTemplateToolboxEnd hook output not displaying in Vector
Broken in I882db161e5462cf88aa48c9cfd91448eb97a4a77

Bug: T240062
Change-Id: I94bbf79c6c2743a5769935287593aa48780bfb71
2020-01-14 14:37:12 -08:00
jenkins-bot f1aaa1ec91 Merge "Replaces $user->isWatching call with WatchedItemStore isWatching service call" 2020-01-14 22:30:09 +00:00
Jan Drewniak 361e0d6f71 Extract Portal mustache component from VectorTemplate.php
A Portal (or portlet) in the Vector context is a section of the
sidebar menu (e.g. Tools, Languges etc.).

The hook that places content between the portals (or portlets?)
such as `SkinTemplateToolboxEnd` and `otherlanguages` has been
enclosed inside of an output buffer so that any content it
produces can be passed to a template.

Bug: T239248, T240062
Change-Id: I882db161e5462cf88aa48c9cfd91448eb97a4a77
2020-01-14 22:44:58 +01:00
Jan Drewniak 093cc20ee0 Extract VectorMenu.mustache component from VectorTemplate
Extracts a new VectorMenu mustache component from VectorTemplate.
VectorMenu is the "more" menu that appears at small widths instead of the
Read/Edit/View History menu near the top of the Vector skin.

Bug: T239248, T240062
Change-Id: I41b1ec949d81303abddadb981741445572c939e3
2020-01-14 10:38:46 -08:00
jenkins-bot 68af887faf Merge "Convert $templateParser in VectorTemplate.php into an instance variable" 2020-01-13 19:37:56 +00:00
Jan Drewniak a706618a9d Convert $templateParser in VectorTemplate.php into an instance variable
Change-Id: Iaebfaefdd0722d1e63cb73585e0148f54fcdd77e
2020-01-13 15:40:57 +01:00
libraryupgrader b1978d572f build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Change-Id: I336d23b2d322d1ae1a4c3101e69088c11eb9f43c
2020-01-13 06:06:46 +00:00
Jan Drewniak d29adb5dcc Fix uerlangattributes echoing output from PersonalMenu component
Followup to 4f471bfa5e

Bug: T240062
Change-Id: I13c099befc98b42f28e58a669df495b9324190f4
2020-01-10 13:15:17 +01:00
Vedmaka 2fce68778c Replaces $user->isWatching call with WatchedItemStore isWatching service call
Bug: T208766
Change-Id: I178b1a1aa0106d82f1b336f2bda5c6371468d741
2020-01-09 21:50:40 +00:00
Jan Drewniak 4f471bfa5e Extract PersonalMenu,mustache component from VectorTemplate
PersonalMenu is the login/logout notifications etc. menu at the very
top of the Vector skin.

Bug: T239248, T240062
Change-Id: Iae224cbd838e44669a9f27e6dd303c6c3b402d41
2020-01-09 16:01:46 +01:00
libraryupgrader cfe2ff0864 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.

Add check for unset 'class' attribute.

Change-Id: Ib5b8993e89f4cb8f2f5325cbbc1e02401dd19d81
2019-12-22 20:11:34 +01:00
Stephen Niedzielski 9d427dcb30 [Hygiene] [Mustache] rename SearchComponent to SearchBox
For consistency with VectorTabs, rename SearchComponent to only imply
component. At least two word names seems like a good target (instead of
just "Search") for grepability and standard component style conventions.

Bug: T239248
Change-Id: I1e4f7270ba29c2f35f08e92f8a28cd8a2ec8fe87
2019-12-06 17:00:42 -07:00
Stephen Niedzielski 60148a1a92 [Hygiene] [Mustache] improve template parameters and docs
Add typing expectations to search box template parameters. Add context
expectations to search box and tabs templates.

Bug: T239248
Change-Id: I4ff1920f5489b68ef73a219ceeceb1f5511fc9e8
2019-12-06 17:00:42 -07:00
Stephen Niedzielski e0b29624d1 Fix: tab attributes
The tab attributes were mistakenly being echoed instead of passed by
value. E.g., http://localhost:8181/wiki/A?uselang=he.

Bug: T239248
Change-Id: Ia0af96df717948743a2d66f8432b47e6f8a9c8f1
2019-12-06 17:00:39 -07:00
Jan Drewniak c12c5f06db Move namespace & view tabs into a VectorTabs.mustache component
Creates a new VectorTabs.mustache component and uses it to render
the namespace & view tabs.

Bug: T239248
Change-Id: I859e4e95a2a12470f66564db547679c9f0a16727
2019-12-04 15:51:02 +01:00
Stephen Niedzielski d6f4aaa88e Hygiene: extract VectorTemplate inline HTML to SearchComponent Mustache file
Extract SearchComponent.mustache from VectorTemplate. The "search"
message is now escaped by the template parser. As is, htmlspecialchars()
for "wgScript".

A later patch will change each component renderer function as well as
renderNavigation() to return a string.

Change-Id: I3084b7e0ef73d320c85ee780c9eff13ecea92906
2019-11-20 16:41:05 -05:00
Stephen Niedzielski c9f15a4206 Hygiene: move VectorTemplate inlined PHP to variables
Move template logic outside of the template and into variables. This
will allow a future refactor to move the template to a separate
template-only file.

Change-Id: I91c2df11106cf09428a890a2d96ecbddb18ef0fe
2019-11-20 16:35:04 -05:00
Stephen Niedzielski 625ec18f81 Hygiene: divide VectorTemplate.renderNavigation()
Cut up renderNavigation() into several discrete methods. Smaller methods
are easier to read and reason about.

Change-Id: I4e55d858ab1745fb2baddef02f7046ec842eb149
2019-11-18 15:26:20 -05:00
Timo Tijhof a5fe72696b Remove extra <span> from Vector tabs
No longer needed as of I8237976e0587.

Bug: T236410
Change-Id: I5a59c136de4572e5f11b52cc11bc93251c972369
2019-10-25 15:22:57 +00:00
Simon Legner 6b99f35cbe Cleaning a[redundant] is done in BaseTemplate
Relates to I630410aea2852f7a72fea67bbf256b3561ea0f3f.

Change-Id: I0e0ccad14236dfbfc82f38e8e4316a431dd38d7a
2019-08-21 18:03:47 +00:00
Timo Tijhof d56792addb Fix <h1> to be present even if title is "0"
Regression from 74b9803d9a, caused by a bug in LightNCandy which
caused {{foo}} to render "0", and {{#foo}} to pass as true with "0", but then
in {{#foo}}<b>{{foo}}</b>{{/foo} render as empty string producing "<b></b>".
In other words, the conditional is passing and the inner block is executed,
but the placeholder is mistakenly converting "0" => null => "" (empty string),
causing the <h1> to render but without any text in it.

Work around this bug by simply removing the conditional. Several other skins
already don't have this conditional and it's unclear why or in what
situation MediaWiki would send OutputPage to SkinTemplate without a title.

I think it would make sense in such rare case to still have a consistent
layout for extensions and gadgets to interact with and not omit the H1
element, but render it with the value that OutputPage gave it, even if it
is the empty string.

Bug: T219864
Change-Id: I6e04b512d2fe2e949ff5385cb38ceebe392fb255
2019-04-02 19:47:38 +01:00
Jdlrobson 74b9803d9a Start extracting rendering from PHP into Mustache
This reverts commit 8d0377d926
now a conversation has happened.

Bug: T217172
Change-Id: Id51bbd4358bdcc1131c11e13d5548e9c0474e711
2019-03-05 13:22:24 +00:00
Isarra 8d0377d926 Revert "Start extracting rendering from PHP into Mustache"
This reverts commit a3ca2c3e16.

Reason for revert: This requires wider discussion before moving
forward, and a more complete implementation even once we do have
consensus.

No associated task exists on which to view or continue this
discussion: linked task briefly mentions Mustache in general as an
option as part of a much wider topic, but doesn't concern this
specifically.

Issues that should be discussed include:
* What the intent even is here: is this for one skin only? Is this
  the intended path forward for all of them? Depending on which, we
  have other issues: for the former case, that it is quite
  unhelpful in terms of maintenance and further development having
  more random code diversity out there, especially in this
  half-completed state; or if it is indeed intended for all of them,
  that an RfC is needed before anything is merged, as that is a very
  significant change.
* That using Mustache in MediaWiki does add (usually minor)
  performance overhead; we need to clearly establish in the task that
  this is indeed worth it here.

Change-Id: I0bafa55b554aa8a38553e20c75859ec5eec2c062
2019-01-28 16:49:48 +00:00
Timo Tijhof d306e07824 template: Avoid raw HTML parameter for jump link labels
Change-Id: I6c638118988b6fbea95697817edf8c59c0ef6a6b
2019-01-22 21:13:05 -08:00
Timo Tijhof 9cc0ca983c template: Remove is_callable check for getIndicators()
The VectorTemplate class extends BaseTemplate, which has defined
this method since MW 1.25. The Vector skin master branch supports
MW 1.29+ only.

Change-Id: I83c6add9e8c02df028ca5905934e7d367dbe2209
2019-01-22 21:13:05 -08:00
Timo Tijhof a3ca2c3e16 Start extracting rendering from PHP into Mustache
Bug: T140664
Change-Id: I249fead8e1c7bc5dc295457bd46b05e7ed389414
2019-01-22 21:13:05 -08:00
Fomafix c68a21e78a Remove space before Xml::expandAttributes()
Xml::expandAttributes() outputs a space at the beginning before it
outputs the attributs.
This change avoids a double space between the attributes.

Before this change the HTML contains:

  <a class="mw-wiki-logo" href="..."  title="...">

After this change the HTML contains:

  <a class="mw-wiki-logo" href="..." title="...">

Change-Id: I486d26bd56a4410766f40b78466c2f3559f3a1ff
2019-01-14 06:46:33 +01:00
Fomafix 82cbdb8111 Avoid empty class="" without value
Before this change the HTML contains:

<div id="p-personal" role="navigation" class="" ...>
or
<div id="p-personal" role="navigation" class=" emptyPortlet" ...>

After this change the HTML contains:

<div id="p-personal" role="navigation" ...>
or
<div id="p-personal" role="navigation" class="emptyPortlet" ...>

Change-Id: Ic686b958940afc958693d0031ac31e5f783960a9
2019-01-13 20:02:01 +01:00
Volker E da6d4eb280 Remove unnecessary div wrapper on overflow menu
Unordered lists can be absolute positioned down to IE 7.
Outdated selector `.vectorMenu ul` remains for a release cycle
until HTML cache is renewed.

Bug: T209558
Change-Id: Id18ca9a8d705572b1f7e17920ef52b80e9aec373
2018-11-14 20:41:08 -08:00
jenkins-bot 7fd98697f1 Merge "Let Html::element do the output encoding" 2018-06-12 19:52:25 +00:00
Fomafix eccd074386 Let Html::element do the output encoding
Change-Id: I07913d3cd1851df06de912a0257b01a5fae7c125
2018-06-12 16:56:24 +02:00
Fomafix 44fd986540 Use $this->getMsg instead of wfMessage
Change-Id: Ief31c2d9037b5786657507e28ae75b6e467cccb4
2018-06-12 16:39:57 +02:00
Timo Tijhof b843094a2d Re-implement and improve mw-jump links with pure CSS
* Improve their accessibility by giving both links
  a full label "Jump to x" and "Jump to y" instead
  of "Jump to: ", "x", "y".

  This also makes things much better for localisation, for which
  we generally discourage use of concatenation.

* Use pure CSS for the toggling of the visibility on focus,
  instead of relying on JavaScript. Especially given the
  JS comes form core's 'jquery.mw-jump' module, which is
  considered technical debt per T195256. Alternatively,
  that could be copied to vector.js, but pure CSS
  is possible, so why not.

* Use plain <a> links in the HTML instead of wrapped in a <div>.
  This solves the long-standing problem whereby the margin
  between #contentSub and #mw-content-text had to be awkwardly
  negated and overridden in core and on various to make sure that
  the wrapper itself would become visible as needed, in a way that
  has margin around this. This whole problem doesn't apply when
  simply using inline links that aren't part of the regular flow
  with .mixin-screen-reader-text. On focus, the individually
  focussed link appears in regular flow, without the need for
  any custom styles.

* This uses :not(:focus) to naturally make it render in the default
  way on focus, and visibibly hidden/clipped otherwise.
  This is supported in IE9+ and Android 2+.
  There is a way to make it work with CSS2 for IE7-8, by applying
  the mixin to '.mw-jump-link' only and then undoing all of
  'position', 'width', 'height', 'clip', and 'margin' on :focus.
  But I'm not sure that's worth it here. The fallback in IE7-8
  for not supporting ":not(:focus)" is that the accessibility
  link is simply visible always, which seems like a good fallback
  for accessibility, and doesn't hurt anything.

Bug: T195256
Change-Id: Icaadb290f692b3617688d32cbb66dfb007f1c82c
2018-05-24 00:08:02 +00:00
Max Semenik eb145c8ce4 Don't use deprecated Sanitizer::escapeId()
Change-Id: I96354291594f1fcb8a263318e93fd1c059aa006d
2018-04-13 16:30:27 -07:00
Isarra b473ce1ff6 Remove unnecessary $portals['SEARCH'] = true;
Search is skipped in the sidebar 20 lines down regardless. This does
nothing.

Change-Id: If6d3dd21280211fa3511ce010a3f3fda6185a7ef
2018-03-17 18:50:55 +00:00
Timo Tijhof 2fa3b7f69a Move class files to includes/
Cleans up the top-level directory a bit.

Change-Id: I29d3b8b7098def77e643232a386d8ba834d35704
2018-03-12 16:52:48 -07:00
Renamed from VectorTemplate.php (Browse further)