mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-12 08:15:12 +00:00
Convert SimpleCaptcha to OOUI
Change-Id: Ic904b53b2ac489be572f4b6096ddc8c92c482a59
This commit is contained in:
parent
7951ce701e
commit
423234cb77
|
@ -122,21 +122,30 @@ class SimpleCaptcha {
|
||||||
$index = $this->storeCaptcha( $captcha );
|
$index = $this->storeCaptcha( $captcha );
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'html' => "<p><label for=\"wpCaptchaWord\">{$captcha['question']} = </label>" .
|
'html' =>
|
||||||
Xml::element( 'input', [
|
new OOUI\FieldLayout(
|
||||||
'name' => 'wpCaptchaWord',
|
new OOUI\NumberInputWidget( [
|
||||||
'class' => 'mw-ui-input',
|
'name' => 'wpCaptchaWord',
|
||||||
'id' => 'wpCaptchaWord',
|
'classes' => [ 'simplecaptcha-answer' ],
|
||||||
'size' => 5,
|
'id' => 'wpCaptchaWord',
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
// tab in before the edit textarea
|
// tab in before the edit textarea
|
||||||
'tabindex' => $tabIndex ] ) .
|
'tabIndex' => $tabIndex
|
||||||
"</p>\n" .
|
] ),
|
||||||
Xml::element( 'input', [
|
[
|
||||||
'type' => 'hidden',
|
'align' => 'left',
|
||||||
'name' => 'wpCaptchaId',
|
'label' => $captcha['question'] . ' = ',
|
||||||
'id' => 'wpCaptchaId',
|
'classes' => [ 'simplecaptcha-field' ],
|
||||||
'value' => $index ] )
|
]
|
||||||
|
) .
|
||||||
|
new OOUI\HiddenInputWidget( [
|
||||||
|
'name' => 'wpCaptchaId',
|
||||||
|
'id' => 'wpCaptchaId',
|
||||||
|
'value' => $index
|
||||||
|
] ),
|
||||||
|
'modulestyles' => [
|
||||||
|
'ext.confirmEdit.simpleCaptcha'
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
SimpleCaptcha/resources/ext.confirmEdit.simpleCaptcha.css
Normal file
10
SimpleCaptcha/resources/ext.confirmEdit.simpleCaptcha.css
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.simplecaptcha-field .oo-ui-fieldLayout-header {
|
||||||
|
/* stylelint-disable declaration-no-important */
|
||||||
|
width: auto !important;
|
||||||
|
padding-right: 1em !important;
|
||||||
|
/* stylelint-enable declaration-no-important */
|
||||||
|
}
|
||||||
|
|
||||||
|
.simplecaptcha-answer.oo-ui-textInputWidget {
|
||||||
|
width: 5em;
|
||||||
|
}
|
|
@ -73,6 +73,9 @@
|
||||||
},
|
},
|
||||||
"ext.confirmEdit.visualEditor": {
|
"ext.confirmEdit.visualEditor": {
|
||||||
"scripts": "ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js"
|
"scripts": "ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js"
|
||||||
|
},
|
||||||
|
"ext.confirmEdit.simpleCaptcha": {
|
||||||
|
"styles": "../SimpleCaptcha/resources/ext.confirmEdit.simpleCaptcha.css"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"VisualEditorPluginModules": [
|
"VisualEditorPluginModules": [
|
||||||
|
|
Loading…
Reference in a new issue