Skip to content

Commit

Permalink
Fix module ID
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Sep 19, 2024
1 parent f75ef6a commit 2549a6b
Show file tree
Hide file tree
Showing 38 changed files with 1,092 additions and 1,096 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php-test-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-develop.yml@main
with:
module-id: external_calendar
module-id: external-calendar
install-composer: true
additional-module-id: calendar
additional-module-composer: true
additional-module-composer: true
2 changes: 1 addition & 1 deletion .github/workflows/php-test-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-master.yml@main
with:
module-id: external_calendar
module-id: external-calendar
install-composer: true
additional-module-id: calendar
additional-module-composer: true
30 changes: 15 additions & 15 deletions .github/workflows/php-test-next.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: PHP Codeception Tests - next

on:
push:
schedule:
- cron: "0 0 * * 0"

jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-next.yml@main
with:
module-id: external_calendar
install-composer: true
additional-module-id: calendar
additional-module-composer: true
name: PHP Codeception Tests - next

on:
push:
schedule:
- cron: "0 0 * * 0"

jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-next.yml@main
with:
module-id: external-calendar
install-composer: true
additional-module-id: calendar
additional-module-composer: true
16 changes: 8 additions & 8 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function registerAutoloader()
return;
}

require Yii::getAlias('@external_calendar/vendor/autoload.php');
require Yii::getAlias('@external-calendar/vendor/autoload.php');
}

