Reduce form whitespace on Special:AbuseFilter and compact variables

The conversion to OOUI brought some extra whitespace that creates some
problems while viewing the page, especially with specific skins. This
patch compacts four different form fields in a single one, having the
side benefit of reducing the amount of used variables.

Bug: T189425
Change-Id: I75aa83e36d12db65d8b54c76b3ea14c8c797215e
This commit is contained in:
Daimona Eaytoy 2018-06-12 13:28:41 +02:00
parent e2232714f8
commit fcc07db95c
3 changed files with 25 additions and 36 deletions

View file

@ -133,8 +133,7 @@
"abusefilter-list-options-scope-local": "Local rules only",
"abusefilter-list-options-scope-global": "Global rules only",
"abusefilter-list-options-scope-all": "Local and global rules",
"abusefilter-list-options-disabled": "Disabled filters:",
"abusefilter-list-options-private": "Private filters:",
"abusefilter-list-options-further-options": "Further options:",
"abusefilter-list-options-hidedisabled": "Hide disabled filters",
"abusefilter-list-options-hideprivate": "Hide private filters",
"abusefilter-list-options-searchfield": "Search within rules:",

View file

@ -166,8 +166,7 @@
"abusefilter-list-options-scope-local": "Radio button indicating that local rules should be shown.",
"abusefilter-list-options-scope-global": "Radio button indicating that global rules should be shown",
"abusefilter-list-options-scope-all": "Radio button indicating that local and global rules should be shown",
"abusefilter-list-options-disabled": "Field label in filter form.",
"abusefilter-list-options-private": "Field label in filter form.",
"abusefilter-list-options-further-options": "Field label in filter form.",
"abusefilter-list-options-hidedisabled": "Checkbox label in filter form.",
"abusefilter-list-options-hideprivate": "Checkbox label in filter form.",
"abusefilter-list-options-searchfield": "Field label in filter form.",

View file

@ -30,8 +30,14 @@ class AbuseFilterViewList extends AbuseFilterView {
// Options.
$conds = [];
$deleted = $request->getVal( 'deletedfilters' );
$hidedisabled = $request->getBool( 'hidedisabled' );
$hideprivate = $request->getBool( 'hideprivate' );
$furtherOptions = $request->getArray( 'furtheroptions', [] );
// Backward compatibility with old links
if ( $request->getBool( 'hidedisabled' ) ) {
$furtherOptions[] = 'hidedisabled';
}
if ( $request->getBool( 'hideprivate' ) ) {
$furtherOptions[] = 'hideprivate';
}
$defaultscope = 'all';
if ( $config->get( 'AbuseFilterCentralDB' ) !== null
&& !$config->get( 'AbuseFilterIsCentral' ) ) {
@ -59,11 +65,11 @@ class AbuseFilterViewList extends AbuseFilterView {
$conds['af_deleted'] = 0;
$deleted = 'hide';
}
if ( $hidedisabled ) {
if ( in_array( 'hidedisabled', $furtherOptions ) ) {
$conds['af_deleted'] = 0;
$conds['af_enabled'] = 1;
}
if ( $hideprivate ) {
if ( in_array( 'hideprivate', $furtherOptions ) ) {
$conds['af_hidden'] = 0;
}
@ -94,8 +100,7 @@ class AbuseFilterViewList extends AbuseFilterView {
[ 'af_deleted' => 0 ],
compact(
'deleted',
'hidedisabled',
'hideprivate',
'furtherOptions',
'querypattern',
'searchmode',
'scope',
@ -126,8 +131,7 @@ class AbuseFilterViewList extends AbuseFilterView {
$conds,
compact(
'deleted',
'hidedisabled',
'hideprivate',
'furtherOptions',
'querypattern',
'searchmode',
'scope',
@ -147,8 +151,7 @@ class AbuseFilterViewList extends AbuseFilterView {
);
$deleted = $optarray['deleted'];
$hidedisabled = $optarray['hidedisabled'];
$hideprivate = $optarray['hideprivate'];
$furtherOptions = $optarray['furtherOptions'];
$scope = $optarray['scope'];
$searchEnabled = $optarray['searchEnabled'];
@ -214,28 +217,16 @@ class AbuseFilterViewList extends AbuseFilterView {
];
}
$formDescriptor['infodisabled'] = [
'type' => 'info',
'default' => $this->msg( 'abusefilter-list-options-disabled' )->parse(),
];
$formDescriptor['hidedisabled'] = [
'name' => 'hidedisabled',
'type' => 'check',
'label-message' => 'abusefilter-list-options-hidedisabled',
'selected' => $hidedisabled,
];
$formDescriptor['infoprivate'] = [
'type' => 'info',
'default' => $this->msg( 'abusefilter-list-options-private' )->parse(),
];
$formDescriptor['hideprivate'] = [
'name' => 'hideprivate',
'type' => 'check',
'label-message' => 'abusefilter-list-options-hideprivate',
'selected' => $hideprivate,
$formDescriptor['furtheroptions'] = [
'name' => 'furtheroptions',
'type' => 'multiselect',
'label-message' => 'abusefilter-list-options-further-options',
'flatlist' => true,
'options' => [
$this->msg( 'abusefilter-list-options-hideprivate' )->parse() => 'hideprivate',
$this->msg( 'abusefilter-list-options-hidedisabled' )->parse() => 'hidedisabled',
],
'default' => $furtherOptions
];
// ToDo: Since this is only for saving space, we should convert it