Skip to content

Commit

Permalink
Merge pull request #512 from humhub/add-view-to-wall-entry-control-links
Browse files Browse the repository at this point in the history
Enh: Move the widget wall entry links to a view and surround the link…
  • Loading branch information
luke- authored Nov 22, 2024
2 parents 1d29740 + 0ed9e1c commit 834578c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 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 #512: Surround the widget wall entry links with a dedicated HTML class

1.6.4 (Unreleased)
-----------------------
Expand Down
13 changes: 10 additions & 3 deletions widgets/DownloadIcsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;

/**
Expand All @@ -28,9 +27,17 @@ 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 Html::tag(
'span',
Html::a(
Yii::t('CalendarModule.base', 'Download ICS'),
Url::toEntryDownloadICS($this->calendarEntry),
['target' => '_blank'],
),
['class' => 'calendar-entry-ics-download'],
);
}
}
11 changes: 9 additions & 2 deletions widgets/ReminderLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +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\content\components\ContentActiveRecord;
Expand All @@ -27,10 +28,16 @@ class ReminderLink extends Widget

public function run()
{
if (!$this->entry || !$this->entry instanceof ContentActiveRecord || !$this->entry instanceof CalendarEventIF) {
if (!$this->entry instanceof ContentActiveRecord || !$this->entry instanceof CalendarEventIF) {
return;
}

return ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder'))->load(Url::toUserLevelReminderConfig($this->entry))->loader(true);
return Html::tag(
'span',
ModalButton::asLink(Yii::t('CalendarModule.base', 'Set reminder'))
->load(Url::toUserLevelReminderConfig($this->entry))
->loader(true),
['class' => 'calendar-entry-reminder'],
);
}
}

0 comments on commit 834578c

Please sign in to comment.