/**
Expand All @@ -55,7 +55,7 @@ public static function onGetCalendarItemTypes($event)
try {
$contentContainer = $event->contentContainer;

if (!$contentContainer || $contentContainer->moduleManager->isEnabled('external_calendar')) {
if (!$contentContainer || $contentContainer->moduleManager->isEnabled('external-calendar')) {
CalendarExtension::addItemTypes($event);
}
} catch (\Throwable $e) {
Expand All @@ -71,14 +71,14 @@ public static function onContainerConfigMenuInit($event)
try {
/* @var $container ContentContainerActiveRecord */
$container = $event->sender->contentContainer;
if($container && $container->moduleManager->isEnabled('external_calendar')) {
if($container && $container->moduleManager->isEnabled('external-calendar')) {
$event->sender->addItem([
'label' => Yii::t('ExternalCalendarModule.base', 'External Calendars'),
'id' => 'tab-calendar-external',
'url' => $container->createUrl('/external_calendar/calendar/index'),
'url' => $container->createUrl('/external-calendar/calendar/index'),
'visible' => $container->can(ManageEntry::class),
'isActive' => (Yii::$app->controller->module
&& Yii::$app->controller->module->id === 'external_calendar'),
&& Yii::$app->controller->module->id === 'external-calendar'),
]);
}
} catch (\Throwable $e) {
Expand All @@ -92,7 +92,7 @@ public static function onFindCalendarItems($event)
/* @var ContentContainerActiveRecord $contentContainer */
$contentContainer = $event->contentContainer;

if (!$contentContainer || $contentContainer->moduleManager->isEnabled('external_calendar')) {
if (!$contentContainer || $contentContainer->moduleManager->isEnabled('external-calendar')) {
CalendarExtension::addItems($event);
}
} catch (\Throwable $e) {
Expand Down Expand Up @@ -124,10 +124,10 @@ public static function onAdminMenuInit($event)
try {
$event->sender->addItem([
'label' => "external_calendar",
'url' => Url::to(['/external_calendar/admin']),
'url' => Url::to(['/external-calendar/admin']),
'group' => 'manage',
'icon' => '<i class="fa fa-certificate" style="color: #6fdbe8;"></i>',
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'external_calendar' && Yii::$app->controller->id == 'admin'),
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'external-calendar' && Yii::$app->controller->id == 'admin'),
'sortOrder' => 99999,
]);
} catch (\Throwable $e) {
Expand Down
4 changes: 2 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public function disableContentContainer(ContentContainerActiveRecord $container)

public function getConfigUrl()
{
return Url::to(['/external_calendar/config/index']);
return Url::to(['/external-calendar/config/index']);
}

public function getContentContainerConfigUrl(ContentContainerActiveRecord $container)
{
if ($container->permissionManager->can(ManageCalendar::class)) {
return $container->createUrl('/external_calendar/calendar/index');
return $container->createUrl('/external-calendar/calendar/index');
} else {
return;
}
Expand Down
60 changes: 30 additions & 30 deletions assets/Assets.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?php

namespace humhub\modules\external_calendar\assets;

use yii\web\AssetBundle;
use yii\web\View;

/**
* Assets
*
* @author David Born ([staxDB](https://github.com/staxDB))
*/
class Assets extends AssetBundle
{
public $sourcePath = '@external_calendar/resources';

public $jsOptions = ['position' => View::POS_END];

public $publishOptions = [
'forceCopy' => false
];

public $css = [
'css/humhub.external_calendar.css'
];

public $js = [
'js/humhub.external_calendar.js'
];
}
<?php

namespace humhub\modules\external_calendar\assets;

use yii\web\AssetBundle;
use yii\web\View;

/**
* Assets
*
* @author David Born ([staxDB](https://github.com/staxDB))
*/
class Assets extends AssetBundle
{
public $sourcePath = '@external-calendar/resources';

public $jsOptions = ['position' => View::POS_END];

public $publishOptions = [
'forceCopy' => false
];

public $css = [
'css/humhub.external_calendar.css'
];

public $js = [
'js/humhub.external_calendar.js'
];
}
2 changes: 1 addition & 1 deletion components/PageUrlRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PageUrlRule extends Component implements UrlRuleInterface
/**
* @var string default route to page home
*/
public $searchRoute = 'external_calendar/export/export';
public $searchRoute = 'external-calendar/export/export';

/**
* @var array map with space guid/url pairs
Expand Down
3 changes: 1 addition & 2 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use humhub\components\Application;

return [
'id' => 'external_calendar',
'id' => 'external-calendar',
'class' => Module::class,
'namespace' => 'humhub\modules\external_calendar',
'urlManagerRules' => [
Expand All @@ -28,4 +28,3 @@
],
];
?>

4 changes: 2 additions & 2 deletions controllers/EntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function renderModal($model, $cal)
{
return $this->renderAjax('modal', [
'model' => $model,
'editUrl' => $this->contentContainer->createUrl('/external_calendar/entry/update', ['id' => $model->id, 'cal' => $cal]),
'editUrl' => $this->contentContainer->createUrl('/external-calendar/entry/update', ['id' => $model->id, 'cal' => $cal]),
'canManageEntries' => $model->content->canEdit(),
'contentContainer' => $this->contentContainer,
]);
Expand Down Expand Up @@ -123,7 +123,7 @@ public function actionUpdate($id, $cal = null)
return $this->renderAjax('update', [
'model' => $model,
'contentContainer' => $this->contentContainer,
'editUrl' => $this->contentContainer->createUrl('/external_calendar/entry/update', ['id' => $model->id, 'cal' => $cal]),
'editUrl' => $this->contentContainer->createUrl('/external-calendar/entry/update', ['id' => $model->id, 'cal' => $cal]),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function actionExport($token, $from = null, $to = null)
$ics = $this->exportService->createIcsByExportToken($token, $from, $to);

/** @var Module $module */
$module = Yii::$app->getModule('external_calendar');
$module = Yii::$app->getModule('external-calendar');
return Yii::$app->response->sendContentAsFile($ics, $module->exportFileName, ['mimeType' => $module->exportFileMime]);
}

Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog
- Fix #76: Disabling the module in a container (Space or User)
- Fix #78: Remove module name translation
- Enh #79: Replace theme variables with CSS variables
- Fix #80: Fix module ID

1.4.2 (January 19, 2023)
-----------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

then go to `Administration -> Modules` and **Enable** the **External Calendar** module.

**_Note:_** You need to enable the [original calendar module](https://github.com/humhub/humhub-modules-calendar) first. The external_calendar module only works if it is activated!
**_Note:_** You need to enable the [original calendar module](https://github.com/humhub/humhub-modules-calendar) first. The external calendar module only works if it is activated!

If you want to add external calendars, go to a specific space (or your own profile), activate the external_calendar module in the space settings (or profile settings) and start the configuration of the module here.
If you want to add external calendars, go to a specific space (or your own profile), activate the external calendar module in the space settings (or profile settings) and start the configuration of the module here.
**If there is an error, something went wrong with your sync.**

## Settings
Expand Down
4 changes: 2 additions & 2 deletions models/CalendarExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getContainers()

public function getExportUrl()
{
return Url::to(['/external_calendar/export/export', 'token' => $this->token], true);
return Url::to(['/external-calendar/export/export', 'token' => $this->token], true);
}

/**
Expand Down Expand Up @@ -161,4 +161,4 @@ public function attributeLabels()
'filter_only_public' => Yii::t('ExternalCalendarModule.export', 'Only include public events')
];
}
}
}
4 changes: 2 additions & 2 deletions models/ExternalCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ExternalCalendar extends ContentActiveRecord implements Searchable
/**
* @inheritdoc
*/
public $moduleId = 'external_calendar';
public $moduleId = 'external-calendar';
/**
* @inheritdoc
*/
Expand Down Expand Up @@ -288,7 +288,7 @@ public function afterMove(ContentContainerActiveRecord $container = null)

public function getUrl()
{
return $this->content->container->createUrl('//external_calendar/calendar/view', ['id' => $this->id]);
return $this->content->container->createUrl('/external-calendar/calendar/view', ['id' => $this->id]);
}


Expand Down
Loading

0 comments on commit 2549a6b

Please sign in to comment.