diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index 069f926a25..2e74161797 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -19,6 +19,9 @@ HumHub Change Log - Enh: Added `grunt test-server` and `grunt test` - Chng: `humhub\modules\content\models\Content` now implements `humhub\modules\content\interfaces\ContentOwner` - Fix: Target container not available in `humhub\modules\content\components\ContentActiveRecord:afterMove()` +- Chng: `humhub\modules\topic\models\Topic::attach` now accepts `humhub\modules\content\interfaces\ContentOwner` instances +- Fix: Richtext without focusMenu on small devices overlaps previous sibling +- Enh: Added random default color to `humhub\modules\ui\form\widgets\ColorPicker` diff --git a/protected/humhub/modules/ui/form/widgets/ColorPicker.php b/protected/humhub/modules/ui/form/widgets/ColorPicker.php index 63cf9904da..6180a0b9a7 100644 --- a/protected/humhub/modules/ui/form/widgets/ColorPicker.php +++ b/protected/humhub/modules/ui/form/widgets/ColorPicker.php @@ -8,6 +8,7 @@ namespace humhub\modules\ui\form\widgets; +use Colors\RandomColor; use humhub\modules\ui\form\widgets\JsInputWidget; /** @@ -34,6 +35,11 @@ class ColorPicker extends JsInputWidget */ public $attribute = 'color'; + /** + * @var bool If set to true, a random color will be set as default + */ + public $randomDefault = true; + /** * @inheritdoc */ @@ -42,6 +48,11 @@ class ColorPicker extends JsInputWidget if (!empty($this->field)) { $this->attribute = $this->field; } + + if($this->hasModel() && !$this->getValue() && $this->randomDefault) { + $attr = $this->attribute; + $this->model->$attr = RandomColor::one(['luminosity' => 'dark']); + } } /**