jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/359906 )
Change subject: Improve layout of special page
..
Improve layout of special page
- Use OO.ui.
- Remove the width limitation, which is not present on similar special
pages (Special:NewItem, Special:SetLabel, …).
- Change the two explanation divs with a line break between them to a
single explanation div containing two paragraphs.
Change-Id: I1273d183621f0a11aa49a0fd54303a87faa81481
---
M modules/SpecialConstraintReportPage.css
M specials/SpecialConstraintReport.php
M tests/phpunit/Specials/SpecialConstraintReportTest.php
3 files changed, 27 insertions(+), 28 deletions(-)
Approvals:
Jonas Kress (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/SpecialConstraintReportPage.css
b/modules/SpecialConstraintReportPage.css
index efe4657..faf0d85 100644
--- a/modules/SpecialConstraintReportPage.css
+++ b/modules/SpecialConstraintReportPage.css
@@ -1,11 +1,6 @@
/* Entity id form */
form {
margin-bottom: 20px;
- width: 250px;
-}
-
-.wbqc-constraintreport-form-entity-id {
- width: 120px;
}
/* Notices */
@@ -16,11 +11,6 @@
.wbqc-constraintreport-notice-error {
font-weight: bold;
color: #ba;
-}
-
-/* Explanation infobox */
-.wbqc-explanation {
- width: 50%;
}
/* Statuses */
diff --git a/specials/SpecialConstraintReport.php
b/specials/SpecialConstraintReport.php
index b6bd285..9c51150 100644
--- a/specials/SpecialConstraintReport.php
+++ b/specials/SpecialConstraintReport.php
@@ -266,7 +266,7 @@
'placeholder' => $this->msg(
'wbqc-constraintreport-form-entityid-placeholder' )->escaped()
]
];
- $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(),
'wbqc-constraintreport-form' );
+ $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor,
$this->getContext(), 'wbqc-constraintreport-form' );
$htmlForm->setSubmitText( $this->msg(
'wbqc-constraintreport-form-submit-label' )->escaped() );
$htmlForm->setSubmitCallback( function() {
return false;
@@ -312,16 +312,19 @@
*/
private function getExplanationText() {
return Html::rawElement(
- 'div',
- [ 'class' => 'wbqc-explanation' ],
+ 'div',
+ [ 'class' => 'wbqc-explanation' ],
+ Html::rawElement(
+ 'p',
+ [],
$this->msg(
'wbqc-constraintreport-explanation-part-one' )->escaped()
)
- . Html::element( 'br' )
. Html::rawElement(
- 'div',
- [ 'class' => 'wbqc-explanation' ],
+ 'p',
+ [],
$this->msg(
'wbqc-constraintreport-explanation-part-two' )->escaped()
- );
+ )
+ );
}
/**
diff --git a/tests/phpunit/Specials/SpecialConstraintReportTest.php
b/tests/phpunit/Specials/SpecialConstraintReportTest.php
index 87ff139..3f7b1e3 100644
--- a/tests/phpunit/Specials/SpecialConstraintReportTest.php
+++ b/tests/phpunit/Specials/SpecialConstraintReportTest.php
@@ -167,23 +167,29 @@
$matchers = [];
// Empty input
- $matchers['explanationOne'] = both( withTagName( 'div' ) )
+ $matchers['explanationOne'] = both( withTagName( 'p' ) )
->andAlso( havingTextContents(
'(wbqc-constraintreport-explanation-part-one)' ) );
- $matchers['explanationTwo'] = both( withTagName( 'div' ) )
+ $matchers['explanationTwo'] = both( withTagName( 'p' ) )
->andAlso( havingTextContents(
'(wbqc-constraintreport-explanation-part-two)' ) );
- $matchers['entityId'] = tagMatchingOutline(
- ''
+ $matchers['entityId'] = both(
+ tagMatchingOutline( '' )
+ )->andAlso(
+ havingChild( tagMatchingOutline(
+ ''
+ ) )
);
- $matchers['submit'] = tagMatchingOutline(
- ''
+ $matchers['submit'] = both(
+ tagMatchingOutline( '' )
+ )->andAlso(
+ havingChild( allOf(
+ withTagName( 'span' ),
+ havingTextContents(
'(wbqc-constraintreport-form-submit-label)' )
+ ) )