Add print logo
Logo cannot be displayed as a background image because it won't be
visible in print unless the user prints backgrounds too.
A sample configuration looks like this:
$wgVectorPrintLogo = [
'url' => 'https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg',
'width' => 174,
'height' => 27
];
The solution presented in the patch has a downside of not being able
to scale images down if their dimensions are bigger than the
dimensions specified in the config variable. For example, if we want
to go with an SVG image, then IE8 won't be able to render it.
Alternatively, if we want to go with a PNG image, its dimensions need
to match the exact dimensoins in the config variable, otherwise the
image will show up larger or smaller depending on its dimensions.
A more complicated approach of scaling images using `transform: scale`
hasn't been used because we wanted to keep the configuration simple
while supporting the majority of our users. With the current change,
we can reuse the existing configuration options from Minerva, for
exmaple. It would look something like this:
$wgVectorPrintLogo = [
'url' => $wgMFCustomLogos['copyright'],
'width' => $wgMFCustomLogos['copyright-width'],
'height' => $wgMFCustomLogos['copyright-height']
];
Bug: T169826
Change-Id: If8f9f8d95fd3c955ece37d6c8ab6995596189667
2017-07-19 19:27:55 +00:00
|
|
|
Vector Skin
|
|
|
|
========================
|
|
|
|
|
2020-02-05 05:32:22 +00:00
|
|
|
Installation
|
|
|
|
------------
|
Add print logo
Logo cannot be displayed as a background image because it won't be
visible in print unless the user prints backgrounds too.
A sample configuration looks like this:
$wgVectorPrintLogo = [
'url' => 'https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg',
'width' => 174,
'height' => 27
];
The solution presented in the patch has a downside of not being able
to scale images down if their dimensions are bigger than the
dimensions specified in the config variable. For example, if we want
to go with an SVG image, then IE8 won't be able to render it.
Alternatively, if we want to go with a PNG image, its dimensions need
to match the exact dimensoins in the config variable, otherwise the
image will show up larger or smaller depending on its dimensions.
A more complicated approach of scaling images using `transform: scale`
hasn't been used because we wanted to keep the configuration simple
while supporting the majority of our users. With the current change,
we can reuse the existing configuration options from Minerva, for
exmaple. It would look something like this:
$wgVectorPrintLogo = [
'url' => $wgMFCustomLogos['copyright'],
'width' => $wgMFCustomLogos['copyright-width'],
'height' => $wgMFCustomLogos['copyright-height']
];
Bug: T169826
Change-Id: If8f9f8d95fd3c955ece37d6c8ab6995596189667
2017-07-19 19:27:55 +00:00
|
|
|
|
[Special:Preferences] [PHP] Add skin version user preference and configs
Add a Vector-specific user preference to Special:Preferences for
toggling skin version, either Legacy Vector or the latest Vector.
The presentation of the new preference section and the default values
for anonymous, new, and existing accounts are configurable via
$wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by
the feature manager in T244481),
$wgVectorDefaultSkinVersionForExistingAccounts, and
$wgVectorDefaultSkinVersionForNewAccounts. These configurations default
to the fullest experience so that third-party configuration is minimal.
See skin.json for details. The configurations are each tested in
VectorHooksTest.php.
When presentation is enabled, the new preference appears as a checkbox;
enabled is Legacy mode and disable is latest. There are a number of
unfortunate details:
- Showing and hiding a checkbox is supported by OOUI. Showing and hiding
a whole section (Vector skin preferences, in this case) is not so this
additional client JavaScript functionality is added in Core (see
Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377).
- Stylization as a checkbox is wanted. However, the implied storage type
for OOUI checkboxes is a boolean. This is not wanted in the event that
another skin version is added (e.g., '3' or 'alpha'). As a workaround,
the preference is converted from a boolean to a version string ('1' or
'2') on save in Hooks::onPreferencesFormPreSave() and from a version
string to a checkbox enable / disable string ('1' or '0') in
onGetPreferences(). There a number of test cases to help cover these
concerning details.
Documentation for overriding the skin version as a URL query parameter
is provided in anticipation of T244481.
Bug: T242381
Bug: T245793
Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377
Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22
Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
|
|
|
See <https://www.mediawiki.org/wiki/Skin:Vector>.
|
|
|
|
|
|
|
|
### Configuration options
|
|
|
|
|
|
|
|
See [skin.json](skin.json).
|
2020-02-05 05:32:22 +00:00
|
|
|
|
|
|
|
Development
|
|
|
|
-----------
|
|
|
|
|
|
|
|
### Coding conventions
|
|
|
|
|
|
|
|
We strive for compliance with MediaWiki conventions:
|
|
|
|
|
|
|
|
<https://www.mediawiki.org/wiki/Manual:Coding_conventions>
|
|
|
|
|
|
|
|
Additions and deviations from those conventions that are more tailored to this
|
|
|
|
project are noted at:
|
|
|
|
|
|
|
|
<https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions>
|
[Special:Preferences] [PHP] Add skin version user preference and configs
Add a Vector-specific user preference to Special:Preferences for
toggling skin version, either Legacy Vector or the latest Vector.
The presentation of the new preference section and the default values
for anonymous, new, and existing accounts are configurable via
$wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by
the feature manager in T244481),
$wgVectorDefaultSkinVersionForExistingAccounts, and
$wgVectorDefaultSkinVersionForNewAccounts. These configurations default
to the fullest experience so that third-party configuration is minimal.
See skin.json for details. The configurations are each tested in
VectorHooksTest.php.
When presentation is enabled, the new preference appears as a checkbox;
enabled is Legacy mode and disable is latest. There are a number of
unfortunate details:
- Showing and hiding a checkbox is supported by OOUI. Showing and hiding
a whole section (Vector skin preferences, in this case) is not so this
additional client JavaScript functionality is added in Core (see
Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377).
- Stylization as a checkbox is wanted. However, the implied storage type
for OOUI checkboxes is a boolean. This is not wanted in the event that
another skin version is added (e.g., '3' or 'alpha'). As a workaround,
the preference is converted from a boolean to a version string ('1' or
'2') on save in Hooks::onPreferencesFormPreSave() and from a version
string to a checkbox enable / disable string ('1' or '0') in
onGetPreferences(). There a number of test cases to help cover these
concerning details.
Documentation for overriding the skin version as a URL query parameter
is provided in anticipation of T244481.
Bug: T242381
Bug: T245793
Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377
Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22
Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
|
|
|
|
|
|
|
URL query parameters
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
- `useskinversion`: Like `useskin` but for overriding the Vector skin version
|
2020-03-31 22:34:50 +00:00
|
|
|
user preference and configuration. E.g.,
|
|
|
|
http://localhost:8181?useskin=vector&useskinversion=2.
|
[Special:Preferences] [PHP] Add skin version user preference and configs
Add a Vector-specific user preference to Special:Preferences for
toggling skin version, either Legacy Vector or the latest Vector.
The presentation of the new preference section and the default values
for anonymous, new, and existing accounts are configurable via
$wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by
the feature manager in T244481),
$wgVectorDefaultSkinVersionForExistingAccounts, and
$wgVectorDefaultSkinVersionForNewAccounts. These configurations default
to the fullest experience so that third-party configuration is minimal.
See skin.json for details. The configurations are each tested in
VectorHooksTest.php.
When presentation is enabled, the new preference appears as a checkbox;
enabled is Legacy mode and disable is latest. There are a number of
unfortunate details:
- Showing and hiding a checkbox is supported by OOUI. Showing and hiding
a whole section (Vector skin preferences, in this case) is not so this
additional client JavaScript functionality is added in Core (see
Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377).
- Stylization as a checkbox is wanted. However, the implied storage type
for OOUI checkboxes is a boolean. This is not wanted in the event that
another skin version is added (e.g., '3' or 'alpha'). As a workaround,
the preference is converted from a boolean to a version string ('1' or
'2') on save in Hooks::onPreferencesFormPreSave() and from a version
string to a checkbox enable / disable string ('1' or '0') in
onGetPreferences(). There a number of test cases to help cover these
concerning details.
Documentation for overriding the skin version as a URL query parameter
is provided in anticipation of T244481.
Bug: T242381
Bug: T245793
Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377
Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22
Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-01-23 21:53:09 +00:00
|
|
|
|
|
|
|
Skin preferences
|
|
|
|
----------------
|
|
|
|
|
|
|
|
Vector defines skin-specific user preferences. These are exposed on
|
|
|
|
Special:Preferences when the `VectorShowSkinPreferences` configuration is
|
|
|
|
enabled. The user's preference state for skin preferences is used for skin
|
|
|
|
previews and any other operation unless specified otherwise.
|
|
|
|
|
|
|
|
### Version
|
|
|
|
|
|
|
|
Vector defines a "version" preference to enable users who prefer the December
|
|
|
|
2019 version of Vector to continue to do so without any visible changes. This
|
|
|
|
version is called "Legacy Vector." The related preference defaults are
|
|
|
|
configurable via the configurations prefixed with `VectorDefaultSkinVersion`.
|
|
|
|
Version preference and configuration may be overridden by the `useskinversion`
|
|
|
|
URL query parameter.
|
2020-04-28 15:24:24 +00:00
|
|
|
|
2020-07-31 02:53:19 +00:00
|
|
|
### Pre-commit tests
|
|
|
|
|
|
|
|
A pre-commit hook is installed when executing `npm install`. By default, it runs
|
|
|
|
`npm test` which is useful for automatically validating everything that can be
|
|
|
|
in a reasonable amount of time. If you wish to defer these tests to be executed
|
|
|
|
by continuous integration only, set the `PRE_COMMIT` environment variable to `0`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ export PRE_COMMIT=0
|
|
|
|
$ git commit
|
|
|
|
```
|
|
|
|
|
|
|
|
Or more succinctly:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ PRE_COMMIT=0 git commit
|
|
|
|
```
|
|
|
|
|
|
|
|
Skipping the pre-commit tests has no impact on Gerrit change identifier hooks.
|
|
|
|
|
2020-04-28 15:24:24 +00:00
|
|
|
### Hooks
|
|
|
|
See [hooks.txt](hooks.txt).
|