Implement option "disabled" for picker fields (#6498)

This commit is contained in:
Yuriy Bakhtin 2023-08-11 14:34:19 +04:00 committed by GitHub
parent 02a436d159
commit 86c83556e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5942 deletions

View File

@ -13,6 +13,7 @@ HumHub Changelog
- Enh #68: Online Indicator Position
- Fix #6492: Fix module form "Set as default"
- Fix #6457: Regression with membership cache. Also move cache to `Membership::findMembership`.
- Enh #6498: Implement option "disabled" for picker fields
1.15.0-beta.1 (July 31, 2023)
-----------------------------

View File

@ -2,9 +2,7 @@
namespace humhub\modules\ui\form\widgets;
use humhub\components\ActiveRecord;
use Yii;
use yii\base\Model;
use yii\db\ActiveQuery;
use yii\helpers\Html;
use yii\helpers\Url;
@ -48,9 +46,16 @@ abstract class BasePicker extends JsInputWidget
/**
* Disabled items
* @var array
*/
public $disabledItems;
/**
* Disables the picker field
* @var bool
*/
public $disabled = false;
/**
* Default route used for search queries.
* This can be overwritten by defining the $url.
@ -415,10 +420,11 @@ abstract class BasePicker extends JsInputWidget
'load-more' => Yii::t('UserModule.chooser', 'Load more'),
'input-too-short' => Yii::t('UserModule.chooser', 'Please enter at least {n} character', ['n' => $this->minInput]),
'input-too-long' => Yii::t('UserModule.chooser', 'You reached the maximum number of allowed characters ({n}).', ['n' => $this->maxInput]),
'default-results' => $this->getDefaultResultData()
'default-results' => $this->getDefaultResultData(),
'disabled' => $this->disabled
];
if(!empty($this->disabledItems)) {
if (!empty($this->disabledItems)) {
$result['disabled-items'] = $this->disabledItems;
}

View File

@ -278,10 +278,12 @@
cursor: @cursor-disabled;
}
.select2-selection,
.select2-selection--multiple .select2-selection__choice {
.select2-selection {
background-color: @input-bg-disabled;
}
.select2-selection--multiple .select2-selection__choice {
background-color: @btn-link-disabled-color;
}
.select2-selection__clear,
.select2-selection--multiple .select2-selection__choice__remove {

File diff suppressed because one or more lines are too long