jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/361026 )
Change subject: Convert rest of Special:Undelete to OOUI
......................................................................
Convert rest of Special:Undelete to OOUI
Also fix the 'invert selection' button:
* Don't use type=submit so it doesn't try to post
if JS is disabled
* Don't invert the wpUnsuppress checkbox, just
checkboxes in revision lists.
Bug: T113758
Change-Id: I84785a5ddcc3343d74b5b7addb4aa4817a469f33
---
M includes/specials/SpecialUndelete.php
M resources/src/mediawiki.special/mediawiki.special.undelete.js
2 files changed, 94 insertions(+), 68 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/includes/specials/SpecialUndelete.php
b/includes/specials/SpecialUndelete.php
index 8a59773..e6e9400 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -715,11 +715,11 @@
if ( $this->mAllowed ) {
$action = $this->getPageTitle()->getLocalURL( [
'action' => 'submit' ] );
# Start the form here
- $top = Xml::openElement(
- 'form',
- [ 'method' => 'post', 'action' => $action, 'id'
=> 'undelete' ]
- );
- $out->addHTML( $top );
+ $form = new OOUI\FormLayout( [
+ 'method' => 'post',
+ 'action' => $action,
+ 'id' => 'undelete',
+ ] );
}
# Show relevant lines from the deletion log:
@@ -734,68 +734,91 @@
}
if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
- # Format the user-visible controls (comment field,
submission button)
- # in a nice little table
+ $out->enableOOUI();
+
+ $fields[] = new OOUI\Layout( [
+ 'content' => new OOUI\HtmlSnippet( $this->msg(
'undeleteextrahelp' )->parseAsBlock() )
+ ] );
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\TextInputWidget( [
+ 'name' => 'wpComment',
+ 'inputId' => 'wpComment',
+ 'infusable' => true,
+ 'value' => $this->mComment,
+ 'autofocus' => true,
+ ] ),
+ [
+ 'label' => $this->msg(
'undeletecomment' )->text(),
+ 'align' => 'top',
+ ]
+ );
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\Widget( [
+ 'content' => new OOUI\HorizontalLayout(
[
+ 'items' => [
+ new
OOUI\ButtonInputWidget( [
+ 'name' =>
'restore',
+ 'inputId' =>
'mw-undelete-submit',
+ 'value' => '1',
+ 'label' =>
$this->msg( 'undeletebtn' )->text(),
+ 'flags' => [
'primary', 'progressive' ],
+ 'type' =>
'submit',
+ ] ),
+ new
OOUI\ButtonInputWidget( [
+ 'name' =>
'invert',
+ 'inputId' =>
'mw-undelete-invert',
+ 'value' => '1',
+ 'label' =>
$this->msg( 'undeleteinvert' )->text()
+ ] ),
+ ]
+ ] )
+ ] )
+ );
+
if ( $this->getUser()->isAllowed( 'suppressrevision' )
) {
- $unsuppressBox =
- "<tr>
- <td> </td>
- <td class='mw-input'>" .
- Xml::checkLabel( $this->msg(
'revdelete-unsuppress' )->text(),
- 'wpUnsuppress',
'mw-undelete-unsuppress', $this->mUnsuppress ) .
- "</td>
- </tr>";
- } else {
- $unsuppressBox = '';
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\CheckboxInputWidget( [
+ 'name' => 'wpUnsuppress',
+ 'inputId' =>
'mw-undelete-unsuppress',
+ 'value' => '1',
+ ] ),
+ [
+ 'label' => $this->msg(
'revdelete-unsuppress' )->text(),
+ 'align' => 'inline',
+ ]
+ );
}
- $table = Xml::fieldset( $this->msg(
'undelete-fieldset-title' )->text() ) .
- Xml::openElement( 'table', [ 'id' =>
'mw-undelete-table' ] ) .
- "<tr>
- <td colspan='2'
class='mw-undelete-extrahelp'>" .
- $this->msg( 'undeleteextrahelp'
)->parseAsBlock() .
- "</td>
- </tr>
- <tr>
- <td class='mw-label'>" .
- Xml::label( $this->msg( 'undeletecomment'
)->text(), 'wpComment' ) .
- "</td>
- <td class='mw-input'>" .
- Xml::input(
- 'wpComment',
- 50,
- $this->mComment,
- [ 'id' => 'wpComment', 'autofocus' =>
'' ]
- ) .
- "</td>
- </tr>
- <tr>
- <td> </td>
- <td class='mw-submit'>" .
- Xml::submitButton(
- $this->msg( 'undeletebtn' )->text(),
- [ 'name' => 'restore', 'id' =>
'mw-undelete-submit' ]
- ) . ' ' .
- Xml::submitButton(
- $this->msg( 'undeleteinvert' )->text(),
- [ 'name' => 'invert', 'id' =>
'mw-undelete-invert' ]
- ) .
- "</td>
- </tr>" .
- $unsuppressBox .
- Xml::closeElement( 'table' ) .
- Xml::closeElement( 'fieldset' );
+ $fieldset = new OOUI\FieldsetLayout( [
+ 'label' => $this->msg(
'undelete-fieldset-title' )->text(),
+ 'id' => 'mw-undelete-table',
+ 'items' => $fields,
+ ] );
- $out->addHTML( $table );
+ $form->appendContent(
+ new OOUI\PanelLayout( [
+ 'expanded' => false,
+ 'padded' => true,
+ 'framed' => true,
+ 'content' => $fieldset,
+ ] ),
+ new OOUI\HtmlSnippet(
+ Html::hidden( 'target', $this->mTarget
) .
+ Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() )
+ )
+ );
}
- $out->addHTML( Xml::element( 'h2', null, $this->msg( 'history'
)->text() ) . "\n" );
+ $history = '';
+ $history .= Xml::element( 'h2', null, $this->msg( 'history'
)->text() ) . "\n";
if ( $haveRevisions ) {
# Show the page's stored (deleted) history
if ( $this->getUser()->isAllowed( 'deleterevision' ) ) {
- $out->addHTML( Html::element(
+ $history .= Html::element(
'button',
[
'name' => 'revdel',
@@ -803,31 +826,31 @@
'class' =>
'deleterevision-log-submit mw-log-deleterevision-button'
],
$this->msg( 'showhideselectedversions'
)->text()
- ) . "\n" );
+ ) . "\n";
}
- $out->addHTML( '<ul>' );
+ $history .= '<ul class="mw-undelete-revlist">';
$remaining = $revisions->numRows();
$earliestLiveTime =
$this->mTargetObj->getEarliestRevTime();
foreach ( $revisions as $row ) {
$remaining--;
- $out->addHTML( $this->formatRevisionRow( $row,
$earliestLiveTime, $remaining ) );
+ $history .= $this->formatRevisionRow( $row,
$earliestLiveTime, $remaining );
}
$revisions->free();
- $out->addHTML( '</ul>' );
+ $history .= '</ul>';
} else {
$out->addWikiMsg( 'nohistory' );
}
if ( $haveFiles ) {
- $out->addHTML( Xml::element( 'h2', null, $this->msg(
'filehist' )->text() ) . "\n" );
- $out->addHTML( '<ul>' );
+ $history .= Xml::element( 'h2', null, $this->msg(
'filehist' )->text() ) . "\n";
+ $history .= '<ul class="mw-undelete-revlist">';
foreach ( $files as $row ) {
- $out->addHTML( $this->formatFileRow( $row ) );
+ $history .= $this->formatFileRow( $row );
}
$files->free();
- $out->addHTML( '</ul>' );
+ $history .= '</ul>';
}
if ( $this->mAllowed ) {
@@ -835,9 +858,13 @@
$misc = Html::hidden( 'target', $this->mTarget );
$misc .= Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() );
$misc .= Xml::closeElement( 'form' );
- $out->addHTML( $misc );
+ $history .= $misc;
}
+ $form->appendContent( new OOUI\HtmlSnippet( $history ) );
+
+ $out->addHTML( $form );
+
return true;
}
diff --git a/resources/src/mediawiki.special/mediawiki.special.undelete.js
b/resources/src/mediawiki.special/mediawiki.special.undelete.js
index 2a153e8..4629d57 100644
--- a/resources/src/mediawiki.special/mediawiki.special.undelete.js
+++ b/resources/src/mediawiki.special/mediawiki.special.undelete.js
@@ -2,10 +2,9 @@
* JavaScript for Special:Undelete
*/
jQuery( function ( $ ) {
- $( '#mw-undelete-invert' ).click( function ( e ) {
- $( '#undelete input[type="checkbox"]' ).prop( 'checked',
function ( i, val ) {
+ $( '#mw-undelete-invert' ).click( function () {
+ $( '.mw-undelete-revlist input[type="checkbox"]' ).prop(
'checked', function ( i, val ) {
return !val;
} );
- e.preventDefault();
} );
} );
--
To view, visit https://gerrit.wikimedia.org/r/361026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I84785a5ddcc3343d74b5b7addb4aa4817a469f33
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits