Skip to content

Commit

Permalink
Enh #526: New event from the global calendar: display "Select space..…
Browse files Browse the repository at this point in the history
…." prompt instead of first Space
  • Loading branch information
marc-farre committed Jan 22, 2025
1 parent 9046e57 commit 75d8ce4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions controllers/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ private function getFilterSettings()
public function actionSelect($start = null, $end = null)
{
/* @var $user User */
$contentContainerSelection = [];
$user = Yii::$app->user->getIdentity();
$canSelectProfileCalendar = $user->moduleManager->isEnabled('calendar') || $user->moduleManager->canEnable('calendar');

if ($user->moduleManager->isEnabled('calendar') || $user->moduleManager->canEnable('calendar')) {
$contentContainerSelection = [];
if ($canSelectProfileCalendar) {
$contentContainerSelection[$user->contentcontainer_id] = Yii::t('CalendarModule.base', 'Profile Calendar');
}

Expand All @@ -157,6 +158,7 @@ public function actionSelect($start = null, $end = null)

return $this->renderAjax('selectContainerModal', [
'contentContainerSelection' => $contentContainerSelection,
'canSelectProfileCalendar' => $canSelectProfileCalendar,
'submitUrl' => Url::to(['/calendar/global/select-submit', 'start' => $start, 'end' => $end]),
]);
}
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
1.7.2 (Unreleased)
------------------------
- Fix #525: Fix Space calendar header
- Enh #526: New event from the global calendar: display "Select space..." prompt instead of first Space

1.7.1 (January 17, 2025)
------------------------
Expand Down
7 changes: 6 additions & 1 deletion views/global/selectContainerModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use humhub\widgets\ModalDialog;

/* @var $contentContainerSelection array */
/* @var $canSelectProfileCalendar bool */
/* @var $submitUrl array */

?>
Expand All @@ -20,7 +21,11 @@
<?php if ($contentContainerSelection): ?>
<?php $form = ActiveForm::begin() ?>
<div class="modal-body">
<?= Html::dropDownList('contentContainerId', null, $contentContainerSelection, ['class' => 'form-control', 'data-ui-select2' => '']) ?>
<?= Html::dropDownList('contentContainerId', null, $contentContainerSelection, [
'class' => 'form-control',
'data-ui-select2' => '',
'prompt' => $canSelectProfileCalendar ? null : Yii::t('CalendarModule.base', 'Select space...'),
]) ?>
</div>
<div class="modal-footer">
<?= ModalButton::submitModal($submitUrl, Yii::t('CalendarModule.base', 'Next')) ?>
Expand Down

0 comments on commit 75d8ce4

Please sign in to comment.