Fix the block options on ViewEdit

Align the checkbox label on the left to conform with dropdowns, avoid
two if with the same conditions, and give variables a better name. Also,
remove an unused message: with OOUI, the old design can't be reproduced.
We could add a fieldset, but then it would be greatly different from
options for other actions.

Change-Id: Ibdc993c1457636215601eb22f5202d2f6ad57bd9
This commit is contained in:
Daimona Eaytoy 2018-08-25 18:56:44 +02:00
parent 937252a74c
commit ef51e7c253
3 changed files with 20 additions and 22 deletions

View file

@ -376,7 +376,6 @@
"abusefilter-edit-builder-vars-file-width": "Width of the file in pixels",
"abusefilter-edit-builder-vars-file-height": "Height of the file in pixels",
"abusefilter-edit-builder-vars-file-bits-per-channel": "Bits per color channel of the file",
"abusefilter-edit-block-options": "Block options:",
"abusefilter-filter-log": "Recent filter changes",
"abusefilter-history": "Change history for Abuse Filter #$1",
"abusefilter-history-foruser": "Changes by $1",

View file

@ -409,7 +409,6 @@
"abusefilter-edit-builder-vars-file-width": "This variable contains the width of the file in pixels",
"abusefilter-edit-builder-vars-file-height": "This variable contains the height of the file in pixels",
"abusefilter-edit-builder-vars-file-bits-per-channel": "This variable contains the number of bits per color channel of the file",
"abusefilter-edit-block-options": "Label for the checkbox for block options",
"abusefilter-filter-log": "Used as page title.",
"abusefilter-history": "Used as page title.\n\n\"Change history\" is the \"history of changes\"\n\nParameters:\n* $1 - filter ID\n\nIf the filter ID is not specified, {{msg-mw|Abusefilter-filter-log}} will be used.",
"abusefilter-history-foruser": "Parameters:\n* $1 - a link to the changing user's page\n* $2 - (Optional) the plain text username",

View file

@ -800,22 +800,6 @@ class AbuseFilterViewEdit extends AbuseFilterView {
]
);
$output .= $checkbox;
if ( $config->get( 'BlockAllowsUTEdit' ) === true ) {
$talkCheckbox =
new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => 'wpFilterBlockTalk',
'id' => 'mw-abusefilter-action-checkbox-blocktalk',
'selected' => isset( $blockTalk ) && $blockTalk == 'blocktalk',
'classes' => [ 'mw-abusefilter-action-checkbox' ]
] + $readOnlyAttrib
),
[
'label' => $this->msg( 'abusefilter-edit-action-blocktalk' )->text(),
'align' => 'inline'
]
);
}
$suggestedBlocks = Xml::listDropDownOptionsOoui( $suggestedBlocks );
@ -835,17 +819,33 @@ class AbuseFilterViewEdit extends AbuseFilterView {
'disabled' => !$this->canEditFilter( $row )
] );
$blockOptions = [];
if ( $config->get( 'BlockAllowsUTEdit' ) === true ) {
$durations['abusefilter-edit-block-options'] = $talkCheckbox;
$talkCheckbox =
new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => 'wpFilterBlockTalk',
'id' => 'mw-abusefilter-action-checkbox-blocktalk',
'selected' => isset( $blockTalk ) && $blockTalk == 'blocktalk',
'classes' => [ 'mw-abusefilter-action-checkbox' ]
] + $readOnlyAttrib
),
[
'label' => $this->msg( 'abusefilter-edit-action-blocktalk' )->text(),
'align' => 'left'
]
);
$blockOptions['abusefilter-edit-block-options'] = $talkCheckbox;
}
$durations['abusefilter-edit-block-anon-durations'] =
$blockOptions['abusefilter-edit-block-anon-durations'] =
new OOUI\FieldLayout(
$anonDuration,
[
'label' => $this->msg( 'abusefilter-edit-block-anon-durations' )->text()
]
);
$durations['abusefilter-edit-block-user-durations'] =
$blockOptions['abusefilter-edit-block-user-durations'] =
new OOUI\FieldLayout(
$userDuration,
[
@ -856,7 +856,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
$output .= Xml::tags(
'div',
[ 'id' => 'mw-abusefilter-block-parameters' ],
new OOUI\FieldsetLayout( [ 'items' => $durations ] )
new OOUI\FieldsetLayout( [ 'items' => $blockOptions ] )
);
return $output;