mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 06:08:21 +01:00
Improve a sort order of wall entry creating tab menu and form
This commit is contained in:
parent
a6c7abd3a7
commit
62596ca4e2
@ -13,6 +13,7 @@ HumHub Changelog
|
|||||||
- Fix #6349: Fix error on login new user from external service when maintenance is enabled
|
- Fix #6349: Fix error on login new user from external service when maintenance is enabled
|
||||||
- Fix #6557: Fix not initialized groups array on the module administration
|
- Fix #6557: Fix not initialized groups array on the module administration
|
||||||
- Fix #6556: Fix command `theme/switch`
|
- Fix #6556: Fix command `theme/switch`
|
||||||
|
- Fix #6574: Improve a sort order of wall entry creating tab menu and form
|
||||||
|
|
||||||
1.14.3 (July 27, 2023)
|
1.14.3 (July 27, 2023)
|
||||||
----------------------
|
----------------------
|
||||||
|
@ -29,13 +29,22 @@ class Sort
|
|||||||
$sortA = static::getSortValue($a, $field, $default);
|
$sortA = static::getSortValue($a, $field, $default);
|
||||||
$sortB = static::getSortValue($b, $field, $default);
|
$sortB = static::getSortValue($b, $field, $default);
|
||||||
|
|
||||||
if ($sortA == $sortB) {
|
if (!is_array($sortA)) {
|
||||||
return 0;
|
$sortA = [$sortA];
|
||||||
} elseif ($sortA < $sortB) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
if (!is_array($sortB)) {
|
||||||
|
$sortB = [$sortB];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($sortA as $s => $sortAItem) {
|
||||||
|
$sortBItem = $sortB[$s] ?? $default;
|
||||||
|
if ($sortAItem == $sortBItem) {
|
||||||
|
// Go to compare next sort value
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return $sortAItem < $sortBItem ? -1 : 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
|
@ -11,8 +11,6 @@ use humhub\libs\Sort;
|
|||||||
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
||||||
use humhub\components\Widget;
|
use humhub\components\Widget;
|
||||||
use humhub\modules\content\components\ContentContainerActiveRecord;
|
use humhub\modules\content\components\ContentContainerActiveRecord;
|
||||||
use humhub\modules\content\components\ContentActiveRecord;
|
|
||||||
use Yii;
|
|
||||||
use yii\web\HttpException;
|
use yii\web\HttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +69,7 @@ class WallCreateContentFormContainer extends Widget
|
|||||||
|
|
||||||
$forms[] = [
|
$forms[] = [
|
||||||
'class' => $wallEntryWidget->createFormClass,
|
'class' => $wallEntryWidget->createFormClass,
|
||||||
'sortOrder' => $wallEntryWidget->createFormSortOrder ?? '9999999-' . $content->getContentName(),
|
'sortOrder' => [$wallEntryWidget->createFormSortOrder, ucfirst($content->getContentName())]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,10 @@
|
|||||||
|
|
||||||
namespace humhub\modules\content\widgets;
|
namespace humhub\modules\content\widgets;
|
||||||
|
|
||||||
use humhub\modules\content\components\ContentActiveRecord;
|
|
||||||
use humhub\modules\content\components\ContentContainerActiveRecord;
|
use humhub\modules\content\components\ContentContainerActiveRecord;
|
||||||
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
||||||
use humhub\modules\ui\menu\MenuLink;
|
use humhub\modules\ui\menu\MenuLink;
|
||||||
use humhub\modules\ui\menu\widgets\Menu;
|
use humhub\modules\ui\menu\widgets\Menu;
|
||||||
use Yii;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WallCreateContentMenu is the widget for Menu above wall create content Form
|
* WallCreateContentMenu is the widget for Menu above wall create content Form
|
||||||
@ -80,10 +78,10 @@ class WallCreateContentMenu extends Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
$menuOptions = [
|
$menuOptions = [
|
||||||
'label' => ucfirst($content->getContentName()),
|
'label' => $label = ucfirst($content->getContentName()),
|
||||||
'icon' => $content->getIcon(),
|
'icon' => $content->getIcon(),
|
||||||
'url' => '#',
|
'url' => '#',
|
||||||
'sortOrder' => $wallEntryWidget->createFormSortOrder ?? '9999999-' . $content->getContentName(),
|
'sortOrder' => [$wallEntryWidget->createFormSortOrder, $label]
|
||||||
];
|
];
|
||||||
$url = $this->contentContainer->createUrl($wallEntryWidget->createRoute);
|
$url = $this->contentContainer->createUrl($wallEntryWidget->createRoute);
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ abstract class WallStreamEntryWidget extends StreamEntryWidget
|
|||||||
/**
|
/**
|
||||||
* @var int Sort order of create form and tab menu on wall stream
|
* @var int Sort order of create form and tab menu on wall stream
|
||||||
*/
|
*/
|
||||||
public $createFormSortOrder;
|
public $createFormSortOrder = 1000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Class name of the Form to create a Content from wall stream,
|
* @var string Class name of the Form to create a Content from wall stream,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user