Skip to content

Commit

Permalink
Enh: Move the widget wall entry links to a view and surround the link…
Browse files Browse the repository at this point in the history
…s with a div having a dedicated class
  • Loading branch information
marc-farre committed Nov 16, 2024
1 parent 1d29740 commit 22ef4f8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
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.0 (Unreleased)
-----------------------
- Fix #509: Fix event type visibility
- Enh: Move the widget wall entry links to a view and surround the links with a div having a dedicated class

1.6.4 (Unreleased)
-----------------------
Expand Down
10 changes: 4 additions & 6 deletions widgets/DownloadIcsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
namespace humhub\modules\calendar\widgets;

use humhub\components\Widget;
use humhub\libs\Html;
use humhub\modules\calendar\helpers\Url;
use humhub\modules\calendar\interfaces\event\CalendarEventIF;
use humhub\modules\calendar\models\CalendarEntry;
use Yii;

/**
* Class DownloadIcsLink
Expand All @@ -28,9 +24,11 @@ class DownloadIcsLink extends Widget
public function run()
{
if ($this->calendarEntry === null) {
return;
return '';
}

return Html::a(Yii::t('CalendarModule.base', 'Download ICS'), Url::toEntryDownloadICS($this->calendarEntry), ['target' => '_blank']);
return $this->render('downloadLink', [
'calendarEntry' => $this->calendarEntry,
]);
}
}
7 changes: 3 additions & 4 deletions widgets/ReminderLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
namespace humhub\modules\calendar\widgets;

use humhub\components\Widget;
use humhub\modules\calendar\helpers\Url;
use humhub\modules\calendar\interfaces\event\CalendarEventIF;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\widgets\ModalButton;
use Yii;

/**
* Class DownloadIcsLink
Expand All @@ -31,6 +28,8 @@ public function run()
return;
}

return ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder'))->load(Url::toUserLevelReminderConfig($this->entry))->loader(true);
return $this->render('reminderLink', [
'entry' => $this->entry,
]);
}
}
16 changes: 16 additions & 0 deletions widgets/views/downloadLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use humhub\libs\Html;
use humhub\modules\calendar\helpers\Url;
use humhub\modules\calendar\interfaces\event\CalendarEventIF;
use humhub\modules\ui\view\components\View;

/**
* @var $this View
* @var $calendarEntry CalendarEventIF
*/
?>

<span class="calendar-entry-download-link">
<?= Html::a(Yii::t('CalendarModule.base', 'Download ICS'), Url::toEntryDownloadICS($calendarEntry), ['target' => '_blank']) ?>
</span>
16 changes: 16 additions & 0 deletions widgets/views/reminderLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use humhub\modules\calendar\helpers\Url;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\ui\view\components\View;
use humhub\widgets\ModalButton;

/**
* @var $this View
* @var $entry ContentActiveRecord
*/
?>

<span class="calendar-entry-reminder-link">
<?= ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder'))->load(Url::toUserLevelReminderConfig($entry))->loader(true) ?>
</span>

0 comments on commit 22ef4f8

Please sign in to comment.