Skip to content

Commit

Permalink
Fix theme/create command (#2035)
Browse files Browse the repository at this point in the history
* Translation helper controler

* PHPdoc

* Correct parameter order for help

* Documentation for block preview luyadev/luya-module-cms#83

* Revert PHP doc

* Travis mysql connection failed

* config with env scope

* used call_user_func for callback

* Update Config.php

* theme load without exception as default

* theme load without exception as default

* theme load without exception as default

* Update ThemeManager.php

* changelog #1969

* Update CHANGELOG.md

* add php doc

* theme management image for guide #1983

* Update app-themes.md

* Theme command

* Create theme command

* Changelog

* fixed theme/create command #2020

* Changelog #2020

* Fix unit test for theme create command

* Fix unit test for theme create command

Co-authored-by: Basil <git@nadar.io>
  • Loading branch information
boehsermoe and nadar committed Jul 2, 2020
1 parent 9fc91c2 commit bed31e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions core/CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE
## 1.5.1 (in progress)

+ [#2031](https://github.com/luyadev/luya/issues/2031) Updated LazyLoad for `options` array so that `alt` and `title` attributes can be passed to it.
+ [#2020](https://github.com/luyadev/luya/issues/2020) Fixed generated files of theme/create command.

## 1.5.0 (19. June 2020)

Expand Down
6 changes: 3 additions & 3 deletions core/console/commands/ThemeController.php
Expand Up @@ -87,7 +87,7 @@ public function actionCreate(string $themeName = null)
$contents = [
$themeFolder. DIRECTORY_SEPARATOR . 'theme.json' => $this->renderJson($basePath, $themeName),
$themeFolder. DIRECTORY_SEPARATOR . ucfirst($themeName) . 'Asset.php' => $this->renderAssetClass($themeName),
$themeFolder. DIRECTORY_SEPARATOR . 'resources/'. $themeName .'-asset/style.css' => '',
$themeFolder. DIRECTORY_SEPARATOR . 'resources/'. $themeName .'.css' => '',
$themeFolder. DIRECTORY_SEPARATOR . 'views/layouts/theme.php' => $this->renderLayout($themeName),
$themeFolder. DIRECTORY_SEPARATOR . 'views/cmslayouts/theme.php' => $this->renderCmsLayout($themeName),
];
Expand Down Expand Up @@ -159,7 +159,7 @@ private function renderAssetClass($themeName)
class {$className} extends Asset
{
public \$css = [
\'{$themeName}.css\',
'resources/{$themeName}.css',
];
}";
}
Expand All @@ -177,7 +177,7 @@ private function renderLayout($themeName)
/**
* @var $this \luya\web\View
*/
use luya\themes\frontend\\'.$className.';
use app\themes\\'.$themeName.'\\'.$className.';
'.$className.'::register($this);
Expand Down
8 changes: 5 additions & 3 deletions tests/core/console/commands/ThemeControllerTest.php
Expand Up @@ -22,9 +22,11 @@ public function testActionCreate()
$this->assertEquals(0, $exitCode);

$this->assertDirectoryExists($themePath);
$this->assertDirectoryExists($themePath . DIRECTORY_SEPARATOR . 'resources');
$this->assertDirectoryExists($themePath . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'cmslayouts');
$this->assertDirectoryExists($themePath . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'layouts');
$this->assertDirectoryExists($themePath . 'resources');
$this->assertFileExists($themePath . 'resources/mynewtheme.css');
$this->assertFileExists($themePath . 'MynewthemeAsset.php');
$this->assertFileExists($themePath . 'views' . DIRECTORY_SEPARATOR . 'cmslayouts/theme.php');
$this->assertFileExists($themePath . 'views' . DIRECTORY_SEPARATOR . 'layouts/theme.php');

$expectedJson = <<<JSON
{
Expand Down

0 comments on commit bed31e2

Please sign in to comment.