mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Editcount
synced 2024-11-27 09:42:28 +00:00
Migrate to wikitable table class for table output
This extension previously used a custom table design that did not align with the MediaWiki CSS style for tables. This change almost entirely rewrites the table implementation to use the wikitable class, as well as enhances the readability of the table by using proper table headings and moves the total number edits row to the bottom of the table. While the existing TODO for inline styles was not entirely followed, using the "text-align:center;" CSS property helps, in my mind, improve the readability of the table, to the point where I feel that the TODO can still be removed. Translation strings have been added to reflect the additional strings, and I have additionally added myself to the authors array for both the extension information file and the English translation file. Another change was made as well where I added an output message before the OOUI form displaying a short description as to what the extension does, thereby making it easier for users who stumble across this extension to understand what exactly it does. Change-Id: I0d4465b14f0de6425dafdcd52e16e14bb04a0541
This commit is contained in:
parent
46d0c06b31
commit
e5657bc299
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Editcount",
|
||||
"author": "Ævar Arnfjörð Bjarmason",
|
||||
"author": [
|
||||
"Ævar Arnfjörð Bjarmason",
|
||||
"[[mw:User:Evelyn Marie|Evelyn Marie]]"
|
||||
],
|
||||
"url": "https://www.mediawiki.org/wiki/Extension:Editcount",
|
||||
"descriptionmsg": "editcount-desc",
|
||||
"license-name": "GPL-2.0-or-later",
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Rob Church"
|
||||
"Rob Church",
|
||||
"Evelyn Marie"
|
||||
]
|
||||
},
|
||||
"editcount": "Edit count",
|
||||
"editcount-desc": "Displays [[Special:Editcount|edit count]] of a user",
|
||||
"editcount-desc": "Displays a given user's [[Special:Editcount|edit count]]",
|
||||
"editcount-before": "This tool allows you to view a given user's edit count across all namespaces.",
|
||||
"editcount_username": "User:",
|
||||
"editcount_submit": "Submit",
|
||||
"editcount_namespace": "Namespace",
|
||||
"editcount_edits": "Edits",
|
||||
"editcount_percentage": "Percentage",
|
||||
"editcount_total": "Total"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
},
|
||||
"editcount": "{{doc-special|Editcount}}",
|
||||
"editcount-desc": "{{desc|name=EditCountNeue|url=https://www.mediawiki.org/wiki/Extension:EditCountNeue}}",
|
||||
"editcount-before": "This tool allows you to view a given user's edit count across all namespaces.",
|
||||
"editcount_username": "{{Identical|User}}",
|
||||
"editcount_submit": "{{Identical|Submit}}",
|
||||
"editcount_namespace": "{{Identical|Namespace}}",
|
||||
"editcount_edits": "{{Identical|Edits}}",
|
||||
"editcount_percentage": "{{Identical|Percentage}}",
|
||||
"editcount_total": "{{Identical|Total}}"
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ class Editcount extends IncludableSpecialPage {
|
|||
|
||||
list( $username, $namespace ) = $this->extractParameters( $target );
|
||||
$this->getOutput()->enableOOUI();
|
||||
$this->getOutput()->addWikiMsg( 'editcount-before' );
|
||||
|
||||
$user = User::newFromName( $username );
|
||||
$username = $user ? $user->getName() : '';
|
||||
|
|
|
@ -64,14 +64,16 @@ class EditcountHTML extends Editcount {
|
|||
$lang = $this->getLanguage();
|
||||
|
||||
$total = $this->msg( 'editcount_total' )->escaped();
|
||||
$namespace = $this->msg( 'editcount_namespace' )->escaped();
|
||||
$edits = $this->msg( 'editcount_edits' )->escaped();
|
||||
$percentage = $this->msg( 'editcount_percentage' )->escaped();
|
||||
$ftotal = $lang->formatNum( $this->total );
|
||||
$percent = wfPercent( $this->total ? 100 : 0 );
|
||||
// @fixme don't use inline styles
|
||||
$ret = "<table border='1' style='background-color: #fff; border: 1px #aaa solid; border-collapse: collapse;'>
|
||||
|
||||
$ret = "<table class='wikitable' style='text-align:center;'>
|
||||
<tr>
|
||||
<th>$total</th>
|
||||
<th>$ftotal</th>
|
||||
<th>$percent</th>
|
||||
<th>$namespace</th>
|
||||
<th>$edits</th>
|
||||
<th>$percentage</th>
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
@ -88,6 +90,17 @@ class EditcountHTML extends Editcount {
|
|||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
$percent = wfPercent( $this->total ? 100 : 0 );
|
||||
|
||||
$ret .= "
|
||||
<tr>
|
||||
<th>$total</th>
|
||||
<td>$ftotal</th>
|
||||
<td>$percent</th>
|
||||
</tr>
|
||||
";
|
||||
|
||||
$ret .= '</table>
|
||||
';
|
||||
|
||||
|
|
Loading…
Reference in a new issue