diff --git a/.github/workflows/php-test-v1.8.yml b/.github/workflows/php-test-v1.8.yml deleted file mode 100644 index fb31d3f..0000000 --- a/.github/workflows/php-test-v1.8.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: PHP Codeception Tests - v1.8 - -on: - push: - -jobs: - tests: - uses: humhub/actions/.github/workflows/module-tests-v1.8.yml@main - with: - module-id: birthday diff --git a/Events.php b/Events.php new file mode 100644 index 0000000..ea0908f --- /dev/null +++ b/Events.php @@ -0,0 +1,35 @@ +user->isGuest) { + return; + } + + /* @var Module $module */ + $module = Yii::$app->getModule('birthday'); + + /* @var Sidebar $sidebar */ + $sidebar = $event->sender; + $sidebar->addWidget(BirthdaySidebarWidget::class, [], ['sortOrder' => $module->sidebarSortOrder]); + } +} diff --git a/Module.php b/Module.php index 81c585f..ff71697 100644 --- a/Module.php +++ b/Module.php @@ -2,42 +2,20 @@ namespace humhub\modules\birthday; -use Yii; -use humhub\modules\birthday\widgets\BirthdaySidebarWidget; use humhub\models\Setting; use yii\helpers\Url; /** * BirthdayModule is responsible for the the birthday functions. - * + * * @author Sebastian Stumpf */ class Module extends \humhub\components\Module { /** - * @inheritdoc - */ - public $resourcesPath = 'assets'; - - /** * * @var int the sort order for the birthdays sidebar widget */ - public $sidebarSortOrder = 200; - - /** - * On build of the dashboard sidebar widget, add the birthday widget if module is enabled. - * - * @param type $event - */ - public static function onSidebarInit($event) - { - if (Yii::$app->user->isGuest) { - return; - } - - $module = Yii::$app->getModule('birthday'); - $event->sender->addWidget(BirthdaySidebarWidget::class, [], ['sortOrder' => $module->sidebarSortOrder]); - } + public int $sidebarSortOrder = 200; /** * @inheritdoc @@ -57,5 +35,3 @@ public function enable() } } - -?> diff --git a/Assets.php b/assets/Assets.php similarity index 56% rename from Assets.php rename to assets/Assets.php index 409d094..019123e 100644 --- a/Assets.php +++ b/assets/Assets.php @@ -1,22 +1,18 @@ sourcePath = dirname(__FILE__) . '/assets'; - parent::init(); - } - + /** + * @inheritdoc + */ + public $sourcePath = '@birthday/resources'; } diff --git a/config.php b/config.php index 19029c2..02b5f95 100644 --- a/config.php +++ b/config.php @@ -1,5 +1,6 @@ 'humhub\modules\birthday\Module', 'namespace' => 'humhub\modules\birthday', 'events' => [ - array('class' => Sidebar::class, 'event' => Sidebar::EVENT_INIT, 'callback' => array('humhub\modules\birthday\Module', 'onSidebarInit')), + ['class' => Sidebar::class, 'event' => Sidebar::EVENT_INIT, 'callback' => [Events::class, 'onDashboardSidebarInit']], ], ]; -?> diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6b7dd0d..ded2534 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,10 +1,10 @@ Changelog ========= -1.0.16 - Unreleased +1.1.0 - Unreleased ----------------------- - Enh #36: Tests for `next` version -- Fix #37: Set module resources path +- Fix #37: Update module resources path 1.0.15 - April 14, 2022 ----------------------- diff --git a/module.json b/module.json index ba294a0..ff4c833 100644 --- a/module.json +++ b/module.json @@ -1,15 +1,15 @@ { "id": "birthday", "name": "Birthday Widget", - "description": "Adds a widget to the dashbaord showing upcoming birthdays.", + "description": "Adds a widget to the dashboard showing upcoming birthdays.", "keywords": [ "birthday", "widget", "dashboard" ], - "version": "1.0.16", + "version": "1.1.0", "humhub": { - "minVersion": "1.8" + "minVersion": "1.17" }, "homepage": "https://github.com/humhub-contrib/birthday", "authors": [ @@ -18,8 +18,8 @@ } ], "screenshots": [ - "assets/screen1.PNG", - "assets/screen2.PNG", - "assets/screen3.PNG" + "resources/screen1.PNG", + "resources/screen2.PNG", + "resources/screen3.PNG" ] } diff --git a/assets/cake.png b/resources/cake.png similarity index 100% rename from assets/cake.png rename to resources/cake.png diff --git a/assets/module_image.png b/resources/module_image.png similarity index 100% rename from assets/module_image.png rename to resources/module_image.png diff --git a/assets/screen1.PNG b/resources/screen1.PNG similarity index 100% rename from assets/screen1.PNG rename to resources/screen1.PNG diff --git a/assets/screen2.PNG b/resources/screen2.PNG similarity index 100% rename from assets/screen2.PNG rename to resources/screen2.PNG diff --git a/assets/screen3.PNG b/resources/screen3.PNG similarity index 100% rename from assets/screen3.PNG rename to resources/screen3.PNG diff --git a/widgets/views/birthdayPanel.php b/widgets/views/birthdayPanel.php index 5bdf046..b50cdf5 100644 --- a/widgets/views/birthdayPanel.php +++ b/widgets/views/birthdayPanel.php @@ -10,7 +10,7 @@ * @package humhub.modules.birthday.widgets.views * @author Sebastian Stumpf */ -$assets = \humhub\modules\birthday\Assets::register($this); +$assets = \humhub\modules\birthday\assets\Assets::register($this); ?>